11630: fix: Recognize `Self` as a proper keyword r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11627

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2022-03-05 23:48:54 +00:00 committed by GitHub
commit 96c11f5fd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 226 additions and 74 deletions

View file

@ -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,12 @@ fn convert_path(
}
}
}
ast::PathSegmentKind::SelfTypeKw => {
if prefix.is_some() {
return None;
}
ModPath::from_segments(PathKind::Plain, Some(known::SELF_TYPE))
}
ast::PathSegmentKind::CrateKw => {
if prefix.is_some() {
return None;