mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
fix: Recognize Self
as a proper keyword
This commit is contained in:
parent
8f504dc873
commit
c0d6471143
27 changed files with 98 additions and 49 deletions
|
@ -5,7 +5,11 @@ use std::{
|
|||
iter,
|
||||
};
|
||||
|
||||
use crate::{db::AstDatabase, hygiene::Hygiene, name::Name};
|
||||
use crate::{
|
||||
db::AstDatabase,
|
||||
hygiene::Hygiene,
|
||||
name::{known, Name},
|
||||
};
|
||||
use base_db::CrateId;
|
||||
use either::Either;
|
||||
use syntax::{ast, AstNode};
|
||||
|
@ -162,6 +166,15 @@ fn convert_path(
|
|||
}
|
||||
}
|
||||
}
|
||||
ast::PathSegmentKind::SelfTypeKw => {
|
||||
let mut res = prefix.unwrap_or_else(|| {
|
||||
ModPath::from_kind(
|
||||
segment.coloncolon_token().map_or(PathKind::Plain, |_| PathKind::Abs),
|
||||
)
|
||||
});
|
||||
res.segments.push(known::SELF_TYPE);
|
||||
res
|
||||
}
|
||||
ast::PathSegmentKind::CrateKw => {
|
||||
if prefix.is_some() {
|
||||
return None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue