mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
the offset used for the completion cursor should always be relative to the original file and not to the marco file
This commit is contained in:
parent
fbf8e12234
commit
6df969f5f4
3 changed files with 15 additions and 3 deletions
|
@ -67,7 +67,10 @@ impl SourceAnalyzer {
|
|||
let scopes = db.expr_scopes(def);
|
||||
let scope = match offset {
|
||||
None => scope_for(&scopes, &source_map, node),
|
||||
Some(offset) => scope_for_offset(db, &scopes, &source_map, node.with_value(offset)),
|
||||
Some(offset) => {
|
||||
let file_id = node.file_id.original_file(db.upcast());
|
||||
scope_for_offset(db, &scopes, &source_map, InFile::new(file_id.into(), offset))
|
||||
}
|
||||
};
|
||||
let resolver = resolver_for_scope(db.upcast(), def, scope);
|
||||
SourceAnalyzer {
|
||||
|
@ -88,7 +91,10 @@ impl SourceAnalyzer {
|
|||
let scopes = db.expr_scopes(def);
|
||||
let scope = match offset {
|
||||
None => scope_for(&scopes, &source_map, node),
|
||||
Some(offset) => scope_for_offset(db, &scopes, &source_map, node.with_value(offset)),
|
||||
Some(offset) => {
|
||||
let file_id = node.file_id.original_file(db.upcast());
|
||||
scope_for_offset(db, &scopes, &source_map, InFile::new(file_id.into(), offset))
|
||||
}
|
||||
};
|
||||
let resolver = resolver_for_scope(db.upcast(), def, scope);
|
||||
SourceAnalyzer { resolver, def: Some((def, body, source_map)), infer: None, file_id }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue