-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Add completion for raw identifiers #10152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
It might be worth renaming |
matklad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
LGTM as is!
@lnicola could you expand on this? I don't quite understand what do you mean here :) |
|
This method here doesn't have a great name and there's a bit of duplication between this PR and |
|
Ah... The method has the right name I think -- it is supposed to be used as And yeah, ideally we should move |
|
@lnicola I considered not duplicating and instead, creating a public helper function such as pub fn raw_ident_verify(ident: &str) -> bool {
let is_keyword = parser::SyntaxKind::from_keyword(ident).is_some();
is_keyword && !matches!(ident, "self" | "crate" | "super" | "Self")
}which is used by both |
|
The function name (heh) is fine, but it returns a module declaration. |
pub fn name(text: &str) -> ast::Name {it returns |
|
Ooh, right 🤦. It parses a module declaration but returns only the name. Don't mind me. |
Adds support for valid Rust completion of raw identifiers.
Previously, code completion of fields made via raw identifiers would not re-insert those raw identifiers, resulting in invalid Rust code. Now, code completion of fields made via raw identifiers do re-insert those raw identifiers, resulting in valid Rust code.
The same is true for all code completion instances for fields and compatible Rust identifiers.