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: include acceptable codelens, annotation keys in api-json output #42961

Closed
hyangah opened this issue Dec 3, 2020 · 2 comments
Closed

Comments

@hyangah
Copy link
Contributor

@hyangah 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 this to the Unreleased milestone Dec 3, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/vscode-go Dec 3, 2020
@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default via automation Dec 3, 2020
@stamblerre stamblerre moved this from Needs Triage to Critical in vscode-go: gopls by default Dec 16, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 27, 2020

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

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 27, 2020

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 <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
@stamblerre stamblerre self-assigned this Dec 28, 2020
vscode-go: gopls by default automation moved this from Critical to Done Dec 30, 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 <rstambler@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants