Skip to main content

oak_java/lsp/
mod.rs

1#![doc = include_str!("readme.md")]
2#[cfg(feature = "oak-highlight")]
3pub mod highlighter;
4
5use crate::language::JavaLanguage;
6use oak_core::tree::RedNode;
7#[cfg(feature = "lsp")]
8use {oak_lsp::LanguageService, oak_vfs::Vfs, std::future::Future};
9#[cfg(feature = "lsp")]
10pub struct JavaLanguageService<V: Vfs> {
11    vfs: V,
12    workspace: oak_lsp::workspace::WorkspaceManager,
13}
14impl<V: Vfs> JavaLanguageService<V> {
15    pub fn new(vfs: V, _language: JavaLanguage) -> Self {
16        Self { vfs, workspace: oak_lsp::workspace::WorkspaceManager::default() }
17    }
18}
19impl<V: Vfs + Send + Sync + 'static + oak_vfs::WritableVfs> LanguageService for JavaLanguageService<V> {
20    type Lang = JavaLanguage;
21    type Vfs = V;
22    fn vfs(&self) -> &Self::Vfs {
23        &self.vfs
24    }
25    fn workspace(&self) -> &oak_lsp::workspace::WorkspaceManager {
26        &self.workspace
27    }
28    fn get_root(&self, _uri: &str) -> impl Future<Output = Option<RedNode<'_, JavaLanguage>>> + Send + '_ {
29        async move { None }
30    }
31}