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

Feature Request: add new formatter gorgeous #2503

Closed
hidu opened this issue Oct 20, 2022 · 3 comments
Closed

Feature Request: add new formatter gorgeous #2503

hidu opened this issue Oct 20, 2022 · 3 comments
Assignees
Milestone

Comments

@hidu
Copy link

hidu commented Oct 20, 2022

Is your feature request related to a problem? Please describe.
gorgeous is a new powerful formatter.
Project is: https://github.com/fsgo/go_fmt

Describe the solution you'd like
Add it to "Format Tool" option.

or "Format Tool" can set any other customized tool, rather than the limited ones.

@gopherbot gopherbot added this to the Untriaged milestone Oct 20, 2022
@dle8 dle8 modified the milestones: Untriaged, vscode-go/unplanned Oct 26, 2022
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/446298 mentions this issue: docs/settings: make the custom formatter support more visible

@hyangah
Copy link
Contributor

hyangah commented Oct 28, 2022

@hidu Custom formatter support had been available since v0.24.0, but this extension assumes the formatter can work with the input supplied with STDIN, and output to STDOUT. I am not familiar with the gorgeous tool. Does it support STDIN based file content? If so, try "go.formatTool": "gorgeous" .

I prepared a change that made this feature more visible. If it's merged in in the current state and your tool supports STDIN/STDOUT, users may enable it like

"go.formatTool": "custom",
"go.alternateTools": { "customFormatter": "gorgeous" }

gopherbot pushed a commit that referenced this issue Nov 10, 2022
Custom formatter support was added in #1238.
But due to the limitation in the VS Code setting UI (which assumes
the acceptable values list is static) and the setting validation
logic (VS Code thinks it's an error to use a value outside of the
supplied enum list is invalid), this is not visible to users.

Instead, this change introduces an extra enum 'custom' for the
"go.formatTool" setting. If this is chosen, the extension uses
the tool specified as `customFormatter` in the "go.alternateTools"
setting section for formatting.

The extension expects the custom formatter to accept input as STDIN
and output the result as STDOUT. Users can also supply "go.formatFlags".

Changed the descriptions to use markdown - which allows to reference
other settings ("`#...#`"). The document generation tool does not
handle this special syntax nicely but I hope this isn't too confusing.

I wish we could add an extra validation on the allowed value for
"go.formatTool" in favor of this new 'custom' option. I am not adding
the validation in this CL because there could be users who depend
on this behavior.

For #1238
For #1603
For #2503

Change-Id: I5d9564f331845b6b07f0b54148834118404f3553
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/446298
Reviewed-by: Jamal Carvalho <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
@hyangah hyangah modified the milestones: vscode-go/unplanned, v0.37.0 Nov 10, 2022
@hyangah
Copy link
Contributor

hyangah commented Nov 10, 2022

The new setting tweak will be available in the next release. Until then, use "go.formatTool": "<custom_tool_name>".
Closing.

@hyangah hyangah closed this as completed Nov 10, 2022
@golang golang locked and limited conversation to collaborators Nov 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants