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
Sourcepub fn effects_ready(&self) -> bool
pub fn effects_ready(&self) -> bool
Whether this generation already has an effect summary; performs no analysis.
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 document_colors(&self, source: SourceId) -> Vec<DocumentColor>
pub fn color_presentation( &self, source: SourceId, range: Range<usize>, color: Color, ) -> Option<TextEdit>
Source§impl Project
impl Project
Sourcepub fn script_effects(&self, source: SourceId) -> Vec<ScriptEffects>
pub fn script_effects(&self, source: SourceId) -> Vec<ScriptEffects>
Cached AST effects, with pointer requirements attached only when already checked.
Sourcepub fn script_pointers(&self, source: SourceId) -> Vec<ScriptPointers>
pub fn script_pointers(&self, source: SourceId) -> Vec<ScriptPointers>
Entry pointer requirements from the latest completed check. Stale or
unavailable analysis produces no annotations.
pub fn inlay_hints( &self, source: SourceId, range: Range<usize>, ) -> Vec<InlayHint>
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.
pub fn close(&mut self, id: SourceId) -> bool
Sourcepub fn open_all(&mut self, sources: Vec<SourceText>) -> Vec<SourceId>
pub fn open_all(&mut self, sources: Vec<SourceText>) -> Vec<SourceId>
Open many sources at once, lexing and parsing them in parallel. IDs are
assigned in input order, as open would.
pub fn analyze(&mut self) -> Analysis
pub fn compile(&mut self) -> Compilation
Sourcepub fn latest(&mut self) -> Analysis
pub fn latest(&mut self) -> Analysis
The fullest diagnostics on hand without more work: analyze, with what
the last check added for each document that has not changed since.