Fix incorrect symbol definitions in SCIP output

This commit is contained in:
David Richey 2024-08-28 14:49:53 -05:00
parent 248a55723b
commit c2c1bd0c13

View File

@ -142,7 +142,9 @@ pub fn run(self) -> anyhow::Result<()> {
let mut symbol_roles = Default::default(); let mut symbol_roles = Default::default();
if let Some(def) = token.definition { if let Some(def) = token.definition {
if def.range == text_range { // if the the range of the def and the range of the token are the same, this must be the definition.
// they also must be in the same file. See https://github.com/rust-lang/rust-analyzer/pull/17988
if def.file_id == file_id && def.range == text_range {
symbol_roles |= scip_types::SymbolRole::Definition as i32; symbol_roles |= scip_types::SymbolRole::Definition as i32;
} }