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