Skip to main content

Project

Struct Project 

Source
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

Source

pub fn effects_ready(&self) -> bool

Whether this generation already has an effect summary; performs no analysis.

Source§

impl Project

Source

pub fn quick_fixes( &self, source: SourceId, diagnostics: &[Diagnostic], ) -> Vec<CodeAction>

Source

pub fn extract_proc( &self, source: SourceId, range: Range<usize>, name: &str, ) -> Result<CodeAction, String>

Source§

impl Project

Source

pub fn document_colors(&self, source: SourceId) -> Vec<DocumentColor>

Source

pub fn color_presentation( &self, source: SourceId, range: Range<usize>, color: Color, ) -> Option<TextEdit>

Source§

impl Project

Source

pub fn script_effects(&self, source: SourceId) -> Vec<ScriptEffects>

Cached AST effects, with pointer requirements attached only when already checked.

Source

pub fn script_pointers(&self, source: SourceId) -> Vec<ScriptPointers>

Entry pointer requirements from the latest completed check. Stale or unavailable analysis produces no annotations.

Source

pub fn inlay_hints( &self, source: SourceId, range: Range<usize>, ) -> Vec<InlayHint>

Source§

impl Project

Source

pub fn hover(&self, source: SourceId, offset: usize) -> Option<Hover>

Source

pub fn definition(&self, source: SourceId, offset: usize) -> Option<Location>

Source

pub fn references( &self, source: SourceId, offset: usize, include_declaration: bool, ) -> Vec<Location>

Source

pub fn document_symbols(&self, source: SourceId) -> Vec<&Symbol>

Source

pub fn workspace_symbols(&self, query: &str, limit: usize) -> Vec<&Symbol>

Source

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.

Source

pub fn completions( &self, source: SourceId, offset: usize, limit: usize, ) -> Vec<Completion>

Bounded completion lists prevent copying entire cache registries on each keystroke.

Source

pub fn signature_help( &self, source: SourceId, offset: usize, ) -> Option<SignatureHelp>

Source

pub fn config_diagnostics(&self) -> DiagnosticsCollector

Config values that do not name what their key holds.

Source

pub fn semantic_tokens(&self, source: SourceId) -> Vec<SemanticToken>

Source

pub fn folding_ranges(&self, source: SourceId) -> Vec<Range<usize>>

Source

pub fn selection_ranges( &self, source: SourceId, offset: usize, ) -> Vec<Range<usize>>

Source

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.

Source

pub fn code_actions(&self, diagnostics: &[Diagnostic]) -> Vec<CodeAction>

Source

pub fn render_diagnostic(&self, diagnostic: &Diagnostic) -> String

Verbose source excerpts from the current buffer, including unsaved edits.

Source§

impl Project

Source

pub fn new(target: Target, registry: SymbolRegistry, options: Options) -> Self

Source

pub fn registry(&self) -> &SymbolRegistry

Source

pub fn set_cancellation(&mut self, token: CancellationToken)

Source

pub fn documents(&self) -> impl Iterator<Item = &Document>

Source

pub fn document(&self, id: SourceId) -> Option<&Document>

Source

pub fn set_registry(&mut self, registry: SymbolRegistry)

Replace the environment after config or command definitions change.

Source

pub fn open( &mut self, label: impl Into<PathBuf>, scope: Scope, version: i64, text: impl Into<Arc<str>>, ) -> SourceId

Source

pub fn open_config( &mut self, label: impl Into<PathBuf>, scope: Scope, version: i64, text: impl Into<Arc<str>>, kind: impl Into<String>, ) -> SourceId

Source

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.

Source

pub fn close(&mut self, id: SourceId) -> bool

Source

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.

Source

pub fn analyze(&mut self) -> Analysis

Source

pub fn compile(&mut self) -> Compilation

Source

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.

Source

pub fn check(&mut self) -> Analysis

Source

pub fn source_text(&self, label: &Path) -> Option<&str>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more