oak_purescript/lsp/
mod.rs1#![doc = include_str!("readme.md")]
2#[cfg(feature = "oak-highlight")]
3pub mod highlighter;
4
5use crate::language::PurescriptLanguage;
6use core::range::Range;
7use oak_core::tree::RedNode;
8#[cfg(feature = "lsp")]
9use {futures::Future, oak_lsp::service::LanguageService, oak_lsp::types::Hover as LspHover, oak_vfs::Vfs};
10#[cfg(feature = "lsp")]
11pub struct PurescriptLanguageService<V: Vfs> {
12 vfs: V,
13 workspace: oak_lsp::workspace::WorkspaceManager,
14}
15impl<V: Vfs> PurescriptLanguageService<V> {
16 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 PurescriptLanguageService<V> {
21 type Lang = PurescriptLanguage;
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<'_, PurescriptLanguage>>> + 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}