Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Output pane keeps opening to show errors while typing when language server is enabled #1662

Closed
chrispouliot opened this issue May 6, 2018 · 12 comments

Comments

@chrispouliot
Copy link

chrispouliot commented May 6, 2018

I'm starting a new Go project and I'm constantly getting any errors (even while I'm in the middle of typing) pop open the output terminal.

Here is an example of what happens when starting to assign a new variable. As I type it decides that the code isn't valid (which it is not, but I'd rather the linter just underline the curly brace [which it does] than the terminal open up).

terminal open

Here are the logs the output terminal is showing me

langserver-go: reading on stdin, writing on stdout
Passing an initialize rootPath URI ("file:///Users/christophepouliot/go/src/github.com/moxuz/price-protection-notifier") is deprecated. Use rootUri instead.
[Error - 1:54:56 PM] Request textDocument/documentSymbol failed.
  Message: /Users/christophepouliot/go/src/github.com/moxuz/price-protection-notifier/db/db.go:28:1: expected operand, found '}'
  Code: 0 
[Error - 1:54:57 PM] Request textDocument/documentSymbol failed.
  Message: /Users/christophepouliot/go/src/github.com/moxuz/price-protection-notifier/db/db.go:28:1: expected operand, found '}'
  Code: 0 
[Error - 1:55:00 PM] Request textDocument/documentSymbol failed.
  Message: /Users/christophepouliot/go/src/github.com/moxuz/price-protection-notifier/db/db.go:28:1: expected operand, found '}'
  Code: 0 
[Error - 1:55:28 PM] Request textDocument/hover failed.
  Message: /Users/christophepouliot/go/src/github.com/moxuz/price-protection-notifier/db/db.go:28:1: expected operand, found '}'
  Code: 0 

Here are the settings I use for VSCode Go

"go.useLanguageServer": true,
  "go.formatTool": "goimports",
  "go.vetOnSave": "off",
  "go.lintTool":"gometalinter",
  "go.lintFlags": [
    "--disable=gas",
    "--disable=gotype",
    "--disable=gocyclo",
    "--fast",
    "--exclude=.pb.go",
  ],

I haven't had this happen to me before while using Go with VSCode so I'm a bit confused about what's happening.

VSCode version: 1.23.0
vscode-go version: 0.6.79

@tao-qian
Copy link

tao-qian commented May 6, 2018

Seeing a similar problem in an existing Golang project today. vscode-go version is 0.6.79.

@chrispouliot
Copy link
Author

chrispouliot commented May 6, 2018

I've also noticed that a lot of times after a bunch of errors in the output my cmd+click will no longer work, and I have to close/re-open VSCode for it to start working again.

After these errors I was no longer able to cmd+click to go to the definition of anything in my file (even if the variable was defined a few lines up)

jsonrpc2 handler: notification "textDocument/didChange" handling error: received textDocument/didChange for unknown file "file:///Users/christophepouliot/go/src/github.com/moxuz/price-protection-notifier/check/parse.go"
[Error - 4:41:31 PM] Request textDocument/documentSymbol failed.
  Message: /Users/christophepouliot/go/src/github.com/moxuz/price-protection-notifier/check/check.go:34:10: expected ';', found 'IDENT' nil (and 9 more errors)
  Code: 0 
[Error - 4:41:38 PM] Request textDocument/documentSymbol failed.
  Message: /Users/christophepouliot/go/src/github.com/moxuz/price-protection-notifier/check/check.go:34:10: expected ';', found 'IDENT' nil (and 10 more errors)
  Code: 0

After restarting VSCode it works again

@sudo-suhas
Copy link

This also happens when I hover on key name in keyed variable instantiation. For example, consider the following code snippet:

v := MyStruct{
	Message: "value",
}

If I hover on Message, I get the following error:

[Error - 12:14:40] Request textDocument/hover failed.
  Message: no declaration found for Message
  Code: 0

This did not bother me much earlier but now the go-langserver output keeps opening up repeatedly(if I close it).

My go plugin settings:

{
	"go.useLanguageServer": true,
    "go.toolsGopath": "~/installs/go-tools",
	"go.gopath": "~/dev/go",
	"go.autocompleteUnimportedPackages": true,
	"go.useCodeSnippetsOnFunctionSuggest": true,
    "go.testFlags": ["-v"],
    "go.liveErrors": {
        "enabled": true,
        "delay": 500
    }
}

Is there some editor setting which will prevent opening the output section on error?

@FryDay
Copy link

FryDay commented May 7, 2018

This just started happening to me too. It's horribly annoying.

"go.useLanguageServer": true,
"go.testOnSave": true,
"go.lintOnSave": "package",
"go.coverOnSave": true,

As far as I can tell it is caused by the language server. Turning it off seems to have stopped this from happening.

@OneOfOne
Copy link
Contributor

OneOfOne commented May 7, 2018

I had to turn off go.useLanguageServer

@ramya-rao-a ramya-rao-a changed the title Terminal keeps opening to show errors while typing Problems pane keeps opening to show errors while typing when language server is enabled May 7, 2018
@OneOfOne
Copy link
Contributor

OneOfOne commented May 7, 2018

@ramya-rao-a while this is a langserver issue, it doesn't happen with vscode-go v0.6.78.

Also check #1667

@ramya-rao-a
Copy link
Contributor

@OneOfOne How is #1667 which is a formatting issue related to the language server or this current issue?

I cannot repro this in the older version of the Go extension either. Also I noticed that the errors are appearing in the "Output" pane not "Problems" pane, so I've deleted my earlier comment. Will look into this more and get back soon

@ramya-rao-a ramya-rao-a changed the title Problems pane keeps opening to show errors while typing when language server is enabled Output pane keeps opening to show errors while typing when language server is enabled May 7, 2018
@ramya-rao-a
Copy link
Contributor

In the latest update to the Go extension, we updated the version of vscode-languageclient we use from 2.5.0 to 4.1.3 which somehow causes this issue. This is why, this issue is not repro-able in the older version of the Go extension

@dbaeumer Between versions 3.0.1-alpha.14 and 3.0.2-beta.1, some change was introduced in the language client that for every error coming from the language server, the output panel comes into view even after repeated hiding. Do you recall any feature request or bug fix that might have caused this? Can this be fixed from the language client's side or is there something that we need to do from the language server's side to fix this?

Others,
Until we figure out a fix for this, you can disable the language server by setting go.useLanguageServer to false

@ramya-rao-a ramya-rao-a added bug and removed upstream labels May 7, 2018
@dbaeumer
Copy link
Member

dbaeumer commented May 8, 2018

This got changed to make errors more visible to the user. However it can be control by the language client using the revealOutputChannelOn property on the LanguageClientOptions

@ramya-rao-a
Copy link
Contributor

Thanks @dbaeumer, I've added the revealOutputChannelOn option.

Others, To get this fix before I release an update sometime later this week, you can

@OneOfOne
Copy link
Contributor

OneOfOne commented May 8, 2018

I can confirm that fixes the issue, thanks!

@ramya-rao-a
Copy link
Contributor

This bug is now fixed in the latest update to the Go extension (0.6.80)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants