Skip to content

x/tools/gopls: reconsider and restructure setting parameter names #43101

@hyangah

Description

@hyangah

There are many settings parameters that can be used to tune gopls behavior. The defaults were carefully chosen so most users don't need to configure them.
But when they do need customization, it should be easy to find the relevant settings.

Detailed documentation for individual setting helps, but I think it's better if

  • the settings are grouped based on their functions. (e.g. is this setting for workspace symbol search? Or completion?)
  • setting names are self-explanatory and sufficiently descriptive.
  • setting names follow some rules roughly so users can guess what to look for.

Some of currently available setting names are not very descriptive. (e.g. local, matcher).

FYI VSCode uses setting names (configuration key) to namespace and group the settings. These name structure helps the plugin developer to grep/watch a part of configuration more efficiently. VSCode uses the name-based grouping to order and build graphical setting page UI. https://code.visualstudio.com/api/references/contribution-points#Configuration-schema

Screen Shot 2020-12-09 at 12 16 47 PM

I originally attempted to map some of gopls settings to VSCode-friendly setting names (that I chose based on the settings' role). For example, I was thinking patterns like <feature>.<behavior> when possible. (note: some settings are not cleanly mapped to one feature)

hoverKind -> doc.hoverKind
linksInHover -> doc.linksInHover
usePlaceholders -> completion.usePlaceHolders
gofumpt -> format.useGofumpt
matcher -> completion.matcher
symbolMatcher -> workspaceSymbols.matcher

But I think it's more desirable if all gopls-based editors share the similar setting structures.

  • users can map settings from one editor to another editors more easily, so helps more knowledge sharing.
  • less documentation work to explain different editor settings for gopls maintainers.

I was also considering extending the api-json output to include the group info as a field, and utilize the group info to auto-construct VS Code setting names. But for the reasons I mentioned above, I think it's better if the names carry sufficient info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions