pub trait LanguageService: Send + Sync {
type Lang: Language;
type Vfs: WritableVfs;
Show 31 methods
// Required methods
fn vfs(&self) -> &Self::Vfs;
fn workspace(&self) -> &WorkspaceManager;
// Provided methods
fn get_source(&self, uri: &str) -> Option<<Self::Vfs as Vfs>::Source> { ... }
fn get_root(
&self,
_uri: &str,
) -> impl Future<Output = Option<RedNode<'_, Self::Lang>>> + Send { ... }
fn with_root<'a, R, F>(
&'a self,
uri: &'a str,
f: F,
) -> impl Future<Output = Option<R>> + Send + 'a
where R: Send,
F: FnOnce(RedNode<'a, Self::Lang>) -> R + Send + 'a { ... }
fn with_roots<'a, R, F>(
&'a self,
uris: Vec<String>,
f: F,
) -> impl Future<Output = Vec<R>> + Send + 'a
where R: Send + 'static,
F: Fn(RedNode<'a, Self::Lang>) -> R + Send + Sync + 'a { ... }
fn hover(
&self,
_uri: &str,
_range: Range<usize>,
) -> impl Future<Output = Option<Hover>> + Send { ... }
fn folding_ranges(
&self,
_uri: &str,
) -> impl Future<Output = Vec<FoldingRange>> + Send { ... }
fn document_symbols<'a>(
&'a self,
uri: &'a str,
) -> impl Future<Output = Vec<StructureItem>> + Send + 'a { ... }
fn workspace_symbols<'a>(
&'a self,
query: String,
) -> impl Future<Output = Vec<WorkspaceSymbol>> + Send + 'a { ... }
fn list_all_files(
&self,
root_uri: &str,
) -> impl Future<Output = Vec<String>> + Send { ... }
fn definition<'a>(
&'a self,
uri: &'a str,
range: Range<usize>,
) -> impl Future<Output = Vec<LocationRange>> + Send + 'a { ... }
fn references<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<LocationRange>> + Send + 'a { ... }
fn type_definition<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<LocationRange>> + Send + 'a { ... }
fn implementation<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<LocationRange>> + Send + 'a { ... }
fn document_highlights<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<DocumentHighlight>> + Send + 'a { ... }
fn rename<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
_new_name: String,
) -> impl Future<Output = Option<WorkspaceEdit>> + Send + 'a { ... }
fn completion<'a>(
&'a self,
_uri: &'a str,
_position: usize,
) -> impl Future<Output = Vec<CompletionItem>> + Send + 'a { ... }
fn diagnostics<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = Vec<Diagnostic>> + Send + 'a { ... }
fn semantic_tokens<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = Option<SemanticTokens>> + Send + 'a { ... }
fn semantic_tokens_range<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Option<SemanticTokens>> + Send + 'a { ... }
fn selection_ranges<'a>(
&'a self,
_uri: &'a str,
_ranges: Vec<usize>,
) -> impl Future<Output = Vec<SelectionRange>> + Send + 'a { ... }
fn signature_help<'a>(
&'a self,
_uri: &'a str,
_position: usize,
) -> impl Future<Output = Option<SignatureHelp>> + Send + 'a { ... }
fn inlay_hints<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = Vec<InlayHint>> + Send + 'a { ... }
fn formatting<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = Vec<TextEdit>> + Send + 'a { ... }
fn code_actions<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<CodeAction>> + Send + 'a { ... }
fn initialize<'a>(
&'a self,
_params: InitializeParams,
) -> impl Future<Output = ()> + Send + 'a { ... }
fn initialized<'a>(&'a self) -> impl Future<Output = ()> + Send + 'a { ... }
fn shutdown<'a>(&'a self) -> impl Future<Output = ()> + Send + 'a { ... }
fn did_save<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = ()> + Send + 'a { ... }
fn did_close<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = ()> + Send + 'a { ... }
}Required Associated Types§
Required Methods§
Sourcefn workspace(&self) -> &WorkspaceManager
fn workspace(&self) -> &WorkspaceManager
Get the workspace manager.
Provided Methods§
Sourcefn get_source(&self, uri: &str) -> Option<<Self::Vfs as Vfs>::Source>
fn get_source(&self, uri: &str) -> Option<<Self::Vfs as Vfs>::Source>
Helper to get source from VFS.
Sourcefn get_root(
&self,
_uri: &str,
) -> impl Future<Output = Option<RedNode<'_, Self::Lang>>> + Send
fn get_root( &self, _uri: &str, ) -> impl Future<Output = Option<RedNode<'_, Self::Lang>>> + Send
Helper to get the root red node of a file. Implementations should override this to provide actual parsing/caching.
Sourcefn with_root<'a, R, F>(
&'a self,
uri: &'a str,
f: F,
) -> impl Future<Output = Option<R>> + Send + 'a
fn with_root<'a, R, F>( &'a self, uri: &'a str, f: F, ) -> impl Future<Output = Option<R>> + Send + 'a
Helper to run logic with the root node.
Sourcefn with_roots<'a, R, F>(
&'a self,
uris: Vec<String>,
f: F,
) -> impl Future<Output = Vec<R>> + Send + 'a
fn with_roots<'a, R, F>( &'a self, uris: Vec<String>, f: F, ) -> impl Future<Output = Vec<R>> + Send + 'a
Helper to run logic with multiple root nodes in parallel.
Sourcefn hover(
&self,
_uri: &str,
_range: Range<usize>,
) -> impl Future<Output = Option<Hover>> + Send
fn hover( &self, _uri: &str, _range: Range<usize>, ) -> impl Future<Output = Option<Hover>> + Send
Provide hover information. Defaults to None.
Sourcefn folding_ranges(
&self,
_uri: &str,
) -> impl Future<Output = Vec<FoldingRange>> + Send
fn folding_ranges( &self, _uri: &str, ) -> impl Future<Output = Vec<FoldingRange>> + Send
Provide folding ranges. Defaults to empty.
Sourcefn document_symbols<'a>(
&'a self,
uri: &'a str,
) -> impl Future<Output = Vec<StructureItem>> + Send + 'a
fn document_symbols<'a>( &'a self, uri: &'a str, ) -> impl Future<Output = Vec<StructureItem>> + Send + 'a
Provide document symbols. Defaults to empty.
Sourcefn workspace_symbols<'a>(
&'a self,
query: String,
) -> impl Future<Output = Vec<WorkspaceSymbol>> + Send + 'a
fn workspace_symbols<'a>( &'a self, query: String, ) -> impl Future<Output = Vec<WorkspaceSymbol>> + Send + 'a
Provide workspace symbols.
Sourcefn list_all_files(
&self,
root_uri: &str,
) -> impl Future<Output = Vec<String>> + Send
fn list_all_files( &self, root_uri: &str, ) -> impl Future<Output = Vec<String>> + Send
Helper to list all files recursively.
Sourcefn definition<'a>(
&'a self,
uri: &'a str,
range: Range<usize>,
) -> impl Future<Output = Vec<LocationRange>> + Send + 'a
fn definition<'a>( &'a self, uri: &'a str, range: Range<usize>, ) -> impl Future<Output = Vec<LocationRange>> + Send + 'a
Find definition. Defaults to empty.
Sourcefn references<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<LocationRange>> + Send + 'a
fn references<'a>( &'a self, _uri: &'a str, _range: Range<usize>, ) -> impl Future<Output = Vec<LocationRange>> + Send + 'a
Find references. Defaults to empty.
Sourcefn type_definition<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<LocationRange>> + Send + 'a
fn type_definition<'a>( &'a self, _uri: &'a str, _range: Range<usize>, ) -> impl Future<Output = Vec<LocationRange>> + Send + 'a
Find type definition. Defaults to empty.
Sourcefn implementation<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<LocationRange>> + Send + 'a
fn implementation<'a>( &'a self, _uri: &'a str, _range: Range<usize>, ) -> impl Future<Output = Vec<LocationRange>> + Send + 'a
Find implementation. Defaults to empty.
Sourcefn document_highlights<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<DocumentHighlight>> + Send + 'a
fn document_highlights<'a>( &'a self, _uri: &'a str, _range: Range<usize>, ) -> impl Future<Output = Vec<DocumentHighlight>> + Send + 'a
Provide document highlights. Defaults to empty.
Sourcefn rename<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
_new_name: String,
) -> impl Future<Output = Option<WorkspaceEdit>> + Send + 'a
fn rename<'a>( &'a self, _uri: &'a str, _range: Range<usize>, _new_name: String, ) -> impl Future<Output = Option<WorkspaceEdit>> + Send + 'a
Rename a symbol.
Sourcefn completion<'a>(
&'a self,
_uri: &'a str,
_position: usize,
) -> impl Future<Output = Vec<CompletionItem>> + Send + 'a
fn completion<'a>( &'a self, _uri: &'a str, _position: usize, ) -> impl Future<Output = Vec<CompletionItem>> + Send + 'a
Provide completion items. Defaults to empty.
Sourcefn diagnostics<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = Vec<Diagnostic>> + Send + 'a
fn diagnostics<'a>( &'a self, _uri: &'a str, ) -> impl Future<Output = Vec<Diagnostic>> + Send + 'a
Provide diagnostics for a file. Defaults to empty.
Sourcefn semantic_tokens<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = Option<SemanticTokens>> + Send + 'a
fn semantic_tokens<'a>( &'a self, _uri: &'a str, ) -> impl Future<Output = Option<SemanticTokens>> + Send + 'a
Provide semantic tokens for a file. Defaults to None.
Sourcefn semantic_tokens_range<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Option<SemanticTokens>> + Send + 'a
fn semantic_tokens_range<'a>( &'a self, _uri: &'a str, _range: Range<usize>, ) -> impl Future<Output = Option<SemanticTokens>> + Send + 'a
Provide semantic tokens for a range. Defaults to None.
Sourcefn selection_ranges<'a>(
&'a self,
_uri: &'a str,
_ranges: Vec<usize>,
) -> impl Future<Output = Vec<SelectionRange>> + Send + 'a
fn selection_ranges<'a>( &'a self, _uri: &'a str, _ranges: Vec<usize>, ) -> impl Future<Output = Vec<SelectionRange>> + Send + 'a
Provide selection ranges for a file. Defaults to empty.
Sourcefn signature_help<'a>(
&'a self,
_uri: &'a str,
_position: usize,
) -> impl Future<Output = Option<SignatureHelp>> + Send + 'a
fn signature_help<'a>( &'a self, _uri: &'a str, _position: usize, ) -> impl Future<Output = Option<SignatureHelp>> + Send + 'a
Provide signature help at a position. Defaults to None.
Sourcefn inlay_hints<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = Vec<InlayHint>> + Send + 'a
fn inlay_hints<'a>( &'a self, _uri: &'a str, ) -> impl Future<Output = Vec<InlayHint>> + Send + 'a
Provide inlay hints for a file. Defaults to empty.
Sourcefn formatting<'a>(
&'a self,
_uri: &'a str,
) -> impl Future<Output = Vec<TextEdit>> + Send + 'a
fn formatting<'a>( &'a self, _uri: &'a str, ) -> impl Future<Output = Vec<TextEdit>> + Send + 'a
Provide document formatting. Defaults to empty.
Sourcefn code_actions<'a>(
&'a self,
_uri: &'a str,
_range: Range<usize>,
) -> impl Future<Output = Vec<CodeAction>> + Send + 'a
fn code_actions<'a>( &'a self, _uri: &'a str, _range: Range<usize>, ) -> impl Future<Output = Vec<CodeAction>> + Send + 'a
Provide code actions for a file. Defaults to empty.
Sourcefn initialize<'a>(
&'a self,
_params: InitializeParams,
) -> impl Future<Output = ()> + Send + 'a
fn initialize<'a>( &'a self, _params: InitializeParams, ) -> impl Future<Output = ()> + Send + 'a
Called when the language server is initialized.
Sourcefn initialized<'a>(&'a self) -> impl Future<Output = ()> + Send + 'a
fn initialized<'a>(&'a self) -> impl Future<Output = ()> + Send + 'a
Called when the language server is initialized (notification).
Sourcefn shutdown<'a>(&'a self) -> impl Future<Output = ()> + Send + 'a
fn shutdown<'a>(&'a self) -> impl Future<Output = ()> + Send + 'a
Called when the language server is shut down.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.