tools/goplssetting: read enum key and enum value status VSCode-Go release tool can read gopls apijson's enum keys and enum values' status field (experimental, debug, advanced). The status will be added in the front of markdone description. x/tools CL 652356 Change-Id: I00333a9b63813369f1989e25131b8ce82827a022 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/652357 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Hongxiang Jiang <hxjiang@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
diff --git a/extension/tools/goplssetting/goplssetting.go b/extension/tools/goplssetting/goplssetting.go index a1aa7ff..7f725b3 100644 --- a/extension/tools/goplssetting/goplssetting.go +++ b/extension/tools/goplssetting/goplssetting.go
@@ -111,9 +111,20 @@ opts := []*Option{} for _, v := range options { - if name := statusName(v.Option); name != "" { + if name := statusName(v.Option.Status); name != "" { v.Option.Doc = name + " " + v.Option.Doc } + // Enum keys or values can be marked with status individually. + for i, key := range v.EnumKeys.Keys { + if name := statusName(key.Status); name != "" { + v.EnumKeys.Keys[i].Doc = name + " " + key.Doc + } + } + for i, value := range v.EnumValues { + if name := statusName(value.Status); name != "" { + v.EnumValues[i].Doc = name + " " + value.Doc + } + } opts = append(opts, v.Option) } return opts, nil @@ -129,8 +140,8 @@ return 1000 } -func statusName(opt *Option) string { - switch toStatus(opt.Status) { +func statusName(s string) string { + switch toStatus(s) { case Experimental: return "(Experimental)" case Advanced: @@ -453,11 +464,13 @@ Name string // in JSON syntax (quoted) Doc string Default string + Status string // = "" | "advanced" | "experimental" | "deprecated" } type EnumValue struct { - Value string // in JSON syntax (quoted) - Doc string // doc comment; always starts with `Value` + Value string // in JSON syntax (quoted) + Doc string // doc comment; always starts with `Value` + Status string // = "" | "advanced" | "experimental" | "deprecated" } type Lens struct { @@ -466,6 +479,7 @@ Title string Doc string Default bool + Status string // = "" | "advanced" | "experimental" | "deprecated" } type Analyzer struct { @@ -479,4 +493,5 @@ Name string Doc string Default bool + Status string // = "" | "advanced" | "experimental" | "deprecated" }