incu6us / goimports-reviser

Right imports sorting & code formatting tool (goimports alternative)
MIT License
586 stars 75 forks source link

Request for support with VSCode configuration #147

Open Olshansk opened 9 months ago

Olshansk commented 9 months ago

Has anyone been able to successfully configure vscode to use goimports-reviser?

I've tried both of the solutions below, but neither one does anything: no error, no changes, etc... Manually running attempt #2 from my CLI verifies that the binary is properly installed, but the goal is to have it be part of my IDE.

Attempt 1

  "go.alternateTools": {
    "customFormatter": "goimports-reviser"
  },

Attempt 2

  "go.alternateTools": {
    "customFormatter": "/Users/olshansky/workspace/configs/pocket/poktroll/vscode/goimports-reviser.sh",
  },

Where /Users/olshansky/workspace/configs/pocket/poktroll/vscode/goimports-reviser.sh is:

/Users/olshansky/go/bin/goimports-reviser -rm-unused -set-alias -format -output write "$@"

Meta Request: Please no suggestions to use a different editor.

Olshansk commented 8 months ago

Still doesn't work with the vscode lps or configs, so I have to use the filewatcher command instead:

  "filewatcher.commands": [
    {
      "match": "\\.go*",
      "isAsync": true,
      "cmd": "/Users/olshansky/go/bin/goimports-reviser -rm-unused -set-alias -format -output write ${file}",
      "event": "onFileChange"
    }
  ],
e365367 commented 3 months ago

can you use it with vscode now?