Skip to main content

query_definition

Function query_definition 

Source
pub fn query_definition(
    type_name: &str,
    method_name: &str,
    ra_path: &Path,
    deps: Option<&str>,
) -> Result<Option<Definition>>
Expand description

Queries rust-analyzer for the precise upstream source file declaration layout of a specific method.

Under the hood, this sets up a mock environment containing an isolated invocation of your method, queries textDocument/definition, and intercepts the target file location coordinates.

ยงErrors

Returns an error if the underlying LSP runtime breaks, or if rust-analyzer encounters structural errors. If a method exists but has no discoverable source code location definitions, it evaluates cleanly into Ok(None).