1#![doc = include_str!("readme.md")]
2#[cfg(feature = "oak-highlight")]
3pub mod highlighter;
4
5#[cfg(feature = "lsp")]
6use {
7 oak_lsp::{service::LanguageService, workspace::WorkspaceManager},
8 oak_vfs::MemoryVfs,
9};
10#[cfg(feature = "oak-pretty-print")]
11pub mod formatter;
12use crate::language::TypstLanguage;
13#[cfg(feature = "lsp")]
15pub struct TypstLanguageService {
16 vfs: MemoryVfs,
17 workspace: WorkspaceManager,
18}
19#[cfg(feature = "lsp")]
20impl TypstLanguageService {
21 pub fn new(vfs: MemoryVfs) -> Self {
22 Self { vfs, workspace: WorkspaceManager::default() }
23 }
24}
25#[cfg(feature = "lsp")]
26impl LanguageService for TypstLanguageService {
27 type Lang = TypstLanguage;
28 type Vfs = MemoryVfs;
29 fn vfs(&self) -> &MemoryVfs {
30 &self.vfs
31 }
32 fn workspace(&self) -> &WorkspaceManager {
33 &self.workspace
34 }
35}