oak_dockerfile/lsp/
mod.rs1#![doc = include_str!("readme.md")]
2use crate::language::DockerfileLanguage;
3use core::range::Range;
4use oak_core::tree::RedNode;
5#[cfg(feature = "lsp")]
6use {futures::Future, oak_lsp::service::LanguageService, oak_lsp::types::Hover as LspHover, oak_vfs::Vfs};
7#[cfg(feature = "lsp")]
9pub struct DockerfileLanguageService<V: Vfs> {
10 vfs: V,
11 workspace: oak_lsp::workspace::WorkspaceManager,
12}
13
14impl<V: Vfs> DockerfileLanguageService<V> {
15 pub fn new(vfs: V) -> Self {
17 Self { vfs, workspace: oak_lsp::workspace::WorkspaceManager::new() }
18 }
19}
20impl<V: Vfs + Send + Sync + 'static + oak_vfs::WritableVfs> LanguageService for DockerfileLanguageService<V> {
21 type Lang = DockerfileLanguage;
22 type Vfs = V;
23 fn vfs(&self) -> &Self::Vfs {
24 &self.vfs
25 }
26 fn workspace(&self) -> &oak_lsp::workspace::WorkspaceManager {
27 &self.workspace
28 }
29 fn get_root(&self, _uri: &str) -> impl Future<Output = Option<RedNode<'_, DockerfileLanguage>>> + Send + '_ {
30 async move { None }
31 }
32 fn hover(&self, _uri: &str, _range: Range<usize>) -> impl Future<Output = Option<LspHover>> + Send + '_ {
33 async move { None }
34 }
35}