-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
Today valast uses a dumb heuristic to determine if a string should be formatting as a Go "string literal"
or `raw string literal`
:
if len(s) > 40 && strings.Contains(s, "\n") && !strings.Contains(s, "`") {
return basicLit(vv, token.STRING, "string", "`"+s+"`", opt)
}
return basicLit(vv, token.STRING, "string", strconv.Quote(v.String()), opt)
No doubt there are cases where the formatting provided here will be less than optimal. Problematic cases include:
- Very long single-line strings.
- Multi-line strings with long lines.
- Strings with lots of unicode where escape sequences (or not) may be more desirable.
- ...
The goal of this issue is to find out how we can improve the default formatting to meet most use cases. It would then additionally be nice to have the ability for users of the package to provide a string for matter of their own, but we should do this after exhausting possibilities of improving the default.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed