1#![doc = include_str!("readme.md")]
2use crate::language::CLanguage;
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 CLanguageService<V: Vfs> {
10 vfs: V,
11 workspace: oak_lsp::workspace::WorkspaceManager,
12}
13impl<V: Vfs> CLanguageService<V> {
14 pub fn new(vfs: V) -> Self {
16 Self { vfs, workspace: oak_lsp::workspace::WorkspaceManager::new() }
17 }
18}
19impl<V: Vfs + Send + Sync + 'static + oak_vfs::WritableVfs> LanguageService for CLanguageService<V> {
20 type Lang = CLanguage;
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<'_, CLanguage>>> + Send + '_ {
29 async move { None }
30 }
31 fn hover(&self, _uri: &str, _range: Range<usize>) -> impl Future<Output = Option<LspHover>> + Send + '_ {
32 async move { None }
33 }
34}