-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/tools/gopls: support conversion between raw and interpreted string literals #51200
Comments
How would you envision this feature working? / How would it appear in the UI? |
I think the best place would be in the refactor menu when right-clicking on an eligible string. |
I think this can be a candidate of |
Change https://go.dev/cl/542235 mentions this issue: |
Thanks for the contribution! Moved to the gopls@v0.15.0 milestone so we remember to mention this in the release notes. |
Is your feature request related to a problem? Please describe.
I've often needed to convert between raw (
`…`
) and interpreted ("…"
) strings, especially when pasting literals between files in different languages. This would also make it easier to edit complex string literals.Describe the solution you'd like
Code actions or refactoring options for converting between the two forms:
strconv.CanBackquote
, another one which is similar but allows newlines).` + "`" + `
. If it transforms it, another action to merge consecutive concatenated literals into a single one would be useful.%q
).%+q
) (for completeness; I wouldn't really use this one much).Describe alternatives you've considered
I currently manually convert between forms, using regular expressions for large strings. I've considered making this as a separate VSCode extension, but I think this fits better in gopls since it's Go-specific.
Additional context
N/A
The text was updated successfully, but these errors were encountered: