Debian Codegraph @

gopls/internal/doc/api.go

raw symbols SCIP
1 // Copyright 2024 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:generate go run ./generate
6
7 // The doc package provides JSON metadata that documents gopls' public
8 // interfaces.
9 package doc
10
11 import _ "embed"
12
13 // JSON is a JSON encoding of value of type API.
14 // The 'gopls api-json' command prints it.
15 //
16 //go:embed api.json
17 var JSON string
18
19 // API is a JSON-encodable representation of gopls' public interfaces.
20 //
21 // TODO(adonovan): document these data types.
22 type API struct {
23 Options map[string][]*Option
24 Lenses []*Lens
25 Analyzers []*Analyzer
26 Hints []*Hint
27 }
28
29 type Option struct {
30 Name string
31 Type string // T = bool | string | int | enum | any | []T | map[T]T | time.Duration
32 Doc string
33 EnumKeys EnumKeys
34 EnumValues []EnumValue
35 Default string
36 Status string
37 Hierarchy string
38 DeprecationMessage string
39 }
40
41 type EnumKeys struct {
42 ValueType string
43 Keys []EnumKey
44 }
45
46 type EnumKey struct {
47 Name string // in JSON syntax (quoted)
48 Doc string
49 Default string
50 Status string // = "" | "advanced" | "experimental" | "deprecated"
51 }
52
53 type EnumValue struct {
54 Value string // in JSON syntax (quoted)
55 Doc string // doc comment; always starts with `Value`
56 Status string // = "" | "advanced" | "experimental" | "deprecated"
57 }
58
59 type Lens struct {
60 FileType string // e.g. "Go", "go.mod"
61 Lens string
62 Title string
63 Doc string
64 Default bool
65 Status string // = "" | "advanced" | "experimental" | "deprecated"
66 }
67
68 type Analyzer struct {
69 Name string
70 Doc string // from analysis.Analyzer.Doc ("title: summary\ndescription"; go/doc/comment, not Markdown)
71 URL string
72 Default bool
73 }
74
75 type Hint struct {
76 Name string
77 Doc string
78 Default bool
79 Status string // = "" | "advanced" | "experimental" | "deprecated"
80 }