microsoft / vscode-go

An extension for VS Code which provides support for the Go language. We have moved to https://github.com/golang/vscode-go
Other
5.93k stars 645 forks source link

Errors no longer clearing #1036

Closed FryDay closed 7 years ago

FryDay commented 7 years ago

On Arch Linux, just updated to 1.13.1 and now my errors no longer clear. I have to restart VSCode for them to go away.

ramya-rao-a commented 7 years ago

Do you have to restart every single time for the errors to disappear?

boljen commented 7 years ago

I assume that I'm experiencing the same issue.

It occurs with both gometalinter and golint. A restart is required to clear the problems from visual code.

If "go.liveErrors" is enabled, all linter problems are cleared and replaced with those problems caused by the live errors tool. Possibly a problem-matcher issue?

Ubuntu 16.04 Go 1.8.3 Latest tools installed (afaik)

ramya-rao-a commented 7 years ago

@FryDay @boljen The errors clear up when there is a save on the current file. Can you please check that the errors do not go away even after fixing the issues and saving the file?

Can you share a gif/video of the same? I cannot repro

ramya-rao-a commented 7 years ago

Also, what is the value of go.lintOnSave in your settings?

FryDay commented 7 years ago

I have lintOnSave set to package. I'll try and get a gif to show you.

boljen commented 7 years ago

I got it all working again but I don't know why.

Coverage didn't work even though it was enabled in the user settings.json file and wasn't set in the workspace settings.json file. Setting it explicitly in the workspace settings.json file for some reason fixed both the error clearing issue as well as no coverage showing up in the editor.

The best explanation I can come up with is a corrupted cache of some sorts which got fixed by one of the following operations, or several of them in this order;

Enabling coverOnSave in the workspace settings fixed my issue.

I then tried to reintroduce the issue by:

yet I'm unable to replicate the issue.

I should add that I sometimes had issues saving the file in visual code. I modify the file and save it using the accelerator (CTRL+S), but visual code still shows a save file dialog and I can only close the file after saving it through that dialog. Can't recall whether it are just "Go" files or other languages as well. I'll post a comment if this happens again, or doesn't happen again. "editor.formatOnSave" is enabled inside the user settings.json.

Perhaps both issues are related?

I had the issue even when only the vscode-go extension was enabled, and when the issue was fixed, the only other enabled extension is vscode-protobuf.

EDIT:

I also had go.vetFlags: ["-all"] in the user settings.json.

FryDay commented 7 years ago

Yeah, it's mysteriously working for me again too. No idea what happened that caused it to start working as intended again, though.

ramya-rao-a commented 7 years ago

On every save, the diagnostics are cleared and calculated again, so I am stumped as to how this is happening.

If you can get a consistent repro, please do share.

Closing this issue until then

posito commented 7 years ago

@ramya-rao-a , I have the same issue. If I run the

go.coverOnSave": true,

The error is not clearing. Here is my config

{
    "editor.minimap.enabled": false,
    "window.reopenFolders": "none",
    "editor.formatOnSave": true,
    "go.docsTool": "gogetdoc",
    "go.buildOnSave": true,
    "go.lintOnSave": "package",
    "go.coverOnSave": false,
    "go.formatTool": "goimports",
    "go.vetOnSave": true,
    "go.useDiffForFormatting": false,
    // "go.useCodeSnippetsOnFunctionSuggest": true,
    "go.gopath": "/Users/posito/gopath",
    //  "beautify.onSave": ["js", "html", "css"],
    "go.lintTool": "golint",
    "cSpell.userWords": [
        "gitlab",
        "robfig",
        "structs"   ],
    "workbench.sideBar.location": "left",
    "window.zoomLevel": 0,
    "workbench.colorTheme": "Visual Studio Light"
}
ramya-rao-a commented 7 years ago

@posito can u share a screenshot or GIF or video of the issue?

FryDay commented 7 years ago

@ramya-rao-a After updating VS Code, it's happening again. Here is a screenshot showing the issue. You can see I am clearly returning, but the error won't go away unless I close and reload VS Code.

image

Here is my config: `{ "editor.fontFamily": "Fira Code", "editor.fontSize": 17, "editor.fontLigatures": true,

"go.useLanguageServer": true,
"go.testOnSave": true,
"go.lintOnSave": "package",
"go.coverOnSave": true,
"workbench.colorTheme": "Spacemacs - dark",

 "settings.cycle": [
    {
        "id": "minimap", // must be unique
        "overrideWorkspaceSettings": false,
        "values": [
            {
                "editor.minimap.enabled": false
            },
            {
                "editor.minimap.enabled": true
            }
        ]
    }
],
"editor.minimap.enabled": false,
"workbench.iconTheme": "vscode-icons"`
FryDay commented 7 years ago

Quick update, it does appear that turning off coverOnSave fixes the issue, but I'd like to be able to keep it on.

Edit: I can reproduce it reliably. I turn on coverOnSave and it won't clear, turn it off and it does. Tried flipping it on and off multiple times, always the same result.

ramya-rao-a commented 7 years ago

I still can't repro this.

@FryDay Can you go to the output pane, select "Go" from drop down, try to repro this and share the output? The build, lint and vet processes are run on save and the output is dumped here.

FryDay commented 7 years ago
Finished running tool: /home/jordan/go/bin/golint

Finished running tool: /usr/bin/go build -i -o /tmp/go-code-check -tags ""

Finished running tool: /usr/bin/go vet
ramya-rao-a commented 7 years ago

That output shows no errors/warnings. This is the same output that gets used by the Problems view.

So am not sure where the problem is.

If you can repro this consistently, can you share a video/gif of the issue and the affect of turning coverOnSave off has on it?

boljen commented 7 years ago

The issue appears to be fixed by deleting the ~/.config/Code directory entirely. First I deleted the Cache, CachedData and Local Storage directories separately but that didn't fix the issue. I also deleted the extensions directory in .vscode but that didn't work.

ramya-rao-a commented 7 years ago

@FryDay @posito

There is one reason why the cover on save feature can affect the problems view.

The build/lint/vet/cover on save operations are triggered at the same time. And only after all are complete, the results get updated. In your cases I believe, the running of the coverage might be taking a long time, thus delaying the update of the build/lint/vet results.

I have decoupled the coverage part from build/lint/vet process. Can you re-try after installing the extension from https://github.com/Microsoft/vscode-go/blob/master/Go-latest.vsix and setting go.coverOnSave back to true?

posito commented 7 years ago

@ramya-rao-a i get a end of central directory record signature not found

ramya-rao-a commented 7 years ago

@posito Can you share more details? Screenshot of the error? Error message? When do you see the error? Are you using the Go-latest.vsix?

ramya-rao-a commented 7 years ago

I believe the latest version of the Go extension (0.6.64) has the fix for this issue

Since I havent heard back from anyone here in a while, I am assuming that the fix works. If it doesnt, please re-open this issue