-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix ide-assists raw_string suffix fail #19622
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
let range = token.syntax().text_range(); | ||
let suffix = string_suffix(token.text()).unwrap_or_default(); | ||
let range = TextRange::new(range.start(), range.end() - TextSize::of(suffix)); |
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.
Can we add this stuff as a method on IsString
? text_range_with_quotes
or something like that
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.
Actually instead of string_suffix
we can make use of the IsString::quote_offsets
function here
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.
What about char? Is there anything similar
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.
No there isn't, we should probably implement IsString
for Char
as well though (and then consider renaming the trait). I guess the RAW_PREFIX stuff doesn't make sense on it but that's not too much of an issue
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.
It seems that IsString::quote_offsets
is not just extracting suffixes, but extracting quotation marks, which can be difficult to handle for #
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.
string_suffix(r###"r##"x"##i32"###)
-> "i32"
QuoteOffsets::new(r###"r##"x"##i32"###)
-> range "r##\""
, range "\"##i32"
, and range "x"
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.
Ah okay, well 'lets merge as is then
Thanks! |
Fixes #19621
Fixes #19625