Skip to content
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

x/tools/gopls: spurious "is not an identifier" error #33467

Closed
ainar-g opened this issue Aug 5, 2019 · 8 comments
Closed

x/tools/gopls: spurious "is not an identifier" error #33467

ainar-g opened this issue Aug 5, 2019 · 8 comments
Labels
Milestone

Comments

@ainar-g
Copy link
Contributor

@ainar-g ainar-g commented Aug 5, 2019

  • gopls built from 1d1727260058c6d58ebfdeb982c4657342282355
  • go version go1.11.12
  • vim version 8.0 from the Ubuntu 18.04 repo
  • vim-lsc version ad9d2bd0582419e902bc402545da397634202ed0

When browsing through code, I constantly get:

[lsc:Error] no highlight: /home/me/go/src/example.com/foo.go:254:2 is not an identifier
Span = /home/me/go/src/example.com/foo.go:254:2

I get this whenever the cursor is not on an identifier. This error also makes the cursor invisible, which is annoying.

I am still not sure, if it's a problem with vim-lsc or gopls. I am ready to provide more information to help diagnose the issue.

@gopherbot gopherbot added this to the Unreleased milestone Aug 5, 2019
@gopherbot gopherbot added the gopls label Aug 5, 2019
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Aug 5, 2019

These error messages are removed in gopls at master, if you would like to update. However, master will likely not be as stable as the latest tagged version.

This error is a result of your editor showing the errors from the hover request to the user, so it might be worth filing that issue. Some editors, like VSCode, choose not show the errors from every request to the user.

@stamblerre stamblerre closed this Aug 5, 2019
@ainar-g

This comment has been minimized.

Copy link
Contributor Author

@ainar-g ainar-g commented Aug 5, 2019

@stamblerre I've included the commit hash in my original post. I am on master. I've just updated to 2756c524cc1ca1284d912b9c5ee3b0092ff4459b, which was committed recently, and the problem is still there.

Not sure “just ignore it” is a good strategy, but I will open an issue, if it wasn't already.

@ainar-g

This comment has been minimized.

Copy link
Contributor Author

@ainar-g ainar-g commented Aug 5, 2019

@stamblerre FWIW, I've replaced

return nil, fmt.Errorf("%s is not an identifier", fset.Position(pos))

with

return nil, nil

in internal/lsp/source/highlight.go, and it started working again.

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Aug 5, 2019

Oh I'm sorry, I misunderstood - I had assumed that the error was with hover, not with document highlight.

In that case, this is definitely an error on the client side. We never return errors from document highlight (see here), they are only ever logged. The client should not show the user logged errors--the LSP specification has a specific window/showMessage request that is distinct from window/logMessage. I would suggest filing this issue on the vim-lsc repo.

@ainar-g

This comment has been minimized.

Copy link
Contributor Author

@ainar-g ainar-g commented Aug 5, 2019

You are very correct! Disabling logging with

let g:lsc_server_commands = {"go": {"command": "gopls serve", "log_level": -1}}

fixes the issue! Should I add info about this vim LSC implementation to the Wiki to prevent duplicates?

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Aug 5, 2019

I think it might be best to file an issue with vim-lsc so that they can correct the problem, but as a temporary fix, adding a suggestion to the Wiki would also be helpful. Thanks!

@ainar-g

This comment has been minimized.

Copy link
Contributor Author

@ainar-g ainar-g commented Aug 5, 2019

Done. Thank you thrice: for helping me today, for your GopherCon Russia talk, and for gopls in general!

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Aug 5, 2019

😄 And thank you for reporting this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.