1#![doc = include_str!("readme.md")]
2#[cfg(feature = "oak-highlight")]
3pub mod highlighter;
4
5#[cfg(feature = "lsp")]
6use {oak_lsp::LanguageService, oak_vfs::MemoryVfs, std::future::Future};
7#[cfg(feature = "oak-pretty-print")]
8pub mod formatter;
9use crate::language::GoLanguage;
11use oak_core::tree::RedNode;
12#[cfg(feature = "lsp")]
14pub struct GoLanguageService {
15 vfs: MemoryVfs,
16 workspace: oak_lsp::workspace::WorkspaceManager,
17}
18#[cfg(feature = "lsp")]
19impl GoLanguageService {
20 pub fn new(vfs: MemoryVfs) -> Self {
22 Self { vfs, workspace: oak_lsp::workspace::WorkspaceManager::default() }
23 }
24}
25#[cfg(feature = "lsp")]
26impl LanguageService for GoLanguageService {
27 type Lang = GoLanguage;
28 type Vfs = MemoryVfs;
29 fn vfs(&self) -> &Self::Vfs {
30 &self.vfs
31 }
32 fn workspace(&self) -> &oak_lsp::workspace::WorkspaceManager {
33 &self.workspace
34 }
35 fn get_root(&self, _uri: &str) -> impl Future<Output = Option<RedNode<'_, Self::Lang>>> + Send + '_ {
36 async { None }
37 }
38}