Skip to content
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

Merged
merged 3 commits into from
May 16, 2024

Conversation

Duologic
Copy link
Member

@Duologic Duologic commented Mar 11, 2024

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.

Comment on lines +168 to +170
interStr := "interimPath" + str
fmtStr, _ := formatter.Format("", interStr, formatter.DefaultOptions())
ret, _ := strings.CutPrefix(fmtStr, "interimPath")
Copy link
Member Author

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.

@Duologic

This comment was marked as resolved.

@Duologic Duologic marked this pull request as ready for review March 11, 2024 21:20
}
func formatLabel(str string) string {
interStr := "interimPath" + str
fmtStr, _ := formatter.Format("", interStr, formatter.DefaultOptions())
Copy link
Member Author

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.

@Duologic
Copy link
Member Author

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.

@Duologic Duologic marked this pull request as draft March 14, 2024 10:21
@Duologic Duologic force-pushed the duologic/correcter_quote_completion branch from dead763 to 93cd2e2 Compare March 14, 2024 12:52
@Duologic Duologic force-pushed the duologic/correcter_quote_completion branch from 93cd2e2 to c000fa6 Compare March 14, 2024 12:53
@Duologic
Copy link
Member Author

Removed the last commit about using TextEdit for all, I've observerd sporadic issues with that, will look into that separately.

@Duologic Duologic marked this pull request as ready for review March 14, 2024 12:54
Copy link
Member

@julienduchesne julienduchesne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@Duologic Duologic merged commit e7625f6 into main May 16, 2024
4 checks passed
@Duologic Duologic deleted the duologic/correcter_quote_completion branch May 16, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants