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

feat: preserve indentation of multiline go string literals #765

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

joerdav
Copy link
Collaborator

@joerdav joerdav commented May 30, 2024

Fixes #743

The solution to this was a bit odd. I thought it would be more straight forward but no!

Essentially, I allow go fmt to format the code, then I indent everything by one, then format again. If go fmt removes the line then we are safe to auto-indent, but if the new indentation is preserved then we should leave it be.

Open to other solutions.

@joerdav joerdav force-pushed the mutliline-raw-string branch from 2388a7a to ab59804 Compare May 30, 2024 12:15
@joerdav joerdav requested a review from a-h May 30, 2024 12:22
parser/v2/types.go Outdated Show resolved Hide resolved
@joerdav joerdav changed the title feat: preserve indentation if go fmt would. feat: preserve indentation of multiline go string literals Jun 5, 2024
@joerdav joerdav merged commit 38d9eca into main Jun 5, 2024
7 checks passed
@joerdav joerdav deleted the mutliline-raw-string branch June 5, 2024 13:08
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.

fmt: broken mutliline raw string formatting
2 participants