-
Notifications
You must be signed in to change notification settings - Fork 17
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
fix(completion): use upstream go-jsonnet Formatter #137
Conversation
interStr := "interimPath" + str | ||
fmtStr, _ := formatter.Format("", interStr, formatter.DefaultOptions()) | ||
ret, _ := strings.CutPrefix(fmtStr, "interimPath") |
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.
This tricks the formatter into thinking it is formatting an ast.Index
path, without interimPath
, it would be formatting ['something']
as an array instead.
This comment was marked as resolved.
This comment was marked as resolved.
} | ||
func formatLabel(str string) string { | ||
interStr := "interimPath" + str | ||
fmtStr, _ := formatter.Format("", interStr, formatter.DefaultOptions()) |
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.
I wonder if we somehow should pass along the formatter options that the LSP already knows of. Also not sure how that would work.
I've been using this branch for a little bit but seems something is not entirely correct in some cases. I'll draft it for now. |
dead763
to
93cd2e2
Compare
93cd2e2
to
c000fa6
Compare
Removed the last commit about using |
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.
Follow up on #136, this uses the upstream go-jsonnet formatter. It still feels a bit dirty but I feel much more confident that this will result in correct behavior.