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: incorrect highlight of imports with major version suffix (semantic tokens) #47784

Closed
papa-whisky opened this issue Aug 18, 2021 · 3 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@papa-whisky
Copy link

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.17 darwin/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.7.1
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.59.0
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.27.1
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    • I don't think this is relevant to this issue? Let me know if so though and I'll provide it. As an aside, this command prints my go env, which in my case includes a goproxy URL that shows my API token, and I may well have pasted it here if I hadn't been more careful. Perhaps this template could advise caution before pasting?

Share the Go related settings you have added/edited

{
  "go.useLanguageServer": true,
  "[go]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    },
    "editor.snippetSuggestions": "none"
  },
  "gopls": {
    "usePlaceholders": true,
    "staticcheck": false,
    "gofumpt": true,
    "ui.semanticTokens": true
  },
  "go.lintTool": "golangci-lint",
  "go.toolsManagement.autoUpdate": true
}

Describe the bug

With the ui.semanticTokens feature enabled, the package name is highlighted in import statements. However, if the import ends in /vN the highlighting is incorrect; the version is highlighted rather than the package name. Refer screenshot below.

Steps to reproduce the behavior:

  1. Set the "ui.semanticTokens": true option.
  2. Use the default "Dark+" theme.
  3. Import a package with a version suffix in the import path.

Screenshots or recordings

image

@stamblerre stamblerre transferred this issue from golang/vscode-go Aug 18, 2021
@stamblerre
Copy link
Contributor

/cc @pjweinb

@stamblerre stamblerre changed the title Semantic tokens: incorrect highlight of imports with major version suffix x/tools/gopls: incorrect highlight of imports with major version suffix (semantic tokens) Aug 18, 2021
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Aug 18, 2021
@gopherbot gopherbot added this to the Unreleased milestone Aug 18, 2021
@stamblerre stamblerre added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 18, 2021
@pjweinb pjweinb self-assigned this Aug 18, 2021
@pjweinb
Copy link

pjweinb commented Aug 19, 2021

Thanks for the report. I believe I know how to fix it.

@stamblerre
Copy link
Contributor

Fixed by https://golang.org/cl/343909

@rsc rsc unassigned pjweinb Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants