Skip to main content

Analysis

Struct Analysis 

Source
pub struct Analysis { /* private fields */ }
Expand description

An immutable snapshot of the world — a cloned salsa handle. Every query is Cancellable: a concurrent apply_change cancels in-flight reads, which the client re-issues against the fresh snapshot.

Implementations§

Source§

impl Analysis

Source

pub fn syntax_tree(&self, file: FileId) -> Cancellable<Option<String>>

A pretty-printed dump of the syntax tree (debugging / playground).

§Errors

Err(Cancelled) if a concurrent apply_change invalidated this snapshot.

Source

pub fn diagnostics(&self, file: FileId) -> Cancellable<Vec<Diagnostic>>

Parse-error diagnostics ∪ the Phase-2 §5 type diagnostics.

§Errors

See Analysis::syntax_tree.

Source

pub fn document_symbols(&self, file: FileId) -> Cancellable<Vec<DocumentSymbol>>

The document outline (classes, funcs, vars, consts, enums, signals, members).

§Errors

See Analysis::syntax_tree.

Source

pub fn semantic_tokens(&self, file: FileId) -> Cancellable<Vec<SemanticToken>>

Semantic-highlighting tokens: each meaningful token classified by its contextual role (declarations, types, parameters, members, calls, literals, comments) — richer than a grammar. In source order.

§Errors

See Analysis::syntax_tree.

Source

pub fn folding_ranges(&self, file: FileId) -> Cancellable<Vec<FoldRange>>

Foldable ranges (blocks, #region pairs, multi-line brackets).

§Errors

See Analysis::syntax_tree.

Source

pub fn completions(&self, pos: FilePosition) -> Cancellable<Vec<CompletionItem>>

Completions. After receiver. it offers the inferred member set; otherwise (or when the receiver is Variant/Unknown) it falls back to the Tier-0 by-name completion (keywords, annotations after @, document-local symbols) so it never regresses.

§Errors

See Analysis::syntax_tree.

Source

pub fn hover(&self, pos: FilePosition) -> Cancellable<Option<HoverResult>>

Hover: the inferred type of the expression / binding under the cursor (Unknown elided). None when there is nothing typed there.

§Errors

See Analysis::syntax_tree.

Source

pub fn inlay_hints(&self, file: FileId) -> Cancellable<Vec<InlayHint>>

Inlay : T hints on := declarations + unannotated params / for-vars (suppressed when the type is Variant/Unknown).

§Errors

See Analysis::syntax_tree.

Source

pub fn signature_help( &self, pos: FilePosition, ) -> Cancellable<Option<SignatureHelp>>

Signature help at a call site (active parameter by top-level comma count).

§Errors

See Analysis::syntax_tree.

Source

pub fn code_actions(&self, pos: FilePosition) -> Cancellable<Vec<CodeAction>>

Code actions at a position (currently “add type annotation”).

§Errors

See Analysis::syntax_tree.

Source

pub fn goto_definition(&self, pos: FilePosition) -> Cancellable<Vec<NavTarget>>

Go-to-definition: the declaration target(s) of the symbol under the cursor (cross-file).

§Errors

See Analysis::syntax_tree.

Source

pub fn find_references(&self, pos: FilePosition) -> Cancellable<Vec<Reference>>

Find every reference to the symbol under the cursor, project-wide (incl. its declaration).

§Errors

See Analysis::syntax_tree.

Source

pub fn rename( &self, pos: FilePosition, new_name: &str, ) -> Cancellable<Result<SourceChange, RenameError>>

Rename the symbol under the cursor to new_name — a cross-file edit, or a refusal (RenameError); never a partial edit.

§Errors

Err(Cancelled) if a concurrent apply_change invalidated this snapshot. The rename’s own refusal is the Result inside the Cancellable.

Source

pub fn workspace_symbols(&self, query: &str) -> Cancellable<Vec<NavTarget>>

Project-wide symbols matching query (fuzzy-ranked class names + members).

§Errors

See Analysis::syntax_tree.

Trait Implementations§

Source§

impl Clone for Analysis

Source§

fn clone(&self) -> Analysis

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Analysis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T> Lookup<T> for T

Source§

fn into_owned(self) -> T

Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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