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:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user