Skip to content

x/tools/gopls: suppress signature help inside string literal #43397

@zmb3

Description

@zmb3

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

  • Run go version to get version of Go
    • 1.15.6
  • Run gopls -v version to get version of Gopls if you are using the language server.
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
1.53.0-insider
4a875e23d20b64504a818834f3fa4c40adb8d480
x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.20.0

Share the Go related settings you have added/edited

"go.useLanguageServer": true,
  "go.languageServerExperimentalFeatures": {
    "diagnostics": true,
    "documentLink": false
  },
  "go.delveConfig": {
    "dlvLoadConfig": {
      "maxStringLen": 1024,
    },
    "apiVersion": 2,
  },
  "[go]": {
    "editor.snippetSuggestions": "none",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    }
  },
  "gopls": {
    "usePlaceholders": true, // add parameter placeholders when completing a function
    "staticcheck": false, // uses too much memory right now
    "gofumpt": true
  },

Describe the bug

I am seeing the signature help popup when I press the , key inside a string literal. This is distracting, as I'm not needing signature help and the popup is obstructing the code I need to see while completing a method call.

In this case, the signature help is constantly obstructing my view of the code when writing SQL inside a string literal. It occurs both inside " and backtick terminated strings, and seems to occur both when gopls.usePlaceholders is true and false.

I would expect that just like autocomplete, we suppress signature help inside the string literal, and that I don't see the signature help window again until I complete the string literal and then press ,.

Steps to reproduce the behavior:

  1. Open editor and start writing out a method call where one argument is a string.
  2. When you get to typing the first ( character observe the signature help dialog present itself. This is normal and expected as it is now time to fill in the arguments.
  3. Dismiss the signature help window by pressing escape.
  4. Start typing a string literal "...
  5. Enter a , before closing the string with ".
  6. Observe the signature help window come up again when the , is entered. This is unexpected.

Screenshots or recordings

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions