pub struct Project { /* private fields */ }Expand description
Retains parsed documents between edits and reuses the supplied config and command registry. Source names are opaque: URI, database key, or filename.
Implementations§
Source§impl Project
impl Project
pub fn quick_fixes( &self, source: SourceId, diagnostics: &[Diagnostic], ) -> Vec<CodeAction>
pub fn extract_proc( &self, source: SourceId, range: Range<usize>, name: &str, ) -> Result<CodeAction, String>
Source§impl Project
impl Project
pub fn hover(&self, source: SourceId, offset: usize) -> Option<Hover>
pub fn definition(&self, source: SourceId, offset: usize) -> Option<Location>
pub fn references( &self, source: SourceId, offset: usize, include_declaration: bool, ) -> Vec<Location>
pub fn document_symbols(&self, source: SourceId) -> Vec<&Symbol>
pub fn workspace_symbols(&self, query: &str, limit: usize) -> Vec<&Symbol>
Sourcepub fn rename(
&self,
source: SourceId,
offset: usize,
name: &str,
) -> Result<Vec<TextEdit>, String>
pub fn rename( &self, source: SourceId, offset: usize, name: &str, ) -> Result<Vec<TextEdit>, String>
Rename only source-owned definitions. External config and engine symbols require their host’s editing support, so an incomplete edit is rejected.
Sourcepub fn completions(
&self,
source: SourceId,
offset: usize,
limit: usize,
) -> Vec<Completion>
pub fn completions( &self, source: SourceId, offset: usize, limit: usize, ) -> Vec<Completion>
Bounded completion lists prevent copying entire cache registries on each keystroke.
pub fn signature_help( &self, source: SourceId, offset: usize, ) -> Option<SignatureHelp>
Sourcepub fn config_diagnostics(&self) -> DiagnosticsCollector
pub fn config_diagnostics(&self) -> DiagnosticsCollector
Config values that do not name what their key holds.
pub fn semantic_tokens(&self, source: SourceId) -> Vec<SemanticToken>
pub fn folding_ranges(&self, source: SourceId) -> Vec<Range<usize>>
pub fn selection_ranges( &self, source: SourceId, offset: usize, ) -> Vec<Range<usize>>
Sourcepub fn format(
&self,
source: SourceId,
tab_size: usize,
spaces: bool,
) -> Vec<TextEdit>
pub fn format( &self, source: SourceId, tab_size: usize, spaces: bool, ) -> Vec<TextEdit>
Reindent without rewriting expressions, literals or comments. Each edit is confined to whitespace outside string tokens.
pub fn code_actions(&self, diagnostics: &[Diagnostic]) -> Vec<CodeAction>
Sourcepub fn render_diagnostic(&self, diagnostic: &Diagnostic) -> String
pub fn render_diagnostic(&self, diagnostic: &Diagnostic) -> String
Verbose source excerpts from the current buffer, including unsaved edits.
Source§impl Project
impl Project
pub fn new(target: Target, registry: SymbolRegistry, options: Options) -> Self
pub fn registry(&self) -> &SymbolRegistry
pub fn set_cancellation(&mut self, token: CancellationToken)
pub fn documents(&self) -> impl Iterator<Item = &Document>
pub fn document(&self, id: SourceId) -> Option<&Document>
Sourcepub fn set_registry(&mut self, registry: SymbolRegistry)
pub fn set_registry(&mut self, registry: SymbolRegistry)
Replace the environment after config or command definitions change.
pub fn open( &mut self, label: impl Into<PathBuf>, scope: Scope, version: i64, text: impl Into<Arc<str>>, ) -> SourceId
pub fn open_config( &mut self, label: impl Into<PathBuf>, scope: Scope, version: i64, text: impl Into<Arc<str>>, kind: impl Into<String>, ) -> SourceId
Sourcepub fn update(
&mut self,
id: SourceId,
version: i64,
text: impl Into<Arc<str>>,
) -> Result<(), &'static str>
pub fn update( &mut self, id: SourceId, version: i64, text: impl Into<Arc<str>>, ) -> Result<(), &'static str>
Reject stale editor updates. Unchanged text reuses its existing syntax.