Skip to content

Commit ece9e9b

Browse files
h9jianggopherbot
authored andcommitted
gopls/doc/generate: add status in codelenses and inlayhints
Features configurable through map[K]V can not be marked as experimental. To comply with deprecation guideline, this CL introduces a per key and per value status where gopls can mark a specific key or a specific value as experimental. The status can be indicated by the comment directives as part of the doc comment. The status can be delcared following pattern "//gopls:status X" very similar to struct tag. This clarifies the question: if "codelenses" is a released feature, are all enum keys configurable in "codelenses" are also released feature? VSCode-Go CL 652357 Change-Id: I4ddc5155751452d5f7b92bbb3610aa61680a29a4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/652356 Auto-Submit: Hongxiang Jiang <[email protected]> Reviewed-by: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 340f21a commit ece9e9b

File tree

8 files changed

+375
-230
lines changed

8 files changed

+375
-230
lines changed

Diff for: gopls/doc/codelenses.md

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ File type: Go
7575

7676
## `run_govulncheck`: Run govulncheck (legacy)
7777

78+
**This setting is experimental and may be deleted.**
79+
7880

7981
This codelens source annotates the `module` directive in a go.mod file
8082
with a command to run Govulncheck asynchronously.
@@ -134,6 +136,8 @@ File type: go.mod
134136

135137
## `vulncheck`: Run govulncheck
136138

139+
**This setting is experimental and may be deleted.**
140+
137141

138142
This codelens source annotates the `module` directive in a go.mod file
139143
with a command to run govulncheck synchronously.

Diff for: gopls/internal/analysis/gofix/directive.go

-95
This file was deleted.

Diff for: gopls/internal/analysis/gofix/gofix.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"golang.org/x/tools/go/types/typeutil"
2121
"golang.org/x/tools/gopls/internal/util/moreiters"
2222
"golang.org/x/tools/internal/analysisinternal"
23+
internalastutil "golang.org/x/tools/internal/astutil"
2324
"golang.org/x/tools/internal/astutil/cursor"
2425
"golang.org/x/tools/internal/astutil/edge"
2526
"golang.org/x/tools/internal/diff"
@@ -598,7 +599,7 @@ func currentFile(c cursor.Cursor) *ast.File {
598599
// hasFixInline reports the presence of a "//go:fix inline" directive
599600
// in the comments.
600601
func hasFixInline(cg *ast.CommentGroup) bool {
601-
for _, d := range directives(cg) {
602+
for _, d := range internalastutil.Directives(cg) {
602603
if d.Tool == "go" && d.Name == "fix" && d.Args == "inline" {
603604
return true
604605
}

Diff for: gopls/internal/doc/api.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ type EnumKey struct {
4747
Name string // in JSON syntax (quoted)
4848
Doc string
4949
Default string
50+
Status string // = "" | "advanced" | "experimental" | "deprecated"
5051
}
5152

5253
type EnumValue struct {
53-
Value string // in JSON syntax (quoted)
54-
Doc string // doc comment; always starts with `Value`
54+
Value string // in JSON syntax (quoted)
55+
Doc string // doc comment; always starts with `Value`
56+
Status string // = "" | "advanced" | "experimental" | "deprecated"
5557
}
5658

5759
type Lens struct {
@@ -60,6 +62,7 @@ type Lens struct {
6062
Title string
6163
Doc string
6264
Default bool
65+
Status string // = "" | "advanced" | "experimental" | "deprecated"
6366
}
6467

6568
type Analyzer struct {
@@ -73,4 +76,5 @@ type Hint struct {
7376
Name string
7477
Doc string
7578
Default bool
79+
Status string // = "" | "advanced" | "experimental" | "deprecated"
7680
}

0 commit comments

Comments
 (0)