Encode edition within FileId in the hir layer

This commit is contained in:
Lukas Wirth 2024-07-17 17:35:40 +02:00
parent 92268627a8
commit 5264f86242
160 changed files with 1117 additions and 824 deletions

View file

@ -1,7 +1,7 @@
use hir::{DescendPreference, InFile, MacroFileIdExt, Semantics};
use ide_db::{
base_db::FileId, helpers::pick_best_token,
syntax_helpers::insert_whitespace_into_node::insert_ws_into, RootDatabase,
helpers::pick_best_token, syntax_helpers::insert_whitespace_into_node::insert_ws_into, FileId,
RootDatabase,
};
use syntax::{ast, ted, AstNode, NodeOrToken, SyntaxKind, SyntaxNode, T};
@ -25,7 +25,7 @@ pub struct ExpandedMacro {
// image::https://user-images.githubusercontent.com/48062697/113020648-b3973180-917a-11eb-84a9-ecb921293dc5.gif[]
pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<ExpandedMacro> {
let sema = Semantics::new(db);
let file = sema.parse(position.file_id);
let file = sema.parse_guess_edition(position.file_id);
let tok = pick_best_token(file.syntax().token_at_offset(position.offset), |kind| match kind {
SyntaxKind::IDENT => 1,