aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/builtin_macro.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src/builtin_macro.rs')
-rw-r--r--crates/ra_hir_expand/src/builtin_macro.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs
index 2c119269c..e9e275670 100644
--- a/crates/ra_hir_expand/src/builtin_macro.rs
+++ b/crates/ra_hir_expand/src/builtin_macro.rs
@@ -62,8 +62,13 @@ register_builtin! {
62} 62}
63 63
64fn to_line_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize { 64fn to_line_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize {
65 // FIXME: Use expansion info
66 let file_id = file.original_file(db); 65 let file_id = file.original_file(db);
66
67 // FIXME: if the file is coming from macro, we return a dummy value for now.
68 if file.call_node(db).map(|it| it.file_id != file_id.into()).unwrap_or(true) {
69 return 0;
70 }
71
67 let text = db.file_text(file_id); 72 let text = db.file_text(file_id);
68 let mut line_num = 1; 73 let mut line_num = 1;
69 74
@@ -150,8 +155,11 @@ fn option_env_expand(
150} 155}
151 156
152fn to_col_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize { 157fn to_col_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize {
153 // FIXME: Use expansion info
154 let file_id = file.original_file(db); 158 let file_id = file.original_file(db);
159 // FIXME: if the file is coming from macro, we return a dummy value for now.
160 if file.call_node(db).map(|it| it.file_id != file_id.into()).unwrap_or(true) {
161 return 0;
162 }
155 let text = db.file_text(file_id); 163 let text = db.file_text(file_id);
156 164
157 let pos = pos.to_usize(); 165 let pos = pos.to_usize();