Skip to main content

oak_tailwind/lsp/
mod.rs

1use crate::language::TailwindLanguage;
2use oak_lsp::LanguageService;
3use oak_vfs::MemoryVfs;
4
5/// Tailwind 语言服务
6pub struct TailwindLanguageService {
7    vfs: MemoryVfs,
8    workspace: oak_lsp::workspace::WorkspaceManager,
9}
10
11impl TailwindLanguageService {
12    /// 创建新的语言服务
13    pub fn new(vfs: MemoryVfs) -> Self {
14        Self { vfs, workspace: oak_lsp::workspace::WorkspaceManager::default() }
15    }
16}
17
18impl LanguageService for TailwindLanguageService {
19    type Lang = TailwindLanguage;
20    type Vfs = MemoryVfs;
21
22    fn vfs(&self) -> &Self::Vfs {
23        &self.vfs
24    }
25
26    fn workspace(&self) -> &oak_lsp::workspace::WorkspaceManager {
27        &self.workspace
28    }
29
30    fn get_root(&self, _uri: &str) -> impl std::future::Future<Output = Option<oak_core::tree::RedNode<'_, TailwindLanguage>>> + Send + '_ {
31        async move { None }
32    }
33}