Skip to content

x/tools/gopls: include acceptable codelens, annotation keys in api-json output #42961

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

Closed
hyangah opened this issue Dec 3, 2020 · 2 comments
Closed
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Dec 3, 2020

From golang/vscode-go#987 (comment) -
Currently acceptable keys of map[string]* type settings are only documented in free text form in the Doc field.
Would be nice if they are listed in a separate field (maybe EnumKeys accompanied with descriptions?) so our settings generator can use them to set info necessary for autocompletion.

  {
        "Name": "annotations",
        "Type": "map[string]bool",
        "Doc": "annotations suppress various kinds of optimization diagnostics\nthat would be reported by the gc_details command.\n * noNilcheck suppresses display of nilchecks.\n * noEscape suppresses escape choices.\n * noInline suppresses inlining choices.\n * noBounds suppresses bounds checking diagnostics.\n",
        "EnumValues": null,
        "Default": "{}"
  }
@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 Dec 3, 2020
@gopherbot gopherbot added this to the Unreleased milestone Dec 3, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/vscode-go Dec 3, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/280354 mentions this issue: internal/lsp: use an enum for GC annotations settings

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/280355 mentions this issue: internal/lsp: save all possible keys for analyses, codelenses

gopherbot pushed a commit to golang/tools that referenced this issue Dec 28, 2020
The annotations map should use an enum to indicate expected values. For
now, we reuse the EnumValues to expose the information in the settings.
Later, we'll create a separate EnumKeys field to expose this information
more correctly.

Also, adjust some of the logic that applies the settings because it was
incorrect.

Both gopls/doc/settings.md and internal/lsp/source/api_json.go are
generated files.

Updates golang/go#42961

Change-Id: Ifb032b70caaae73defe9a540df20d098d313e68e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/280354
Trust: Rebecca Stambler <[email protected]>
Run-TryBot: Rebecca Stambler <[email protected]>
gopls-CI: kokoro <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Peter Weinberger <[email protected]>
@stamblerre stamblerre self-assigned this Dec 28, 2020
gopherbot pushed a commit to golang/tools that referenced this issue Jan 11, 2021
The possible keys for analyses and codelenses are too long to enumerate
in settings, and we'd need to create enums for all possible analyzer
and code lens names, which is probably not feasible. Instead, collect
the list of possible values from the analyzers and command settings
generation and add them to enum values.

Also, handle default values by setting them in the enum keys instead of
one big default value. Quite a few hacks to get this right, but maybe
there are other better alternatives we can consider in the future.

Fixes golang/go#42961

Change-Id: I5c096862b5e8fb89fe5d6639b4f46c06492e49c4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/280355
Trust: Rebecca Stambler <[email protected]>
Trust: Hyang-Ah Hana Kim <[email protected]>
Run-TryBot: Rebecca Stambler <[email protected]>
gopls-CI: kokoro <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Reviewed-by: Suzy Mueller <[email protected]>
@golang golang locked and limited conversation to collaborators Dec 30, 2021
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. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants