mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Merge #2795
2795: Use dummy value for macro file in bulitin macros r=matklad a=edwin0cheng This PR skip the actual line and column computation for `MacroFile` and return a dummy value instead. Related to #2794 Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
commit
7c1af25b22
1 changed files with 10 additions and 2 deletions
|
@ -62,8 +62,13 @@ register_builtin! {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_line_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize {
|
fn to_line_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize {
|
||||||
// FIXME: Use expansion info
|
|
||||||
let file_id = file.original_file(db);
|
let file_id = file.original_file(db);
|
||||||
|
|
||||||
|
// FIXME: if the file is coming from macro, we return a dummy value for now.
|
||||||
|
if file.call_node(db).map(|it| it.file_id != file_id.into()).unwrap_or(true) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
let text = db.file_text(file_id);
|
let text = db.file_text(file_id);
|
||||||
let mut line_num = 1;
|
let mut line_num = 1;
|
||||||
|
|
||||||
|
@ -150,8 +155,11 @@ fn option_env_expand(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_col_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize {
|
fn to_col_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize {
|
||||||
// FIXME: Use expansion info
|
|
||||||
let file_id = file.original_file(db);
|
let file_id = file.original_file(db);
|
||||||
|
// FIXME: if the file is coming from macro, we return a dummy value for now.
|
||||||
|
if file.call_node(db).map(|it| it.file_id != file_id.into()).unwrap_or(true) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
let text = db.file_text(file_id);
|
let text = db.file_text(file_id);
|
||||||
|
|
||||||
let pos = pos.to_usize();
|
let pos = pos.to_usize();
|
||||||
|
|
Loading…
Reference in a new issue