-
Notifications
You must be signed in to change notification settings - Fork 765
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
customFormatter
setting in go.alternateTools
does not resolve variables in path
#2582
Comments
customFormatter
setting does not resolve variables in pathcustomFormatter
setting in go.alternateTools
does not resolve variables in path
Thanks for the report. At some point, we need to call Out of curiosity - @dcarney-stripe what is the reason the default formatter gopls provides isn't sufficient? |
@hyangah Great, thanks for taking a look! We have a custom formatter the wraps
On that last point: running
won't produce any substantive changes, whereas our custom formatter would produce:
|
@hyangah Yeah, the weird behavior (as mentioned in the issue report), is that the variable resolution appears to work for other tools in the |
Hi, I have a similar problem and I'm not sure if it warrants opening a new issue:
And getting an error with the variable without expanding, and then tried other variables that seem to be supported for expansion in the extension according to resolvePath and noticed that neither of them were being expanded either. |
@hyangah Would it be enough to call vscode-go/src/language/legacy/goFormat.ts Line 147 in b2303c5
|
@uniquefine Yes, that will work. |
@Aramatis not sure if it's still relevant but variables in arguments are expanded if the argument starts with Lines 104 to 112 in b2303c5
|
@uniquefine Thank you for pointing that out! Is that documented anywhere, or is there any reason it's not resolved in all the Edit: maybe actually a question for @hyangah |
Change https://go.dev/cl/576296 mentions this issue: |
Change https://go.dev/cl/580418 mentions this issue: |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes.Describe the bug
I recently noticed this commit, which enables the use of a custom formatter while also using
gopls
! 🎉However, it appears that the value supplied for the path to the custom formatter doesn't get variables resolved,
For example, given the following in
.vscode/settings.json
:the alternate tool for
gopls
gets resolved properly, but the tool forcustomFormatter
does not, leading to a popup like:(actual PATH redacted)
A clear and concise description of what you expected to happen.
Steps to reproduce the behavior:
${workspaceFolder}
variable in "go.alternateTools".go
file to attempt to run the custom formatterScreenshots or recordings
See above screencap of the popup that is shown when such a customFormatter value is used.
The text was updated successfully, but these errors were encountered: