-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Raw string assists #1730
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
Comments
-make usual string: r"hello" -> r"hello"
+make usual string: r"hello" -> "hello" |
Maybe add two variants of the first assist. One which doesn't unescape and one which does. You may have the invalid |
The unescaping one is better as a quick fix for lexer error, and not as a separe assits, but yeah, this sounds right (but out of scope for this particular issue). |
I'm going to try this one :) |
What should be the result of applying |
Just
You can use |
Quick notice: I'm still on this, holidays are gone so less time, but I'll complete that PR :) |
1850: feat(assists): raw string <-> usual string manipulation r=matklad a=Geobert Fixes #1730 Co-authored-by: Geobert Quach <[email protected]>
Maybe not closing yet, I still need to do the unescape version of make_raw_string |
Is there example of the usage of |
Thanks! You mean it's |
I am actually not sure I you realllu need thouse functions, or if escape default would be enough. But thouse functions definitely can tell you anything about the semantics of the literals |
I think I need them, My question was about choosing between |
1922: feat(assists): Make raw string unescaped r=matklad a=Geobert Last piece of #1730 Co-authored-by: Geobert Quach <[email protected]>
So it's done now? |
Add the following assists:
"hello" -> r#"hello"#
r#"hello"# -> r##"hello"##
r#"hello"# -> r"hello"
r"hello" -> "hello"
Note that, ideally, we should apply escape/unescape for the first and last assist, but it's ok to not do it for the first pass.
Example assits are here: https://github.com/rust-analyzer/rust-analyzer/blob/e055cfacdfe3b3451484dae5d6ed08aefba133ca/crates/ra_assists/src/lib.rs
Each familiy lives in a separate mode, which contains the tests as well. See #1281 for an example of PR which adds an assist.
The text was updated successfully, but these errors were encountered: