x/tools/gopls: support conversion between raw and interpreted string literals #51200
Labels
FeatureRequest
gopls
Issues related to the Go language server, gopls.
help wanted
Refactoring
Issues related to refactoring tools
Milestone
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: