-
Notifications
You must be signed in to change notification settings - Fork 651
vscode triggeres too many go build/lint/... tasks #1015
Comments
There is nothing I know of that you (as a user) can do at the moment to reduce the triggering of build/lint/vet on multiple files when Save All is used. We should see if there is a way to identify a Save All event vs Save event in which case the extension can be smarter and trigger build/lint/vet on a package only once even if multiple files in the package was saved. |
Thanks @ramya-rao-a! Should I create another issue to run go-metalinter only on the changed file/package instead of the whole repository? Saving a file a few times in succession can cause a similar amount of running processes and a similar situation of a stalled system. |
We don't run it on the whole repo, we run it on the parent directory of the file that was saved. If linting does get expensive, then a better solution would be to not run lint on save, but rather run it after a delay. |
Is there a way to TOGGLE the linter, or manually run the linter in vs code? Currently, I have to manually modify the configs to achieve this. Thanks |
@roylee17 Do you mean the settings when you say configs? |
@ramya-rao-a Yes, is there an command that I can run manually, and/or create a keybinding for that command? |
@roylee17 Not at the moment, but I am sure there is an issue tracking that as well. I'll try and find it and link it here |
In the meantime I've set up this couple of tasks: {
"version": "2.0.0",
"tasks": [
{
"taskName": "megacheck",
"type": "shell",
"command": "megacheck ./...",
"group": "test",
"presentation": {
"echo": false,
"reveal": "silent",
"focus": false,
"panel": "shared"
},
"problemMatcher": "$go"
},
{
"taskName": "lint",
"type": "shell",
"command": "go vet -composites=false ./...",
"group": "test",
"presentation": {
"echo": false,
"reveal": "silent",
"focus": false,
"panel": "shared"
},
"problemMatcher": "$go"
}
]
} (note, I'm disabling composites on vet because that's noisy and I like my un-labeled struct literals) |
@ramya-rao-a I noticed that if you enable Gometalinter, |
@roylee17 In the latest update to the Go extension (0.6.69), you can manually run the linter on your code using the commands @atombender That would require me to also check if default set of linters havent been tinkered with using the |
@ramya-rao-a While true, it's also probably true that a lot of people have both enabled without realizing it. I think it's worth re-evaluating the whole thing, to be honest. I'm not sure I understand why there's a |
Good point, PRs are welcome. |
I'm running into this quite a lot on large projects. One of the reasons I love working with this extension is the lint-on-save features so I don't want to disable that (it runs fast enough for me). The issue is if I change things in quick succession or do a Save All when changing lots of things. Surely there's a way the extension knows the PID of the linter? If so, then I think the extension should kill the existing lint task before starting a new one. Meaning only one lint process is running regardless of how it was triggered. This would mean there's no need to figure out if Save or Save All was used and also speeds up the process when making little changes in quick succession. My TypeScript is rusty but I could look into this in future. I'm not totally sure how the extension triggers linters and keeps track of them but keeping the PID stored and killing it sounds realtively simple. If I get anywhere with this, I'll submit a PR. But it would be useful to have some feedback on this idea from people more familiar with the extension's codebase! |
@Southclaws At the moment, we cancel the current running linter process before starting a new one, but we dont wait for the process to be killed, before starting a new one. You can see this in https://github.com/Microsoft/vscode-go/blob/0.6.84/src/goLint.ts#L45 and https://github.com/Microsoft/vscode-go/blob/0.6.84/src/util.ts#L585 You can find instructions to run the extension from source at https://github.com/Microsoft/vscode-go/wiki/Building,-Debugging-and-Sideloading-the-extension-in-Visual-Studio-Code#building-and-debugging-the-extension If you can figure out why the current process of killing existing processes doesnt help you, then that would be helpful. |
Since this issue has not had any activity for over a year, I will close it in favor of a new umbrella issue for improving VS Code Go's handling of subprocesses: #3044. It will be easier to track improvements with one issue, instead of many hard-to-find ones. As an alternative, you can use the language server, which handles cancellation. |
Duplicate of #3044 |
First of all, thanks for all your work on vscode and the go plugin, the integration is awesome.
My issue is that vscode can easily render my system unusable for minutes by triggering many parallel tasks for the same actions:
Save All
seems to start multiple build / compile jobs, supposedly one for each changed file? I had to restart my laptop as no user input was possible anymore.I disabled metalinter already for that reason, here is my user config:
Here is an example of all the builds started after a gorename and save all in 20+ files
Is there anything I can do to limit the lintTool to the currently changed file (package)? Are there any other options I missed to improve the behavior?
The text was updated successfully, but these errors were encountered: