1#![doc = include_str!("readme.md")]
2use crate::language::CsvLanguage;
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")]
8pub struct CsvLanguageService<V: Vfs> {
10 vfs: V,
12 workspace: oak_lsp::workspace::WorkspaceManager,
14}
15impl<V: Vfs> CsvLanguageService<V> {
16 pub fn new(vfs: V) -> Self {
18 Self { vfs, workspace: oak_lsp::workspace::WorkspaceManager::new() }
19 }
20}
21impl<V: Vfs + Send + Sync + 'static + oak_vfs::WritableVfs> LanguageService for CsvLanguageService<V> {
22 type Lang = CsvLanguage;
23 type Vfs = V;
24 fn vfs(&self) -> &Self::Vfs {
25 &self.vfs
26 }
27 fn workspace(&self) -> &oak_lsp::workspace::WorkspaceManager {
28 &self.workspace
29 }
30 fn get_root(&self, _uri: &str) -> impl Future<Output = Option<RedNode<'_, CsvLanguage>>> + Send + '_ {
31 async move { None }
32 }
33 fn hover(&self, _uri: &str, _range: Range<usize>) -> impl Future<Output = Option<LspHover>> + Send + '_ {
34 async move { None }
35 }
36}