pub struct Analysis { /* private fields */ }
Expand description
Analysis is a snapshot of a world state at a moment in time. It is the main
entry point for asking semantic information about the world. When the world
state is advanced using AnalysisHost::apply_change
method, all existing
Analysis
are canceled (most method return Err(Canceled)
).
Implementations
Debug info about the current state of the analysis.
pub fn prime_caches<F>(&self, cb: F) -> Cancellable<()> where
F: Fn(PrimeCachesProgress) + Sync + UnwindSafe,
Gets the text of the source file.
Gets the syntax tree of the file.
Returns true if this file belongs to an immutable library.
Gets the file’s LineIndex
: data structure to convert between absolute
offsets and line/column representation.
Selects the next syntactic nodes encompassing the range.
Returns position of the matching brace (all types of braces are supported).
pub fn syntax_tree(
&self,
file_id: FileId,
text_range: Option<TextRange>
) -> Cancellable<String>
pub fn syntax_tree(
&self,
file_id: FileId,
text_range: Option<TextRange>
) -> Cancellable<String>
Returns a syntax tree represented as String
, for debug purposes.
Renders the crate graph to GraphViz “dot” syntax.
pub fn join_lines(
&self,
config: &JoinLinesConfig,
frange: FileRange
) -> Cancellable<TextEdit>
pub fn join_lines(
&self,
config: &JoinLinesConfig,
frange: FileRange
) -> Cancellable<TextEdit>
Returns an edit to remove all newlines in the range, cleaning up minor stuff like trailing commas.
Returns an edit which should be applied when opening a new line, fixing
up minor stuff like continuing the comment.
The edit will be a snippet (with $0
).
pub fn on_char_typed(
&self,
position: FilePosition,
char_typed: char
) -> Cancellable<Option<SourceChange>>
pub fn on_char_typed(
&self,
position: FilePosition,
char_typed: char
) -> Cancellable<Option<SourceChange>>
Returns an edit which should be applied after a character was typed.
This is useful for some on-the-fly fixups, like adding ;
to let =
automatically.
Returns a tree representation of symbols in the file. Useful to draw a file outline.
pub fn inlay_hints(
&self,
config: &InlayHintsConfig,
file_id: FileId
) -> Cancellable<Vec<InlayHint>>
pub fn inlay_hints(
&self,
config: &InlayHintsConfig,
file_id: FileId
) -> Cancellable<Vec<InlayHint>>
Returns a list of the places in the file where type hints can be displayed.
Returns the set of folding ranges.
Fuzzy searches for a symbol.
pub fn goto_definition(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
pub fn goto_definition(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
Returns the definitions from the symbol at position
.
pub fn goto_declaration(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
pub fn goto_declaration(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
Returns the declaration from the symbol at position
.
pub fn goto_implementation(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
pub fn goto_implementation(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
Returns the impls from the symbol at position
.
pub fn goto_type_definition(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
pub fn goto_type_definition(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
Returns the type definitions for the symbol at position
.
pub fn find_all_refs(
&self,
position: FilePosition,
search_scope: Option<SearchScope>
) -> Cancellable<Option<Vec<ReferenceSearchResult>>>
pub fn find_all_refs(
&self,
position: FilePosition,
search_scope: Option<SearchScope>
) -> Cancellable<Option<Vec<ReferenceSearchResult>>>
Finds all usages of the reference at point.
Finds all methods and free functions for the file. Does not return tests!
pub fn hover(
&self,
config: &HoverConfig,
range: FileRange
) -> Cancellable<Option<RangeInfo<HoverResult>>>
pub fn hover(
&self,
config: &HoverConfig,
range: FileRange
) -> Cancellable<Option<RangeInfo<HoverResult>>>
Returns a short text describing element at position.
pub fn moniker(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<MonikerResult>>>>
pub fn moniker(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<MonikerResult>>>>
Returns moniker of symbol at position.
Return URL(s) for the documentation of the symbol under the cursor.
Computes parameter information for the given call expression.
pub fn call_hierarchy(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
pub fn call_hierarchy(
&self,
position: FilePosition
) -> Cancellable<Option<RangeInfo<Vec<NavigationTarget>>>>
Computes call hierarchy candidates for the given file position.
Computes incoming calls for the given file position.
Computes outgoing calls for the given file position.
Returns a mod name;
declaration which created the current module.
Returns crates this file belongs too.
Returns the edition of the given crate.
Returns the root file of the given crate.
Returns the set of possible targets to run for the current file.
Returns the set of tests for the given file position.
Computes syntax highlighting for the given file
Computes all ranges to highlight for a given item in a file.
Computes syntax highlighting for the given file range.
Computes syntax highlighting for the given file.
pub fn completions(
&self,
config: &CompletionConfig,
position: FilePosition
) -> Cancellable<Option<Vec<CompletionItem>>>
pub fn completions(
&self,
config: &CompletionConfig,
position: FilePosition
) -> Cancellable<Option<Vec<CompletionItem>>>
Computes completions at the given position.
pub fn resolve_completion_edits(
&self,
config: &CompletionConfig,
position: FilePosition,
imports: impl IntoIterator<Item = (String, String)> + UnwindSafe
) -> Cancellable<Vec<TextEdit>>
pub fn resolve_completion_edits(
&self,
config: &CompletionConfig,
position: FilePosition,
imports: impl IntoIterator<Item = (String, String)> + UnwindSafe
) -> Cancellable<Vec<TextEdit>>
Resolves additional completion data at the position given.
pub fn diagnostics(
&self,
config: &DiagnosticsConfig,
resolve: AssistResolveStrategy,
file_id: FileId
) -> Cancellable<Vec<Diagnostic>>
pub fn diagnostics(
&self,
config: &DiagnosticsConfig,
resolve: AssistResolveStrategy,
file_id: FileId
) -> Cancellable<Vec<Diagnostic>>
Computes the set of diagnostics for the given file.
pub fn assists_with_fixes(
&self,
assist_config: &AssistConfig,
diagnostics_config: &DiagnosticsConfig,
resolve: AssistResolveStrategy,
frange: FileRange
) -> Cancellable<Vec<Assist>>
pub fn assists_with_fixes(
&self,
assist_config: &AssistConfig,
diagnostics_config: &DiagnosticsConfig,
resolve: AssistResolveStrategy,
frange: FileRange
) -> Cancellable<Vec<Assist>>
Convenience function to return assists + quick fixes for diagnostics
pub fn rename(
&self,
position: FilePosition,
new_name: &str
) -> Cancellable<Result<SourceChange, RenameError>>
pub fn rename(
&self,
position: FilePosition,
new_name: &str
) -> Cancellable<Result<SourceChange, RenameError>>
Returns the edit required to rename reference at the position to the new name.
pub fn prepare_rename(
&self,
position: FilePosition
) -> Cancellable<Result<RangeInfo<()>, RenameError>>
pub fn will_rename_file(
&self,
file_id: FileId,
new_name_stem: &str
) -> Cancellable<Option<SourceChange>>
pub fn structural_search_replace(
&self,
query: &str,
parse_only: bool,
resolve_context: FilePosition,
selections: Vec<FileRange>
) -> Cancellable<Result<SourceChange, SsrError>>
pub fn annotations(
&self,
config: &AnnotationConfig,
file_id: FileId
) -> Cancellable<Vec<Annotation>>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Analysis
impl UnwindSafe for Analysis
Blanket Implementations
Mutably borrows from an owned value. Read more
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U
using CastTo
.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more