From 899a6631f592e80d279fc6fefc69f8925291e4bb Mon Sep 17 00:00:00 2001 From: Pranav Gaikwad Date: Fri, 6 Oct 2023 12:45:21 -0400 Subject: [PATCH] :ghost: Fast-forward release-0.3 (#364) Signed-off-by: Pranav Gaikwad Signed-off-by: JonahSussman Signed-off-by: Jonah Sussman <42743659+JonahSussman@users.noreply.github.com> Signed-off-by: John Matthews Signed-off-by: GitHub Actions Co-authored-by: Jonah Sussman <42743659+JonahSussman@users.noreply.github.com> Co-authored-by: John Matthews Co-authored-by: GitHub Actions --- README.md | 4 +- docs/labels.md | 11 +- docs/violations.md | 2 +- engine/labels/labels.go | 72 +- engine/labels/labels_test.go | 153 + .../pkg/generic/service_client.go | 26 +- lsp/protocol/README.md | 15 + lsp/protocol/codeactionkind.go | 11 + lsp/protocol/doc.go | 6 +- lsp/protocol/enums.go | 15 - lsp/protocol/generate/README.md | 144 + lsp/protocol/generate/generate.go | 121 + lsp/protocol/generate/main.go | 403 + lsp/protocol/generate/main_test.go | 119 + lsp/protocol/generate/output.go | 427 + lsp/protocol/generate/tables.go | 341 + lsp/protocol/generate/typenames.go | 184 + lsp/protocol/generate/types.go | 170 + lsp/protocol/tsdocument_changes.go | 42 + lsp/protocol/tsjson.go | 2152 ++++ lsp/protocol/tsprotocol.go | 9073 +++++++++-------- provider/internal/java/filter.go | 37 +- provider/internal/java/service_client.go | 67 +- rule-example.yaml | 4 +- 24 files changed, 9499 insertions(+), 4100 deletions(-) create mode 100644 lsp/protocol/README.md create mode 100644 lsp/protocol/codeactionkind.go create mode 100644 lsp/protocol/generate/README.md create mode 100644 lsp/protocol/generate/generate.go create mode 100644 lsp/protocol/generate/main.go create mode 100644 lsp/protocol/generate/main_test.go create mode 100644 lsp/protocol/generate/output.go create mode 100644 lsp/protocol/generate/tables.go create mode 100644 lsp/protocol/generate/typenames.go create mode 100644 lsp/protocol/generate/types.go create mode 100644 lsp/protocol/tsdocument_changes.go create mode 100644 lsp/protocol/tsjson.go diff --git a/README.md b/README.md index daf14e98..abc288e7 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ Flags: ## Code Base Starting Point - Using the LSP/Protocal from ACME https://github.com/fhs/acme-lsp and stripping out anything related to serving, proxy or anything. Just keeping the types for communication +Using the LSP/Protocal from Golang https://github.com/golang/tools/tree/master/gopls/internal/lsp/protocol and stripping out anything related to serving, proxy or anything. Just keeping the types for communication - Using JSONRPC2 from google.org/x/tools/internal. Copied and removed anything to do with serving. +Using JSONRPC2 from google.org/x/tools/internal. Copied and removed anything to do with serving. ## Code of Conduct diff --git a/docs/labels.md b/docs/labels.md index 023dd357..661fbaf3 100644 --- a/docs/labels.md +++ b/docs/labels.md @@ -29,14 +29,15 @@ labels: - "konveyor.io/key" ``` -## Reserved Labels +## Rule Labels -The analyzer defines some labels that have special meaning. Here is a list of all such labels: +The analyzer defines some labels that have special meanings: -- `konveyor.io/source`: Identifies source technology a rule or a ruleset applies to. -- `konveyor.io/target`: Identifies target technology a rule or a ruleset applies to. +- `konveyor.io/source`: Identifies source technology a rule or a ruleset applies to. The value can be a string with optional version range at the end e.g. "eap", "eap6", "eap7-" etc. +- `konveyor.io/target`: Identifies target technology a rule or a ruleset applies to. The value can be a string with optional version range at the end e.g. "eap", "eap6", "eap8+" etc. +- `konveyor.io/include`: Overrides filter behavior for a rule irrespective of the label selector used. The value can either be `always` or `never`. `always` will always filter-in this rule, `never` will always filter-out this rule. -## Label Selector +### Rule Label Selector The analyzer CLI takes `--label-selector` as an option. It is a string expression that supports logical AND, OR and NOT operations. It can be used to filter-in/filter-out rules based on labels. diff --git a/docs/violations.md b/docs/violations.md index 7857b1a6..324e237e 100644 --- a/docs/violations.md +++ b/docs/violations.md @@ -25,7 +25,7 @@ The analyzer rule engine creates a _Violation_ for every rule that matches excep * **effort**: Integer value indicating story points for each incident as determined by the rule author. -See [Violation struct](../hubapi/violations.go) for more details. +See [Violation struct](../output/v1/konveyor/violations.go) for more details. ### Output Structure diff --git a/engine/labels/labels.go b/engine/labels/labels.go index cdd8dbaa..44d5d37a 100644 --- a/engine/labels/labels.go +++ b/engine/labels/labels.go @@ -7,10 +7,18 @@ import ( "strings" "github.com/PaesslerAG/gval" + "github.com/hashicorp/go-version" ) const ( - LabelValueFmt = "^[a-zA-Z0-9]([-a-zA-Z0-9. ]*[a-zA-Z0-9])?$" + // a selector label takes precedance over any other label when matching + RuleIncludeLabel = "konveyor.io/include" + SelectAlways = "always" + SelectNever = "never" +) + +const ( + LabelValueFmt = "^[a-zA-Z0-9]([-a-zA-Z0-9. ]*[a-zA-Z0-9+-])?$" LabelPrefixFmt = "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" exprSpecialSymbols = `!|\|\||&&|\(|\)` // used to split string into groups of special symbols and everything else @@ -32,6 +40,15 @@ func AsString(key, value string) string { func (l *LabelSelector[T]) Matches(v T) (bool, error) { ruleLabels, _ := ParseLabels(v.GetLabels()) + if val, ok := ruleLabels[RuleIncludeLabel]; ok && + val != nil && len(val) > 0 { + switch val[0] { + case SelectAlways: + return true, nil + case SelectNever: + return false, nil + } + } expr := getBooleanExpression(l.expr, ruleLabels) val, err := l.language.Evaluate(expr, nil) if err != nil { @@ -204,7 +221,7 @@ func getBooleanExpression(expr string, compareLabels map[string][]string) string } if labelVals, ok := compareLabels[exprLabelKey]; !ok { replaceMap[toReplace] = "false" - } else if exprLabelVal != "" && !contains(exprLabelVal, labelVals) { + } else if exprLabelVal != "" && !matchesAny(exprLabelVal, labelVals) { replaceMap[toReplace] = "false" } else { replaceMap[toReplace] = "true" @@ -235,11 +252,58 @@ func tokenize(expr string) []string { return tokens } -func contains(elem string, items []string) bool { +func matchesAny(elem string, items []string) bool { for _, item := range items { - if item == elem { + if labelValueMatches(item, elem) { return true } } return false } + +// labelValueMatches returns true when candidate matches with matchWith +// label value is divided into two parts - name and version +// version is absolute version or a range denoted by + or - +// returns true when names of values are equal and the version of +// candidate falls within the version range of matchWith +func labelValueMatches(matchWith string, candidate string) bool { + versionRegex := regexp.MustCompile(`(\d(?:[\d\.]*\d)?)([\+-])?$`) + mMatch := versionRegex.FindStringSubmatch(matchWith) + cMatch := versionRegex.FindStringSubmatch(candidate) + if len(mMatch) != 3 { + return matchWith == candidate + } + mName, mVersion, mVersionRangeSymbol := + versionRegex.ReplaceAllString(matchWith, ""), mMatch[1], mMatch[2] + if len(cMatch) != 3 { + // when no version on candidate, match for any version + return mName == candidate + } + cName, cVersion := + versionRegex.ReplaceAllString(candidate, ""), cMatch[1] + if mName != cName { + return false + } + if mVersion == "" { + return mVersion == cVersion + } + if cVersion == "" { + return true + } + cSemver, err := version.NewSemver(cVersion) + if err != nil { + return cVersion == mVersion + } + mSemver, err := version.NewSemver(mVersion) + if err != nil { + return cVersion == mVersion + } + switch mVersionRangeSymbol { + case "+": + return cSemver.GreaterThanOrEqual(mSemver) + case "-": + return mSemver.GreaterThanOrEqual(cSemver) + default: + return cSemver.Equal(mSemver) + } +} diff --git a/engine/labels/labels_test.go b/engine/labels/labels_test.go index 6bf526d4..d8bd043d 100644 --- a/engine/labels/labels_test.go +++ b/engine/labels/labels_test.go @@ -90,6 +90,22 @@ func Test_getBooleanExpression(t *testing.T) { }, want: "( true || true ) && false && true", }, + { + name: "values with version ranges", + expr: "(konveyor.io/target=Spring Beans12 && konveyor.io/target=hibernate6.1)", + compareLabels: map[string][]string{ + "konveyor.io/target": {"hibernate6-", "Spring Beans11+"}, + }, + want: "( true && false )", + }, + { + name: "values with version ranges", + expr: "(konveyor.io/target=Spring Beans12 && konveyor.io/target=hibernate6.1)", + compareLabels: map[string][]string{ + "konveyor.io/target": {"hibernate6+", "Spring Beans11-"}, + }, + want: "( false && true )", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -159,6 +175,24 @@ func TestParseLabel(t *testing.T) { wantKey: "konveyor.io/fact", wantVal: "Spring Beans", }, + { + name: "absolte version in value", + label: "konveyor.io/fact=Spring Beans12", + wantKey: "konveyor.io/fact", + wantVal: "Spring Beans12", + }, + { + name: "version range + in value", + label: "konveyor.io/fact=Spring Beans12+", + wantKey: "konveyor.io/fact", + wantVal: "Spring Beans12+", + }, + { + name: "version range - in value", + label: "konveyor.io/fact=Spring Beans12-", + wantKey: "konveyor.io/fact", + wantVal: "Spring Beans12-", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -326,6 +360,24 @@ func Test_ruleSelector_Matches(t *testing.T) { }, want: true, }, + { + name: "rule has a explicit include=always label", + expr: "konveyor.io/source=test", + ruleLabels: []string{ + "konveyor.io/include=always", + "konveyor.io/source=noTest", // this should make the selector not match, but 'always' selector takes precedance + }, + want: true, + }, + { + name: "rule has a explicit include=never label", + expr: "konveyor.io/source=test", + ruleLabels: []string{ + "konveyor.io/include=never", + "konveyor.io/source=test", // this should make the selector match, but 'never' selector takes precedance + }, + want: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -336,3 +388,104 @@ func Test_ruleSelector_Matches(t *testing.T) { }) } } + +func Test_labelValueMatches(t *testing.T) { + tests := []struct { + name string + candidate string + matchWith string + want bool + }{ + { + name: "no version range test", + candidate: "eap", + matchWith: "eap", + want: true, + }, + { + name: "name mismatch test", + candidate: "eap", + matchWith: "javaee", + want: false, + }, + { + name: "absolute version test", + candidate: "eap6", + matchWith: "eap6", + want: true, + }, + { + name: "version range test for '+'", + candidate: "eap6", + matchWith: "eap5+", + want: true, + }, + { + name: "version range test for '+'", + candidate: "eap5", + matchWith: "eap5+", + want: true, + }, + { + name: "version range test for '-'", + candidate: "eap7", + matchWith: "eap8-", + want: true, + }, + { + name: "version range negative test for '-'", + candidate: "eap9", + matchWith: "eap8-", + want: false, + }, + { + name: "version range negative test for '+'", + candidate: "eap7", + matchWith: "eap8+", + want: false, + }, + { + name: "complex value version range test", + candidate: "Golang Version", + matchWith: "Golang Version11+", + want: true, + }, + { + name: "match any version test", + candidate: "eap", + matchWith: "eap6+", + want: true, + }, + { + name: "match any version test negative", + candidate: "eap6", + matchWith: "eap", + want: false, + }, + { + name: "float value absolute match", + candidate: "hibernate5.1", + matchWith: "hibernate5.1", + want: true, + }, + { + name: "float value range symbol '+' match", + candidate: "hibernate5.2", + matchWith: "hibernate5.1+", + want: true, + }, + { + name: "float value range symbol '+' negative match", + candidate: "hibernate5.0.12", + matchWith: "hibernate5.1+", + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := labelValueMatches(tt.matchWith, tt.candidate); got != tt.want { + t.Errorf("versionRangeMatches() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/external-providers/generic-external-provider/pkg/generic/service_client.go b/external-providers/generic-external-provider/pkg/generic/service_client.go index 5d6b01cf..eaf8f934 100644 --- a/external-providers/generic-external-provider/pkg/generic/service_client.go +++ b/external-providers/generic-external-provider/pkg/generic/service_client.go @@ -48,7 +48,7 @@ func (p *genericServiceClient) Evaluate(ctx context.Context, cap string, conditi incidents := []provider.IncidentContext{} for _, s := range symbols { - references := p.GetAllReferences(ctx, s.Location) + references := p.GetAllReferences(ctx, s.Location.Value.(protocol.Location)) for _, ref := range references { // Look for things that are in the location loaded, //Note may need to filter out vendor at some point if strings.Contains(ref.URI, p.config.Location) { @@ -100,8 +100,8 @@ func processFile(path string, regex *regexp.Regexp, positionsChan chan<- protoco URI: fmt.Sprintf("file://%s", absPath), }, Position: protocol.Position{ - Line: float64(lineNumber), - Character: float64(loc[1]), + Line: uint32(lineNumber), + Character: uint32(loc[1]), }, } } @@ -190,7 +190,12 @@ func (p *genericServiceClient) GetAllSymbols(ctx context.Context, query string) fmt.Printf("Error rpc: %v", err) } for _, r := range res { - symbols = append(symbols, protocol.WorkspaceSymbol{Location: r}) + symbols = append(symbols, protocol.WorkspaceSymbol{ + Location: protocol.OrPLocation_workspace_symbol{ + Value: r, + }, + // Location: r + }) } } } @@ -223,13 +228,12 @@ func (p *genericServiceClient) initialization(ctx context.Context, log logr.Logg panic(1) } - params := &protocol.InitializeParams{ - //TODO(shawn-hurley): add ability to parse path to URI in a real supported way - RootURI: fmt.Sprintf("file://%v", abs), - Capabilities: protocol.ClientCapabilities{}, - ExtendedClientCapilities: map[string]interface{}{ - "classFileContentsSupport": true, - }, + //TODO(shawn-hurley): add ability to parse path to URI in a real supported way + params := &protocol.InitializeParams{} + params.RootURI = fmt.Sprintf("file://%v", abs) + params.Capabilities = protocol.ClientCapabilities{} + params.ExtendedClientCapilities = map[string]interface{}{ + "classFileContentsSupport": true, } var result protocol.InitializeResult diff --git a/lsp/protocol/README.md b/lsp/protocol/README.md new file mode 100644 index 00000000..8ca10c7e --- /dev/null +++ b/lsp/protocol/README.md @@ -0,0 +1,15 @@ +# Protocol generator tool + +Originally from: https://github.com/golang/tools/tree/master/gopls/internal/lsp/protocol +Commit id: If4c85191760baef916911130ca315773d2adda1f + +## How to use + +If there is an update to the LSP specification, navigate to the `protocol` directory and run `go generate`. This will generate all the types needed for the analyzer. You need to add `ExtendedClientCapilities map[string]interface{} `json:"extendedClientCapabilities"`` to XInitializeParams struct. Other than that, you should be good to go. + +## Changes + +- Commented out `writeclient()` and `writeserver()` in generate/main.go +- Commented out `"Or_WorkspaceFoldersServerCapabilities_changeNotifications": "string",` in generate/tables.go +- Changed `type DocumentURI string` to `type DocumentURI = string` in generate/output.go +- Need to add `ExtendedClientCapilities map[string]interface{} `json:"extendedClientCapabilities"`` to XInitializeParams struct. Need to figure out why needed. Can remove if not. diff --git a/lsp/protocol/codeactionkind.go b/lsp/protocol/codeactionkind.go new file mode 100644 index 00000000..9a95800f --- /dev/null +++ b/lsp/protocol/codeactionkind.go @@ -0,0 +1,11 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package protocol + +// Custom code actions that aren't explicitly stated in LSP +const ( + GoTest CodeActionKind = "goTest" + // TODO: Add GoGenerate, RegenerateCgo etc. +) diff --git a/lsp/protocol/doc.go b/lsp/protocol/doc.go index 2ffdf512..4a7f9043 100644 --- a/lsp/protocol/doc.go +++ b/lsp/protocol/doc.go @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package protocol contains the structs that map directly to the wire format -// of the "Language Server Protocol". +//go:generate go run ./generate + +// Package protocol contains the structs that map directly to the +// request and response messages of the Language Server Protocol. // // It is a literal transcription, with unmodified comments, and only the changes // required to make it go code. diff --git a/lsp/protocol/enums.go b/lsp/protocol/enums.go index 434808ee..82398e22 100644 --- a/lsp/protocol/enums.go +++ b/lsp/protocol/enums.go @@ -10,7 +10,6 @@ import ( var ( namesTextDocumentSyncKind [int(Incremental) + 1]string - namesInitializeError [int(UnknownProtocolVersion) + 1]string namesMessageType [int(Log) + 1]string namesFileChangeType [int(Deleted) + 1]string namesWatchKind [int(WatchDelete) + 1]string @@ -29,8 +28,6 @@ func init() { namesTextDocumentSyncKind[int(Full)] = "Full" namesTextDocumentSyncKind[int(Incremental)] = "Incremental" - namesInitializeError[int(UnknownProtocolVersion)] = "UnknownProtocolVersion" - namesMessageType[int(Error)] = "Error" namesMessageType[int(Warning)] = "Warning" namesMessageType[int(Info)] = "Info" @@ -149,14 +146,6 @@ func ParseTextDocumentSyncKind(s string) TextDocumentSyncKind { return TextDocumentSyncKind(parseEnum(s, namesTextDocumentSyncKind[:])) } -func (e InitializeError) Format(f fmt.State, c rune) { - formatEnum(f, c, int(e), namesInitializeError[:], "InitializeError") -} - -func ParseInitializeError(s string) InitializeError { - return InitializeError(parseEnum(s, namesInitializeError[:])) -} - func (e MessageType) Format(f fmt.State, c rune) { formatEnum(f, c, int(e), namesMessageType[:], "MessageType") } @@ -173,10 +162,6 @@ func ParseFileChangeType(s string) FileChangeType { return FileChangeType(parseEnum(s, namesFileChangeType[:])) } -func (e WatchKind) Format(f fmt.State, c rune) { - formatEnum(f, c, int(e), namesWatchKind[:], "WatchKind") -} - func ParseWatchKind(s string) WatchKind { return WatchKind(parseEnum(s, namesWatchKind[:])) } diff --git a/lsp/protocol/generate/README.md b/lsp/protocol/generate/README.md new file mode 100644 index 00000000..af5f101e --- /dev/null +++ b/lsp/protocol/generate/README.md @@ -0,0 +1,144 @@ +# LSP Support for gopls + +## The protocol + +The LSP protocol exchanges json-encoded messages between the client and the server. +(gopls is the server.) The messages are either Requests, which require Responses, or +Notifications, which generate no response. Each Request or Notification has a method name +such as "textDocument/hover" that indicates its meaning and determines which function in the server will handle it. +The protocol is described in a +[web page](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/), +in words, and in a json file (metaModel.json) available either linked towards the bottom of the +web page, or in the vscode-languageserver-node repository. This code uses the latter so the +exact version can be tied to a githash. By default, the command will download the `github.com/microsoft/vscode-languageserver-node` repository to a temporary directory. + +The specification has five sections + +1. Requests, which describe the Request and Response types for request methods (e.g., *textDocument/didChange*), +2. Notifications, which describe the Request types for notification methods, +3. Structures, which describe named struct-like types, +4. TypeAliases, which describe type aliases, +5. Enumerations, which describe named constants. + +Requests and Notifications are tagged with a Method (e.g., `"textDocument/hover"`). +The specification does not specify the names of the functions that handle the messages. These +names are specified by the `methodNames` map. Enumerations generate Go `const`s, but +in Typescript they are scoped to namespaces, while in Go they are scoped to a package, so the Go names +may need to be modified to avoid name collisions. (See the `disambiguate` map, and its use.) + +Finally, the specified types are Typescript types, which are quite different from Go types. + +### Optionality + +The specification can mark fields in structs as Optional. The client distinguishes between missing +fields and `null` fields in some cases. The Go translation for an optional type +should be making sure the field's value +can be `nil`, and adding the json tag `,omitempty`. The former condition would be satisfied by +adding `*` to the field's type if the type is not a reference type. + +### Types + +The specification uses a number of different types, only a few of which correspond directly to Go types. +The specification's types are "base", "reference", "map", "literal", "stringLiteral", "tuple", "and", "or". +The "base" types correspond directly to Go types, although some Go types needs to be chosen for `URI` and `DocumentUri`. (The "base" types`RegExp`, `BooleanLiteral`, `NumericLiteral` never occur.) + +"reference" types are the struct-like types in the Structures section of the specification. The given +names are suitable for Go to use, except the code needs to change names like `_Initialze` to `XInitialize` so +they are exported for json marshaling and unmarshaling. + +"map" types are just like Go. (The key type in all of them is `DocumentUri`.) + +"stringLiteral" types are types whose type name and value are a single string. The chosen Go equivalent +is to make the type `string` and the value a constant. (The alternative would be to generate a new +named type, which seemed redundant.) + +"literal" types are like Go anonymous structs, so they have to be given a name. (All instances +of the remaining types have to be given names. One approach is to construct the name from the components +of the type, but this leads to misleading punning, and is unstable if components are added. The other approach +is to construct the name from the context of the definition, that is, from the types it is defined within. +For instance `Lit__InitializeParams_clientInfo` is the "literal" type at the +`clientInfo` field in the `_InitializeParams` +struct. Although this choice is sensitive to the ordering of the components, the code uses this approach, +presuming that reordering components is an unlikely protocol change.) + +"tuple" types are generated as Go structs. (There is only one, with two `uint32` fields.) + +"and" types are Go structs with embedded type names. (There is only one, `And_Param_workspace_configuration`.) + +"or" types are the most complicated. There are a lot of them and there is no simple Go equivalent. +They are defined as structs with a single `Value interface{}` field and custom json marshaling +and unmarshaling code. Users can assign anything to `Value` but the type will be checked, and +correctly marshaled, by the custom marshaling code. The unmarshaling code checks types, so `Value` +will have one of the permitted types. (`nil` is always allowed.) There are about 40 "or" types that +have a single non-null component, and these are converted to the component type. + +## Processing + +The code parses the json specification file, and scans all the types. It assigns names, as described +above, to the types that are unnamed in the specification, and constructs Go equivalents as required. +(Most of this code is in typenames.go.) + +There are four output files. tsclient.go and tsserver.go contain the definition and implementation +of the `protocol.Client` and `protocol.Server` types and the code that dispatches on the Method +of the Request or Notification. tsjson.go contains the custom marshaling and unmarshaling code. +And tsprotocol.go contains the type and const definitions. + +### Accommodating gopls + +As the code generates output, mostly in generateoutput.go and main.go, +it makes adjustments so that no changes are required to the existing Go code. +(Organizing the computation this way makes the code's structure simpler, but results in +a lot of unused types.) +There are three major classes of these adjustments, and leftover special cases. + +The first major +adjustment is to change generated type names to the ones gopls expects. Some of these don't change the +semantics of the type, just the name. +But for historical reasons a lot of them replace "or" types by a single +component of the type. (Until fairly recently Go only saw or used only one of components.) +The `goplsType` map in tables.go controls this process. + +The second major adjustment is to the types of fields of structs, which is done using the +`renameProp` map in tables.go. + +The third major adjustment handles optionality, controlling `*` and `,omitempty` placement when +the default rules don't match what gopls is expecting. (The map is `goplsStar`, also in tables.go) +(If the intermediate components in expressions of the form `A.B.C.S` were optional, the code would need +a lot of useless checking for nils. Typescript has a language construct to avoid most checks.) + +Then there are some additional special cases. There are a few places with adjustments to avoid +recursive types. For instance `LSPArray` is `[]LSPAny`, but `LSPAny` is an "or" type including `LSPArray`. +The solution is to make `LSPAny` an `interface{}`. Another instance is `_InitializeParams.trace` +whose type is an "or" of 3 stringLiterals, which just becomes a `string`. + +### Checking + +`TestAll(t *testing.T)` checks that there are no unexpected fields in the json specification. + +While the code is executing, it checks that all the entries in the maps in tables.go are used. +It also checks that the entries in `renameProp` and `goplsStar` are not redundant. + +As a one-time check on the first release of this code, diff-ing the existing and generated tsclient.go +and tsserver.go code results in only whitespace and comment diffs. The existing and generated +tsprotocol.go differ in whitespace and comments, and in a substantial number of new type definitions +that the older, more heuristic, code did not generate. (And the unused type `_InitializeParams` differs +slightly between the new and the old, and is not worth fixing.) + +### Some history + +The original stub code was written by hand, but with the protocol under active development, that +couldn't last. The web page existed before the json specification, but it lagged the implementation +and was hard to process by machine. So the earlier version of the generating code was written in Typescript, and +used the Typescript compiler's API to parse the protocol code in the repository. +It then used a set of heuristics +to pick out the elements of the protocol, and another set of overlapping heuristics to create the Go code. +The output was functional, but idiosyncratic, and the code was fragile and barely maintainable. + +### The future + +Most of the adjustments using the maps in tables.go could be removed by making changes, mostly to names, +in the gopls code. Using more "or" types in gopls requires more elaborate, but stereotyped, changes. +But even without all the adjustments, making this its own module would face problems; a number of +dependencies would have to be factored out. And, it is fragile. The custom unmarshaling code knows what +types it expects. A design that return an 'any' on unexpected types would match the json +'ignore unexpected values' philosophy better, but the Go code would need extra checking. diff --git a/lsp/protocol/generate/generate.go b/lsp/protocol/generate/generate.go new file mode 100644 index 00000000..0496b7d0 --- /dev/null +++ b/lsp/protocol/generate/generate.go @@ -0,0 +1,121 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.19 +// +build go1.19 + +package main + +import ( + "bytes" + "fmt" + "log" + "strings" +) + +// a newType is a type that needs a name and a definition +// These are the various types that the json specification doesn't name +type newType struct { + name string + properties Properties // for struct/literal types + items []*Type // for other types ("and", "tuple") + line int + kind string // Or, And, Tuple, Lit, Map + typ *Type +} + +func generateDoc(out *bytes.Buffer, doc string) { + if doc == "" { + return + } + + if !strings.Contains(doc, "\n") { + fmt.Fprintf(out, "// %s\n", doc) + return + } + var list bool + for _, line := range strings.Split(doc, "\n") { + // Lists in metaModel.json start with a dash. + // To make a go doc list they have to be preceded + // by a blank line, and indented. + // (see type TextDccumentFilter in protocol.go) + if len(line) > 0 && line[0] == '-' { + if !list { + list = true + fmt.Fprintf(out, "//\n") + } + fmt.Fprintf(out, "// %s\n", line) + } else { + if len(line) == 0 { + list = false + } + fmt.Fprintf(out, "// %s\n", line) + } + } +} + +// decide if a property is optional, and if it needs a * +// return ",omitempty" if it is optional, and "*" if it needs a pointer +func propStar(name string, t NameType, gotype string) (string, string) { + var opt, star string + if t.Optional { + star = "*" + opt = ",omitempty" + } + if strings.HasPrefix(gotype, "[]") || strings.HasPrefix(gotype, "map[") { + star = "" // passed by reference, so no need for * + } else { + switch gotype { + case "bool", "uint32", "int32", "string", "interface{}": + star = "" // gopls compatibility if t.Optional + } + } + ostar, oopt := star, opt + if newStar, ok := goplsStar[prop{name, t.Name}]; ok { + switch newStar { + case nothing: + star, opt = "", "" + case wantStar: + star, opt = "*", "" + case wantOpt: + star, opt = "", ",omitempty" + case wantOptStar: + star, opt = "*", ",omitempty" + } + if star == ostar && opt == oopt { // no change + log.Printf("goplsStar[ {%q, %q} ](%d) useless %s/%s %s/%s", name, t.Name, t.Line, ostar, star, oopt, opt) + } + usedGoplsStar[prop{name, t.Name}] = true + } + + return opt, star +} + +func goName(s string) string { + // Go naming conventions + if strings.HasSuffix(s, "Id") { + s = s[:len(s)-len("Id")] + "ID" + } else if strings.HasSuffix(s, "Uri") { + s = s[:len(s)-3] + "URI" + } else if s == "uri" { + s = "URI" + } else if s == "id" { + s = "ID" + } + + // renames for temporary GOPLS compatibility + if news := goplsType[s]; news != "" { + usedGoplsType[s] = true + s = news + } + // Names beginning _ are not exported + if strings.HasPrefix(s, "_") { + s = strings.Replace(s, "_", "X", 1) + } + if s != "string" { // base types are unchanged (textDocuemnt/diagnostic) + // Title is deprecated, but a) s is only one word, b) replacement is too heavy-weight + s = strings.Title(s) + } + return s +} diff --git a/lsp/protocol/generate/main.go b/lsp/protocol/generate/main.go new file mode 100644 index 00000000..209b1c56 --- /dev/null +++ b/lsp/protocol/generate/main.go @@ -0,0 +1,403 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.19 +// +build go1.19 + +// The generate command generates Go declarations from VSCode's +// description of the Language Server Protocol. +// +// To run it, type 'go generate' in the parent (protocol) directory. +package main + +// see https://github.com/golang/go/issues/61217 for discussion of an issue + +import ( + "bytes" + "encoding/json" + "flag" + "fmt" + "go/format" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + "time" +) + +const vscodeRepo = "https://github.com/microsoft/vscode-languageserver-node" + +// lspGitRef names a branch or tag in vscodeRepo. +// It implicitly determines the protocol version of the LSP used by gopls. +// For example, tag release/protocol/3.17.3 of the repo defines protocol version 3.17.0. +// (Point releases are reflected in the git tag version even when they are cosmetic +// and don't change the protocol.) +// var lspGitRef = "release/protocol/3.17.4-next.3" +var lspGitRef = "main" + +var ( + repodir = flag.String("d", "", "directory containing clone of "+vscodeRepo) + outputdir = flag.String("o", ".", "output directory") + // PJW: not for real code + cmpdir = flag.String("c", "", "directory of earlier code") + doboth = flag.String("b", "", "generate and compare") + lineNumbers = flag.Bool("l", false, "add line numbers to generated output") +) + +func main() { + log.SetFlags(log.Lshortfile) // log file name and line number, not time + flag.Parse() + + processinline() +} + +func processinline() { + // A local repository may be specified during debugging. + // The default behavior is to download the canonical version. + if *repodir == "" { + // tmpdir, err := os.MkdirTemp("", "") + tmpdir := time.Now().String() + err := os.Mkdir(tmpdir, 0755) + if err != nil { + log.Fatal(err) + } + // defer os.RemoveAll(tmpdir) // ignore error + + // Clone the repository. + cmd := exec.Command("git", "clone", "--quiet", "--depth=1", "-c", "advice.detachedHead=false", vscodeRepo, "--branch="+lspGitRef, "--single-branch", tmpdir) + cmd.Stdout = os.Stderr + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + log.Fatal(err) + } + + *repodir = tmpdir + } else { + lspGitRef = fmt.Sprintf("(not git, local dir %s)", *repodir) + } + + model := parse(filepath.Join(*repodir, "protocol/metaModel.json")) + + findTypeNames(model) + generateOutput(model) + + fileHdr = fileHeader(model) + + // write the files + // writeclient() + // writeserver() + writeprotocol() + writejsons() + + checkTables() +} + +// common file header for output files +var fileHdr string + +func writeclient() { + out := new(bytes.Buffer) + fmt.Fprintln(out, fileHdr) + out.WriteString( + `import ( + "context" + "encoding/json" + + "golang.org/x/tools/internal/jsonrpc2" +) +`) + out.WriteString("type Client interface {\n") + for _, k := range cdecls.keys() { + out.WriteString(cdecls[k]) + } + out.WriteString("}\n\n") + out.WriteString("func clientDispatch(ctx context.Context, client Client, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) {\n") + out.WriteString("\tswitch r.Method() {\n") + for _, k := range ccases.keys() { + out.WriteString(ccases[k]) + } + out.WriteString(("\tdefault:\n\t\treturn false, nil\n\t}\n}\n\n")) + for _, k := range cfuncs.keys() { + out.WriteString(cfuncs[k]) + } + + x, err := format.Source(out.Bytes()) + if err != nil { + os.WriteFile("/tmp/a.go", out.Bytes(), 0644) + log.Fatalf("tsclient.go: %v", err) + } + + if err := os.WriteFile(filepath.Join(*outputdir, "tsclient.go"), x, 0644); err != nil { + log.Fatalf("%v writing tsclient.go", err) + } +} + +func writeserver() { + out := new(bytes.Buffer) + fmt.Fprintln(out, fileHdr) + out.WriteString( + `import ( + "context" + "encoding/json" + + "golang.org/x/tools/internal/jsonrpc2" +) +`) + out.WriteString("type Server interface {\n") + for _, k := range sdecls.keys() { + out.WriteString(sdecls[k]) + } + out.WriteString(` NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) +} + +func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) { + switch r.Method() { +`) + for _, k := range scases.keys() { + out.WriteString(scases[k]) + } + out.WriteString(("\tdefault:\n\t\treturn false, nil\n\t}\n}\n\n")) + for _, k := range sfuncs.keys() { + out.WriteString(sfuncs[k]) + } + out.WriteString(`func (s *serverDispatcher) NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) { + var result interface{} + if err := s.sender.Call(ctx, method, params, &result); err != nil { + return nil, err + } + return result, nil +} +`) + + x, err := format.Source(out.Bytes()) + if err != nil { + os.WriteFile("/tmp/a.go", out.Bytes(), 0644) + log.Fatalf("tsserver.go: %v", err) + } + + if err := os.WriteFile(filepath.Join(*outputdir, "tsserver.go"), x, 0644); err != nil { + log.Fatalf("%v writing tsserver.go", err) + } +} + +func writeprotocol() { + out := new(bytes.Buffer) + fmt.Fprintln(out, fileHdr) + out.WriteString("import \"encoding/json\"\n\n") + + // The followiing are unneeded, but make the new code a superset of the old + hack := func(newer, existing string) { + if _, ok := types[existing]; !ok { + log.Fatalf("types[%q] not found", existing) + } + types[newer] = strings.Replace(types[existing], existing, newer, 1) + } + hack("ConfigurationParams", "ParamConfiguration") + hack("InitializeParams", "ParamInitialize") + hack("PreviousResultId", "PreviousResultID") + hack("WorkspaceFoldersServerCapabilities", "WorkspaceFolders5Gn") + hack("_InitializeParams", "XInitializeParams") + + h := " // added by konveyor/analyzer-lsp. Why is this needed? - Jonah\n ExtendedClientCapilities map[string]interface{} `json:\"extendedClientCapabilities\"`\n}" + s := types["XInitializeParams"] + i := strings.LastIndex(s, "}") + s = s[:i] + h + s[i+len("}"):] + + types["XInitializeParams"] = s + fmt.Printf("%s", types["XInitializeParams"]) + + // and some aliases to make the new code contain the old + types["PrepareRename2Gn"] = "type PrepareRename2Gn = Msg_PrepareRename2Gn // (alias) line 13927\n" + types["PrepareRenameResult"] = "type PrepareRenameResult = Msg_PrepareRename2Gn // (alias) line 13927\n" + for _, k := range types.keys() { + if k == "WatchKind" { + types[k] = "type WatchKind = uint32 // line 13505" // strict gopls compatibility needs the '=' + } + out.WriteString(types[k]) + } + + out.WriteString("\nconst (\n") + for _, k := range consts.keys() { + out.WriteString(consts[k]) + } + out.WriteString(")\n\n") + x, err := format.Source(out.Bytes()) + if err != nil { + os.WriteFile("/tmp/a.go", out.Bytes(), 0644) + log.Fatalf("tsprotocol.go: %v", err) + } + if err := os.WriteFile(filepath.Join(*outputdir, "tsprotocol.go"), x, 0644); err != nil { + log.Fatalf("%v writing tsprotocol.go", err) + } +} + +func writejsons() { + out := new(bytes.Buffer) + fmt.Fprintln(out, fileHdr) + out.WriteString("import \"encoding/json\"\n\n") + out.WriteString("import \"fmt\"\n") + + out.WriteString(` +// UnmarshalError indicates that a JSON value did not conform to +// one of the expected cases of an LSP union type. +type UnmarshalError struct { + msg string +} + +func (e UnmarshalError) Error() string { + return e.msg +} +`) + + for _, k := range jsons.keys() { + out.WriteString(jsons[k]) + } + x, err := format.Source(out.Bytes()) + if err != nil { + os.WriteFile("/tmp/a.go", out.Bytes(), 0644) + log.Fatalf("tsjson.go: %v", err) + } + if err := os.WriteFile(filepath.Join(*outputdir, "tsjson.go"), x, 0644); err != nil { + log.Fatalf("%v writing tsjson.go", err) + } +} + +// create the common file header for the output files +func fileHeader(model Model) string { + fname := filepath.Join(*repodir, ".git", "HEAD") + buf, err := os.ReadFile(fname) + if err != nil { + log.Fatal(err) + } + buf = bytes.TrimSpace(buf) + var githash string + if len(buf) == 40 { + githash = string(buf[:40]) + } else if bytes.HasPrefix(buf, []byte("ref: ")) { + fname = filepath.Join(*repodir, ".git", string(buf[5:])) + buf, err = os.ReadFile(fname) + if err != nil { + log.Fatal(err) + } + githash = string(buf[:40]) + } else { + log.Fatalf("githash cannot be recovered from %s", fname) + } + + format := `// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated for LSP. DO NOT EDIT. + +package protocol + +// Code generated from %[1]s at ref %[2]s (hash %[3]s). +// %[4]s/blob/%[2]s/%[1]s +// LSP metaData.version = %[5]s. + +` + return fmt.Sprintf(format, + "protocol/metaModel.json", // 1 + lspGitRef, // 2 + githash, // 3 + vscodeRepo, // 4 + model.Version.Version) // 5 +} + +func parse(fname string) Model { + buf, err := os.ReadFile(fname) + if err != nil { + log.Fatal(err) + } + buf = addLineNumbers(buf) + var model Model + if err := json.Unmarshal(buf, &model); err != nil { + log.Fatal(err) + } + return model +} + +// Type.Value has to be treated specially for literals and maps +func (t *Type) UnmarshalJSON(data []byte) error { + // First unmarshal only the unambiguous fields. + var x struct { + Kind string `json:"kind"` + Items []*Type `json:"items"` + Element *Type `json:"element"` + Name string `json:"name"` + Key *Type `json:"key"` + Value any `json:"value"` + Line int `json:"line"` + } + if err := json.Unmarshal(data, &x); err != nil { + return err + } + *t = Type{ + Kind: x.Kind, + Items: x.Items, + Element: x.Element, + Name: x.Name, + Value: x.Value, + Line: x.Line, + } + + // Then unmarshal the 'value' field based on the kind. + // This depends on Unmarshal ignoring fields it doesn't know about. + switch x.Kind { + case "map": + var x struct { + Key *Type `json:"key"` + Value *Type `json:"value"` + } + if err := json.Unmarshal(data, &x); err != nil { + return fmt.Errorf("Type.kind=map: %v", err) + } + t.Key = x.Key + t.Value = x.Value + + case "literal": + var z struct { + Value ParseLiteral `json:"value"` + } + + if err := json.Unmarshal(data, &z); err != nil { + return fmt.Errorf("Type.kind=literal: %v", err) + } + t.Value = z.Value + + case "base", "reference", "array", "and", "or", "tuple", + "stringLiteral": + // no-op. never seen integerLiteral or booleanLiteral. + + default: + return fmt.Errorf("cannot decode Type.kind %q: %s", x.Kind, data) + } + return nil +} + +// which table entries were not used +func checkTables() { + for k := range disambiguate { + if !usedDisambiguate[k] { + log.Printf("disambiguate[%v] unused", k) + } + } + for k := range renameProp { + if !usedRenameProp[k] { + log.Printf("renameProp {%q, %q} unused", k[0], k[1]) + } + } + for k := range goplsStar { + if !usedGoplsStar[k] { + log.Printf("goplsStar {%q, %q} unused", k[0], k[1]) + } + } + for k := range goplsType { + if !usedGoplsType[k] { + log.Printf("unused goplsType[%q]->%s", k, goplsType[k]) + } + } +} diff --git a/lsp/protocol/generate/main_test.go b/lsp/protocol/generate/main_test.go new file mode 100644 index 00000000..5f336690 --- /dev/null +++ b/lsp/protocol/generate/main_test.go @@ -0,0 +1,119 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.19 +// +build go1.19 + +package main + +import ( + "encoding/json" + "fmt" + "log" + "os" + "testing" +) + +// These tests require the result of +//"git clone https://github.com/microsoft/vscode-languageserver-node" in the HOME directory + +// this is not a test, but a way to get code coverage, +// (in vscode, just run the test with "go.coverOnSingleTest": true) +func TestAll(t *testing.T) { + t.Skip("needs vscode-languageserver-node repository") + *lineNumbers = true + log.SetFlags(log.Lshortfile) + main() +} + +// check that the parsed file includes all the information +// from the json file. This test will fail if the spec +// introduces new fields. (one can test this test by +// commenting out the version field in Model.) +func TestParseContents(t *testing.T) { + t.Skip("needs vscode-languageserver-node repository") + log.SetFlags(log.Lshortfile) + + // compute our parse of the specification + dir := os.Getenv("HOME") + "/vscode-languageserver-node" + fname := dir + "/protocol/metaModel.json" + v := parse(fname) + out, err := json.Marshal(v) + if err != nil { + t.Fatal(err) + } + var our interface{} + if err := json.Unmarshal(out, &our); err != nil { + t.Fatal(err) + } + + // process the json file + buf, err := os.ReadFile(fname) + if err != nil { + t.Fatalf("could not read metaModel.json: %v", err) + } + var raw interface{} + if err := json.Unmarshal(buf, &raw); err != nil { + t.Fatal(err) + } + + // convert to strings showing the fields + them := flatten(raw) + us := flatten(our) + + // everything in them should be in us + lesser := make(sortedMap[bool]) + for _, s := range them { + lesser[s] = true + } + greater := make(sortedMap[bool]) // set of fields we have + for _, s := range us { + greater[s] = true + } + for _, k := range lesser.keys() { // set if fields they have + if !greater[k] { + t.Errorf("missing %s", k) + } + } +} + +// flatten(nil) = "nil" +// flatten(v string) = fmt.Sprintf("%q", v) +// flatten(v float64)= fmt.Sprintf("%g", v) +// flatten(v bool) = fmt.Sprintf("%v", v) +// flatten(v []any) = []string{"[0]"flatten(v[0]), "[1]"flatten(v[1]), ...} +// flatten(v map[string]any) = {"key1": flatten(v["key1"]), "key2": flatten(v["key2"]), ...} +func flatten(x any) []string { + switch v := x.(type) { + case nil: + return []string{"nil"} + case string: + return []string{fmt.Sprintf("%q", v)} + case float64: + return []string{fmt.Sprintf("%g", v)} + case bool: + return []string{fmt.Sprintf("%v", v)} + case []any: + var ans []string + for i, x := range v { + idx := fmt.Sprintf("[%.3d]", i) + for _, s := range flatten(x) { + ans = append(ans, idx+s) + } + } + return ans + case map[string]any: + var ans []string + for k, x := range v { + idx := fmt.Sprintf("%q:", k) + for _, s := range flatten(x) { + ans = append(ans, idx+s) + } + } + return ans + default: + log.Fatalf("unexpected type %T", x) + return nil + } +} diff --git a/lsp/protocol/generate/output.go b/lsp/protocol/generate/output.go new file mode 100644 index 00000000..0041ebbf --- /dev/null +++ b/lsp/protocol/generate/output.go @@ -0,0 +1,427 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.19 +// +build go1.19 + +package main + +import ( + "bytes" + "fmt" + "log" + "sort" + "strings" +) + +var ( + // tsclient.go has 3 sections + cdecls = make(sortedMap[string]) + ccases = make(sortedMap[string]) + cfuncs = make(sortedMap[string]) + // tsserver.go has 3 sections + sdecls = make(sortedMap[string]) + scases = make(sortedMap[string]) + sfuncs = make(sortedMap[string]) + // tsprotocol.go has 2 sections + types = make(sortedMap[string]) + consts = make(sortedMap[string]) + // tsjson has 1 section + jsons = make(sortedMap[string]) +) + +func generateOutput(model Model) { + for _, r := range model.Requests { + genDecl(r.Method, r.Params, r.Result, r.Direction) + genCase(r.Method, r.Params, r.Result, r.Direction) + genFunc(r.Method, r.Params, r.Result, r.Direction, false) + } + for _, n := range model.Notifications { + if n.Method == "$/cancelRequest" { + continue // handled internally by jsonrpc2 + } + genDecl(n.Method, n.Params, nil, n.Direction) + genCase(n.Method, n.Params, nil, n.Direction) + genFunc(n.Method, n.Params, nil, n.Direction, true) + } + genStructs(model) + genAliases(model) + genGenTypes() // generate the unnamed types + genConsts(model) + genMarshal() +} + +func genDecl(method string, param, result *Type, dir string) { + fname := methodName(method) + p := "" + if notNil(param) { + p = ", *" + goplsName(param) + } + ret := "error" + if notNil(result) { + tp := goplsName(result) + if !hasNilValue(tp) { + tp = "*" + tp + } + ret = fmt.Sprintf("(%s, error)", tp) + } + // special gopls compatibility case (PJW: still needed?) + switch method { + case "workspace/configuration": + // was And_Param_workspace_configuration, but the type substitution doesn't work, + // as ParamConfiguration is embedded in And_Param_workspace_configuration + p = ", *ParamConfiguration" + ret = "([]LSPAny, error)" + } + msg := fmt.Sprintf("\t%s(context.Context%s) %s // %s\n", fname, p, ret, method) + switch dir { + case "clientToServer": + sdecls[method] = msg + case "serverToClient": + cdecls[method] = msg + case "both": + sdecls[method] = msg + cdecls[method] = msg + default: + log.Fatalf("impossible direction %q", dir) + } +} + +func genCase(method string, param, result *Type, dir string) { + out := new(bytes.Buffer) + fmt.Fprintf(out, "\tcase %q:\n", method) + var p string + fname := methodName(method) + if notNil(param) { + nm := goplsName(param) + if method == "workspace/configuration" { // gopls compatibility + // was And_Param_workspace_configuration, which contains ParamConfiguration + // so renaming the type leads to circular definitions + nm = "ParamConfiguration" // gopls compatibility + } + fmt.Fprintf(out, "\t\tvar params %s\n", nm) + fmt.Fprintf(out, "\t\tif err := json.Unmarshal(r.Params(), ¶ms); err != nil {\n") + fmt.Fprintf(out, "\t\t\treturn true, sendParseError(ctx, reply, err)\n\t\t}\n") + p = ", ¶ms" + } + if notNil(result) { + fmt.Fprintf(out, "\t\tresp, err := %%s.%s(ctx%s)\n", fname, p) + out.WriteString("\t\tif err != nil {\n") + out.WriteString("\t\t\treturn true, reply(ctx, nil, err)\n") + out.WriteString("\t\t}\n") + out.WriteString("\t\treturn true, reply(ctx, resp, nil)\n") + } else { + fmt.Fprintf(out, "\t\terr := %%s.%s(ctx%s)\n", fname, p) + out.WriteString("\t\treturn true, reply(ctx, nil, err)\n") + } + msg := out.String() + switch dir { + case "clientToServer": + scases[method] = fmt.Sprintf(msg, "server") + case "serverToClient": + ccases[method] = fmt.Sprintf(msg, "client") + case "both": + scases[method] = fmt.Sprintf(msg, "server") + ccases[method] = fmt.Sprintf(msg, "client") + default: + log.Fatalf("impossible direction %q", dir) + } +} + +func genFunc(method string, param, result *Type, dir string, isnotify bool) { + out := new(bytes.Buffer) + var p, r string + var goResult string + if notNil(param) { + p = ", params *" + goplsName(param) + } + if notNil(result) { + goResult = goplsName(result) + if !hasNilValue(goResult) { + goResult = "*" + goResult + } + r = fmt.Sprintf("(%s, error)", goResult) + } else { + r = "error" + } + // special gopls compatibility case + switch method { + case "workspace/configuration": + // was And_Param_workspace_configuration, but the type substitution doesn't work, + // as ParamConfiguration is embedded in And_Param_workspace_configuration + p = ", params *ParamConfiguration" + r = "([]LSPAny, error)" + goResult = "[]LSPAny" + } + fname := methodName(method) + fmt.Fprintf(out, "func (s *%%sDispatcher) %s(ctx context.Context%s) %s {\n", + fname, p, r) + + if !notNil(result) { + if isnotify { + if notNil(param) { + fmt.Fprintf(out, "\treturn s.sender.Notify(ctx, %q, params)\n", method) + } else { + fmt.Fprintf(out, "\treturn s.sender.Notify(ctx, %q, nil)\n", method) + } + } else { + if notNil(param) { + fmt.Fprintf(out, "\treturn s.sender.Call(ctx, %q, params, nil)\n", method) + } else { + fmt.Fprintf(out, "\treturn s.sender.Call(ctx, %q, nil, nil)\n", method) + } + } + } else { + fmt.Fprintf(out, "\tvar result %s\n", goResult) + if isnotify { + if notNil(param) { + fmt.Fprintf(out, "\ts.sender.Notify(ctx, %q, params)\n", method) + } else { + fmt.Fprintf(out, "\t\tif err := s.sender.Notify(ctx, %q, nil); err != nil {\n", method) + } + } else { + if notNil(param) { + fmt.Fprintf(out, "\t\tif err := s.sender.Call(ctx, %q, params, &result); err != nil {\n", method) + } else { + fmt.Fprintf(out, "\t\tif err := s.sender.Call(ctx, %q, nil, &result); err != nil {\n", method) + } + } + fmt.Fprintf(out, "\t\treturn nil, err\n\t}\n\treturn result, nil\n") + } + out.WriteString("}\n") + msg := out.String() + switch dir { + case "clientToServer": + sfuncs[method] = fmt.Sprintf(msg, "server") + case "serverToClient": + cfuncs[method] = fmt.Sprintf(msg, "client") + case "both": + sfuncs[method] = fmt.Sprintf(msg, "server") + cfuncs[method] = fmt.Sprintf(msg, "client") + default: + log.Fatalf("impossible direction %q", dir) + } +} + +func genStructs(model Model) { + structures := make(map[string]*Structure) // for expanding Extends + for _, s := range model.Structures { + structures[s.Name] = s + } + for _, s := range model.Structures { + out := new(bytes.Buffer) + generateDoc(out, s.Documentation) + nm := goName(s.Name) + if nm == "string" { // an unacceptable strut name + // a weird case, and needed only so the generated code contains the old gopls code + nm = "DocumentDiagnosticParams" + } + fmt.Fprintf(out, "type %s struct {%s\n", nm, linex(s.Line)) + // for gpls compatibilitye, embed most extensions, but expand the rest some day + props := append([]NameType{}, s.Properties...) + if s.Name == "SymbolInformation" { // but expand this one + for _, ex := range s.Extends { + fmt.Fprintf(out, "\t// extends %s\n", ex.Name) + props = append(props, structures[ex.Name].Properties...) + } + genProps(out, props, nm) + } else { + genProps(out, props, nm) + for _, ex := range s.Extends { + fmt.Fprintf(out, "\t%s\n", goName(ex.Name)) + } + } + for _, ex := range s.Mixins { + fmt.Fprintf(out, "\t%s\n", goName(ex.Name)) + } + out.WriteString("}\n") + types[nm] = out.String() + } + // base types + types["DocumentURI"] = "type DocumentURI = string\n" + types["URI"] = "type URI = string\n" + + types["LSPAny"] = "type LSPAny = interface{}\n" + // A special case, the only previously existing Or type + types["DocumentDiagnosticReport"] = "type DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias) line 13909\n" + +} + +func genProps(out *bytes.Buffer, props []NameType, name string) { + for _, p := range props { + tp := goplsName(p.Type) + if newNm, ok := renameProp[prop{name, p.Name}]; ok { + usedRenameProp[prop{name, p.Name}] = true + if tp == newNm { + log.Printf("renameProp useless {%q, %q} for %s", name, p.Name, tp) + } + tp = newNm + } + // it's a pointer if it is optional, or for gopls compatibility + opt, star := propStar(name, p, tp) + json := fmt.Sprintf(" `json:\"%s%s\"`", p.Name, opt) + generateDoc(out, p.Documentation) + fmt.Fprintf(out, "\t%s %s%s %s\n", goName(p.Name), star, tp, json) + } +} + +func genAliases(model Model) { + for _, ta := range model.TypeAliases { + out := new(bytes.Buffer) + generateDoc(out, ta.Documentation) + nm := goName(ta.Name) + if nm != ta.Name { + continue // renamed the type, e.g., "DocumentDiagnosticReport", an or-type to "string" + } + tp := goplsName(ta.Type) + fmt.Fprintf(out, "type %s = %s // (alias) line %d\n", nm, tp, ta.Line) + types[nm] = out.String() + } +} + +func genGenTypes() { + for _, nt := range genTypes { + out := new(bytes.Buffer) + nm := goplsName(nt.typ) + switch nt.kind { + case "literal": + fmt.Fprintf(out, "// created for Literal (%s)\n", nt.name) + fmt.Fprintf(out, "type %s struct {%s\n", nm, linex(nt.line+1)) + genProps(out, nt.properties, nt.name) // systematic name, not gopls name; is this a good choice? + case "or": + if !strings.HasPrefix(nm, "Or") { + // It was replaced by a narrower type defined elsewhere + continue + } + names := []string{} + for _, t := range nt.items { + if notNil(t) { + names = append(names, goplsName(t)) + } + } + sort.Strings(names) + fmt.Fprintf(out, "// created for Or %v\n", names) + fmt.Fprintf(out, "type %s struct {%s\n", nm, linex(nt.line+1)) + fmt.Fprintf(out, "\tValue interface{} `json:\"value\"`\n") + case "and": + fmt.Fprintf(out, "// created for And\n") + fmt.Fprintf(out, "type %s struct {%s\n", nm, linex(nt.line+1)) + for _, x := range nt.items { + nm := goplsName(x) + fmt.Fprintf(out, "\t%s\n", nm) + } + case "tuple": // there's only this one + nt.name = "UIntCommaUInt" + fmt.Fprintf(out, "//created for Tuple\ntype %s struct {%s\n", nm, linex(nt.line+1)) + fmt.Fprintf(out, "\tFld0 uint32 `json:\"fld0\"`\n") + fmt.Fprintf(out, "\tFld1 uint32 `json:\"fld1\"`\n") + default: + log.Fatalf("%s not handled", nt.kind) + } + out.WriteString("}\n") + types[nm] = out.String() + } +} +func genConsts(model Model) { + for _, e := range model.Enumerations { + out := new(bytes.Buffer) + generateDoc(out, e.Documentation) + tp := goplsName(e.Type) + nm := goName(e.Name) + fmt.Fprintf(out, "type %s %s%s\n", nm, tp, linex(e.Line)) + types[nm] = out.String() + vals := new(bytes.Buffer) + generateDoc(vals, e.Documentation) + for _, v := range e.Values { + generateDoc(vals, v.Documentation) + nm := goName(v.Name) + more, ok := disambiguate[e.Name] + if ok { + usedDisambiguate[e.Name] = true + nm = more.prefix + nm + more.suffix + nm = goName(nm) // stringType + } + var val string + switch v := v.Value.(type) { + case string: + val = fmt.Sprintf("%q", v) + case float64: + val = fmt.Sprintf("%d", int(v)) + default: + log.Fatalf("impossible type %T", v) + } + fmt.Fprintf(vals, "\t%s %s = %s%s\n", nm, e.Name, val, linex(v.Line)) + } + consts[nm] = vals.String() + } +} +func genMarshal() { + for _, nt := range genTypes { + nm := goplsName(nt.typ) + if !strings.HasPrefix(nm, "Or") { + continue + } + names := []string{} + for _, t := range nt.items { + if notNil(t) { + names = append(names, goplsName(t)) + } + } + sort.Strings(names) + var buf bytes.Buffer + fmt.Fprintf(&buf, "// from line %d\n", nt.line) + fmt.Fprintf(&buf, "func (t %s) MarshalJSON() ([]byte, error) {\n", nm) + buf.WriteString("\tswitch x := t.Value.(type){\n") + for _, nmx := range names { + fmt.Fprintf(&buf, "\tcase %s:\n", nmx) + fmt.Fprintf(&buf, "\t\treturn json.Marshal(x)\n") + } + buf.WriteString("\tcase nil:\n\t\treturn []byte(\"null\"), nil\n\t}\n") + fmt.Fprintf(&buf, "\treturn nil, fmt.Errorf(\"type %%T not one of %v\", t)\n", names) + buf.WriteString("}\n\n") + + fmt.Fprintf(&buf, "func (t *%s) UnmarshalJSON(x []byte) error {\n", nm) + buf.WriteString("\tif string(x) == \"null\" {\n\t\tt.Value = nil\n\t\t\treturn nil\n\t}\n") + for i, nmx := range names { + fmt.Fprintf(&buf, "\tvar h%d %s\n", i, nmx) + fmt.Fprintf(&buf, "\tif err := json.Unmarshal(x, &h%d); err == nil {\n\t\tt.Value = h%d\n\t\t\treturn nil\n\t\t}\n", i, i) + } + fmt.Fprintf(&buf, "return &UnmarshalError{\"unmarshal failed to match one of %v\"}", names) + buf.WriteString("}\n\n") + jsons[nm] = buf.String() + } +} + +func linex(n int) string { + if *lineNumbers { + return fmt.Sprintf(" // line %d", n) + } + return "" +} + +func goplsName(t *Type) string { + nm := typeNames[t] + // translate systematic name to gopls name + if newNm, ok := goplsType[nm]; ok { + usedGoplsType[nm] = true + nm = newNm + } + return nm +} + +func notNil(t *Type) bool { // shutdwon is the special case that needs this + return t != nil && (t.Kind != "base" || t.Name != "null") +} + +func hasNilValue(t string) bool { + // this may be unreliable, and need a supplementary table + if strings.HasPrefix(t, "[]") || strings.HasPrefix(t, "*") { + return true + } + if t == "interface{}" || t == "any" { + return true + } + // that's all the cases that occur currently + return false +} diff --git a/lsp/protocol/generate/tables.go b/lsp/protocol/generate/tables.go new file mode 100644 index 00000000..0f161524 --- /dev/null +++ b/lsp/protocol/generate/tables.go @@ -0,0 +1,341 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.19 +// +build go1.19 + +package main + +import "log" + +// prop combines the name of a property with the name of the structure it is in. +type prop [2]string + +const ( + nothing = iota + wantStar + wantOpt + wantOptStar +) + +// goplsStar records the optionality of each field in the protocol. +// The comments are vague hints as to why removing the line is not trivial. +// A.B.C.D means that one of B or C would change to a pointer +// so a test or initialization would be needed +var goplsStar = map[prop]int{ + // {"ClientCapabilities", "textDocument"}: wantOpt, // A.B.C.D at fake/editor.go:255 + // {"ClientCapabilities", "window"}: wantOpt, // regtest failures + // {"ClientCapabilities", "workspace"}: wantOpt, // regtest failures + // {"CodeAction", "kind"}: wantOpt, // A.B.C.D + + // {"CodeActionClientCapabilities", "codeActionLiteralSupport"}: wantOpt, // regtest failures + + // {"CompletionClientCapabilities", "completionItem"}: wantOpt, // A.B.C.D + // {"CompletionClientCapabilities", "insertTextMode"}: wantOpt, // A.B.C.D + // {"CompletionItem", "kind"}: wantOpt, // need temporary variables + // {"CompletionParams", "context"}: wantOpt, // needs nil checks + + // {"Diagnostic", "severity"}: wantOpt, // nil checks or more careful thought + // {"DidSaveTextDocumentParams", "text"}: wantOptStar, // capabilities_test.go:112 logic + // {"DocumentHighlight", "kind"}: wantOpt, // need temporary variables + // {"Hover", "range"}: wantOpt, // complex expressions + // {"InlayHint", "kind"}: wantOpt, // temporary variables + + // {"Lit_CompletionClientCapabilities_completionItem", "tagSupport"}: nothing, // A.B.C. + // {"Lit_SemanticTokensClientCapabilities_requests", "full"}: nothing, // A.B.C.D + // {"Lit_SemanticTokensClientCapabilities_requests", "range"}: nothing, // A.B.C.D + // {"Lit_SemanticTokensClientCapabilities_requests_full_Item1", "delta"}: nothing, // A.B.C.D + // {"Lit_SemanticTokensOptions_full_Item1", "delta"}: nothing, // A.B.C. + + // {"Lit_TextDocumentContentChangeEvent_Item0", "range"}: wantStar, // == nil test + + // {"TextDocumentClientCapabilities", "codeAction"}: wantOpt, // A.B.C.D + // {"TextDocumentClientCapabilities", "completion"}: wantOpt, // A.B.C.D + // {"TextDocumentClientCapabilities", "documentSymbol"}: wantOpt, // A.B.C.D + // {"TextDocumentClientCapabilities", "publishDiagnostics"}: wantOpt, //A.B.C.D + // {"TextDocumentClientCapabilities", "semanticTokens"}: wantOpt, // A.B.C.D + // {"TextDocumentSyncOptions", "change"}: wantOpt, // &constant + // {"WorkDoneProgressParams", "workDoneToken"}: wantOpt, // regtest + // {"WorkspaceClientCapabilities", "didChangeConfiguration"}: wantOpt, // A.B.C.D + // {"WorkspaceClientCapabilities", "didChangeWatchedFiles"}: wantOpt, // A.B.C.D +} + +// keep track of which entries in goplsStar are used +var usedGoplsStar = make(map[prop]bool) + +// For gopls compatibility, use a different, typically more restrictive, type for some fields. +var renameProp = map[prop]string{ + {"CancelParams", "id"}: "interface{}", + {"Command", "arguments"}: "[]json.RawMessage", + {"CompletionItem", "textEdit"}: "TextEdit", + {"Diagnostic", "code"}: "interface{}", + {"Diagnostic", "data"}: "json.RawMessage", // delay unmarshalling quickfixes + + {"DocumentDiagnosticReportPartialResult", "relatedDocuments"}: "map[DocumentURI]interface{}", + + {"ExecuteCommandParams", "arguments"}: "[]json.RawMessage", + {"FoldingRange", "kind"}: "string", + {"Hover", "contents"}: "MarkupContent", + {"InlayHint", "label"}: "[]InlayHintLabelPart", + + {"RelatedFullDocumentDiagnosticReport", "relatedDocuments"}: "map[DocumentURI]interface{}", + {"RelatedUnchangedDocumentDiagnosticReport", "relatedDocuments"}: "map[DocumentURI]interface{}", + + // PJW: this one is tricky. + {"ServerCapabilities", "codeActionProvider"}: "interface{}", + + {"ServerCapabilities", "inlayHintProvider"}: "interface{}", + // slightly tricky + {"ServerCapabilities", "renameProvider"}: "interface{}", + // slightly tricky + {"ServerCapabilities", "semanticTokensProvider"}: "interface{}", + // slightly tricky + {"ServerCapabilities", "textDocumentSync"}: "interface{}", + {"TextDocumentEdit", "edits"}: "[]TextEdit", + {"TextDocumentSyncOptions", "save"}: "SaveOptions", + {"WorkspaceEdit", "documentChanges"}: "[]DocumentChanges", +} + +// which entries of renameProp were used +var usedRenameProp = make(map[prop]bool) + +type adjust struct { + prefix, suffix string +} + +// disambiguate specifies prefixes or suffixes to add to all values of +// some enum types to avoid name conflicts +var disambiguate = map[string]adjust{ + "CodeActionTriggerKind": {"CodeAction", ""}, + "CompletionItemKind": {"", "Completion"}, + "CompletionItemTag": {"Compl", ""}, + "DiagnosticSeverity": {"Severity", ""}, + "DocumentDiagnosticReportKind": {"Diagnostic", ""}, + "FileOperationPatternKind": {"", "Pattern"}, + "InlineCompletionTriggerKind": {"Inline", ""}, + "InsertTextFormat": {"", "TextFormat"}, + "SemanticTokenModifiers": {"Mod", ""}, + "SemanticTokenTypes": {"", "Type"}, + "SignatureHelpTriggerKind": {"Sig", ""}, + "SymbolTag": {"", "Symbol"}, + "WatchKind": {"Watch", ""}, +} + +// which entries of disambiguate got used +var usedDisambiguate = make(map[string]bool) + +// for gopls compatibility, replace generated type names with existing ones +var goplsType = map[string]string{ + "And_RegOpt_textDocument_colorPresentation": "WorkDoneProgressOptionsAndTextDocumentRegistrationOptions", + "ConfigurationParams": "ParamConfiguration", + "DocumentDiagnosticParams": "string", + "DocumentDiagnosticReport": "string", + "DocumentUri": "DocumentURI", + "InitializeParams": "ParamInitialize", + "LSPAny": "interface{}", + + "Lit_CodeActionClientCapabilities_codeActionLiteralSupport": "PCodeActionLiteralSupportPCodeAction", + "Lit_CodeActionClientCapabilities_codeActionLiteralSupport_codeActionKind": "FCodeActionKindPCodeActionLiteralSupport", + + "Lit_CodeActionClientCapabilities_resolveSupport": "PResolveSupportPCodeAction", + "Lit_CodeAction_disabled": "PDisabledMsg_textDocument_codeAction", + "Lit_CompletionClientCapabilities_completionItem": "PCompletionItemPCompletion", + "Lit_CompletionClientCapabilities_completionItemKind": "PCompletionItemKindPCompletion", + + "Lit_CompletionClientCapabilities_completionItem_insertTextModeSupport": "FInsertTextModeSupportPCompletionItem", + + "Lit_CompletionClientCapabilities_completionItem_resolveSupport": "FResolveSupportPCompletionItem", + "Lit_CompletionClientCapabilities_completionItem_tagSupport": "FTagSupportPCompletionItem", + + "Lit_CompletionClientCapabilities_completionList": "PCompletionListPCompletion", + "Lit_CompletionList_itemDefaults": "PItemDefaultsMsg_textDocument_completion", + "Lit_CompletionList_itemDefaults_editRange_Item1": "FEditRangePItemDefaults", + "Lit_CompletionOptions_completionItem": "PCompletionItemPCompletionProvider", + "Lit_DocumentSymbolClientCapabilities_symbolKind": "PSymbolKindPDocumentSymbol", + "Lit_DocumentSymbolClientCapabilities_tagSupport": "PTagSupportPDocumentSymbol", + "Lit_FoldingRangeClientCapabilities_foldingRange": "PFoldingRangePFoldingRange", + "Lit_FoldingRangeClientCapabilities_foldingRangeKind": "PFoldingRangeKindPFoldingRange", + "Lit_GeneralClientCapabilities_staleRequestSupport": "PStaleRequestSupportPGeneral", + "Lit_InitializeResult_serverInfo": "PServerInfoMsg_initialize", + "Lit_InlayHintClientCapabilities_resolveSupport": "PResolveSupportPInlayHint", + "Lit_MarkedString_Item1": "Msg_MarkedString", + "Lit_NotebookDocumentChangeEvent_cells": "PCellsPChange", + "Lit_NotebookDocumentChangeEvent_cells_structure": "FStructurePCells", + "Lit_NotebookDocumentFilter_Item0": "Msg_NotebookDocumentFilter", + + "Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0": "PNotebookSelectorPNotebookDocumentSync", + + "Lit_PrepareRenameResult_Item1": "Msg_PrepareRename2Gn", + + "Lit_PublishDiagnosticsClientCapabilities_tagSupport": "PTagSupportPPublishDiagnostics", + "Lit_SemanticTokensClientCapabilities_requests": "PRequestsPSemanticTokens", + "Lit_SemanticTokensClientCapabilities_requests_full_Item1": "FFullPRequests", + "Lit_SemanticTokensClientCapabilities_requests_range_Item1": "FRangePRequests", + + "Lit_SemanticTokensOptions_full_Item1": "PFullESemanticTokensOptions", + "Lit_SemanticTokensOptions_range_Item1": "PRangeESemanticTokensOptions", + "Lit_ServerCapabilities_workspace": "Workspace6Gn", + + "Lit_ShowMessageRequestClientCapabilities_messageActionItem": "PMessageActionItemPShowMessage", + "Lit_SignatureHelpClientCapabilities_signatureInformation": "PSignatureInformationPSignatureHelp", + + "Lit_SignatureHelpClientCapabilities_signatureInformation_parameterInformation": "FParameterInformationPSignatureInformation", + + "Lit_TextDocumentContentChangeEvent_Item0": "Msg_TextDocumentContentChangeEvent", + "Lit_TextDocumentFilter_Item0": "Msg_TextDocumentFilter", + "Lit_TextDocumentFilter_Item1": "Msg_TextDocumentFilter", + "Lit_WorkspaceEditClientCapabilities_changeAnnotationSupport": "PChangeAnnotationSupportPWorkspaceEdit", + "Lit_WorkspaceSymbolClientCapabilities_resolveSupport": "PResolveSupportPSymbol", + "Lit_WorkspaceSymbolClientCapabilities_symbolKind": "PSymbolKindPSymbol", + "Lit_WorkspaceSymbolClientCapabilities_tagSupport": "PTagSupportPSymbol", + "Lit_WorkspaceSymbol_location_Item1": "PLocationMsg_workspace_symbol", + "Lit__InitializeParams_clientInfo": "Msg_XInitializeParams_clientInfo", + "Or_CompletionList_itemDefaults_editRange": "OrFEditRangePItemDefaults", + "Or_Declaration": "[]Location", + "Or_DidChangeConfigurationRegistrationOptions_section": "OrPSection_workspace_didChangeConfiguration", + "Or_GlobPattern": "string", + "Or_InlayHintLabelPart_tooltip": "OrPTooltipPLabel", + "Or_InlayHint_tooltip": "OrPTooltip_textDocument_inlayHint", + "Or_LSPAny": "interface{}", + "Or_NotebookDocumentFilter": "Msg_NotebookDocumentFilter", + // "Or_NotebookDocumentSyncOptions_notebookSelector_Elem": "PNotebookSelectorPNotebookDocumentSync", + + // "Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_notebook": "OrFNotebookPNotebookSelector", + + "Or_ParameterInformation_documentation": "string", + "Or_ParameterInformation_label": "string", + "Or_PrepareRenameResult": "Msg_PrepareRename2Gn", + "Or_ProgressToken": "interface{}", + "Or_Result_textDocument_completion": "CompletionList", + "Or_Result_textDocument_declaration": "Or_textDocument_declaration", + "Or_Result_textDocument_definition": "[]Location", + "Or_Result_textDocument_documentSymbol": "[]interface{}", + "Or_Result_textDocument_implementation": "[]Location", + "Or_Result_textDocument_semanticTokens_full_delta": "interface{}", + "Or_Result_textDocument_typeDefinition": "[]Location", + "Or_Result_workspace_symbol": "[]SymbolInformation", + "Or_TextDocumentContentChangeEvent": "Msg_TextDocumentContentChangeEvent", + "Or_TextDocumentFilter": "Msg_TextDocumentFilter", + // "Or_WorkspaceFoldersServerCapabilities_changeNotifications": "string", + "Or_WorkspaceSymbol_location": "OrPLocation_workspace_symbol", + "PrepareRenameResult": "PrepareRename2Gn", + "Tuple_ParameterInformation_label_Item1": "UIntCommaUInt", + "WorkspaceFoldersServerCapabilities": "WorkspaceFolders5Gn", + "[]LSPAny": "[]interface{}", + // "[]Or_NotebookDocumentSyncOptions_notebookSelector_Elem": "[]PNotebookSelectorPNotebookDocumentSync", + "[]Or_Result_textDocument_codeAction_Item0_Elem": "[]CodeAction", + "[]PreviousResultId": "[]PreviousResultID", + "[]uinteger": "[]uint32", + "boolean": "bool", + "decimal": "float64", + "integer": "int32", + "map[DocumentUri][]TextEdit": "map[DocumentURI][]TextEdit", + "uinteger": "uint32", +} + +var usedGoplsType = make(map[string]bool) + +// methodNames is a map from the method to the name of the function that handles it +var methodNames = map[string]string{ + "$/cancelRequest": "CancelRequest", + "$/logTrace": "LogTrace", + "$/progress": "Progress", + "$/setTrace": "SetTrace", + "callHierarchy/incomingCalls": "IncomingCalls", + "callHierarchy/outgoingCalls": "OutgoingCalls", + "client/registerCapability": "RegisterCapability", + "client/unregisterCapability": "UnregisterCapability", + "codeAction/resolve": "ResolveCodeAction", + "codeLens/resolve": "ResolveCodeLens", + "completionItem/resolve": "ResolveCompletionItem", + "documentLink/resolve": "ResolveDocumentLink", + "exit": "Exit", + "initialize": "Initialize", + "initialized": "Initialized", + "inlayHint/resolve": "Resolve", + "notebookDocument/didChange": "DidChangeNotebookDocument", + "notebookDocument/didClose": "DidCloseNotebookDocument", + "notebookDocument/didOpen": "DidOpenNotebookDocument", + "notebookDocument/didSave": "DidSaveNotebookDocument", + "shutdown": "Shutdown", + "telemetry/event": "Event", + "textDocument/codeAction": "CodeAction", + "textDocument/codeLens": "CodeLens", + "textDocument/colorPresentation": "ColorPresentation", + "textDocument/completion": "Completion", + "textDocument/declaration": "Declaration", + "textDocument/definition": "Definition", + "textDocument/diagnostic": "Diagnostic", + "textDocument/didChange": "DidChange", + "textDocument/didClose": "DidClose", + "textDocument/didOpen": "DidOpen", + "textDocument/didSave": "DidSave", + "textDocument/documentColor": "DocumentColor", + "textDocument/documentHighlight": "DocumentHighlight", + "textDocument/documentLink": "DocumentLink", + "textDocument/documentSymbol": "DocumentSymbol", + "textDocument/foldingRange": "FoldingRange", + "textDocument/formatting": "Formatting", + "textDocument/hover": "Hover", + "textDocument/implementation": "Implementation", + "textDocument/inlayHint": "InlayHint", + "textDocument/inlineCompletion": "InlineCompletion", + "textDocument/inlineValue": "InlineValue", + "textDocument/linkedEditingRange": "LinkedEditingRange", + "textDocument/moniker": "Moniker", + "textDocument/onTypeFormatting": "OnTypeFormatting", + "textDocument/prepareCallHierarchy": "PrepareCallHierarchy", + "textDocument/prepareRename": "PrepareRename", + "textDocument/prepareTypeHierarchy": "PrepareTypeHierarchy", + "textDocument/publishDiagnostics": "PublishDiagnostics", + "textDocument/rangeFormatting": "RangeFormatting", + "textDocument/rangesFormatting": "RangesFormatting", + "textDocument/references": "References", + "textDocument/rename": "Rename", + "textDocument/selectionRange": "SelectionRange", + "textDocument/semanticTokens/full": "SemanticTokensFull", + "textDocument/semanticTokens/full/delta": "SemanticTokensFullDelta", + "textDocument/semanticTokens/range": "SemanticTokensRange", + "textDocument/signatureHelp": "SignatureHelp", + "textDocument/typeDefinition": "TypeDefinition", + "textDocument/willSave": "WillSave", + "textDocument/willSaveWaitUntil": "WillSaveWaitUntil", + "typeHierarchy/subtypes": "Subtypes", + "typeHierarchy/supertypes": "Supertypes", + "window/logMessage": "LogMessage", + "window/showDocument": "ShowDocument", + "window/showMessage": "ShowMessage", + "window/showMessageRequest": "ShowMessageRequest", + "window/workDoneProgress/cancel": "WorkDoneProgressCancel", + "window/workDoneProgress/create": "WorkDoneProgressCreate", + "workspace/applyEdit": "ApplyEdit", + "workspace/codeLens/refresh": "CodeLensRefresh", + "workspace/configuration": "Configuration", + "workspace/diagnostic": "DiagnosticWorkspace", + "workspace/diagnostic/refresh": "DiagnosticRefresh", + "workspace/didChangeConfiguration": "DidChangeConfiguration", + "workspace/didChangeWatchedFiles": "DidChangeWatchedFiles", + "workspace/didChangeWorkspaceFolders": "DidChangeWorkspaceFolders", + "workspace/didCreateFiles": "DidCreateFiles", + "workspace/didDeleteFiles": "DidDeleteFiles", + "workspace/didRenameFiles": "DidRenameFiles", + "workspace/executeCommand": "ExecuteCommand", + "workspace/inlayHint/refresh": "InlayHintRefresh", + "workspace/inlineValue/refresh": "InlineValueRefresh", + "workspace/semanticTokens/refresh": "SemanticTokensRefresh", + "workspace/symbol": "Symbol", + "workspace/willCreateFiles": "WillCreateFiles", + "workspace/willDeleteFiles": "WillDeleteFiles", + "workspace/willRenameFiles": "WillRenameFiles", + "workspace/workspaceFolders": "WorkspaceFolders", + "workspaceSymbol/resolve": "ResolveWorkspaceSymbol", +} + +func methodName(method string) string { + ans := methodNames[method] + if ans == "" { + log.Fatalf("unknown method %q", method) + } + return ans +} diff --git a/lsp/protocol/generate/typenames.go b/lsp/protocol/generate/typenames.go new file mode 100644 index 00000000..8bacdd2a --- /dev/null +++ b/lsp/protocol/generate/typenames.go @@ -0,0 +1,184 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.19 +// +build go1.19 + +package main + +import ( + "fmt" + "log" + "strings" +) + +var typeNames = make(map[*Type]string) +var genTypes []*newType + +func findTypeNames(model Model) { + for _, s := range model.Structures { + for _, e := range s.Extends { + nameType(e, nil) // all references + } + for _, m := range s.Mixins { + nameType(m, nil) // all references + } + for _, p := range s.Properties { + nameType(p.Type, []string{s.Name, p.Name}) + } + } + for _, t := range model.Enumerations { + nameType(t.Type, []string{t.Name}) + } + for _, t := range model.TypeAliases { + nameType(t.Type, []string{t.Name}) + } + for _, r := range model.Requests { + nameType(r.Params, []string{"Param", r.Method}) + nameType(r.Result, []string{"Result", r.Method}) + nameType(r.RegistrationOptions, []string{"RegOpt", r.Method}) + } + for _, n := range model.Notifications { + nameType(n.Params, []string{"Param", n.Method}) + nameType(n.RegistrationOptions, []string{"RegOpt", n.Method}) + } +} + +// nameType populates typeNames[t] with the computed name of the type. +// path is the list of enclosing constructs in the JSON model. +func nameType(t *Type, path []string) string { + if t == nil || typeNames[t] != "" { + return "" + } + switch t.Kind { + case "base": + typeNames[t] = t.Name + return t.Name + case "reference": + typeNames[t] = t.Name + return t.Name + case "array": + nm := "[]" + nameType(t.Element, append(path, "Elem")) + typeNames[t] = nm + return nm + case "map": + key := nameType(t.Key, nil) // never a generated type + value := nameType(t.Value.(*Type), append(path, "Value")) + nm := "map[" + key + "]" + value + typeNames[t] = nm + return nm + // generated types + case "and": + nm := nameFromPath("And", path) + typeNames[t] = nm + for _, it := range t.Items { + nameType(it, append(path, "Item")) + } + genTypes = append(genTypes, &newType{ + name: nm, + typ: t, + kind: "and", + items: t.Items, + line: t.Line, + }) + return nm + case "literal": + nm := nameFromPath("Lit", path) + typeNames[t] = nm + for _, p := range t.Value.(ParseLiteral).Properties { + nameType(p.Type, append(path, p.Name)) + } + genTypes = append(genTypes, &newType{ + name: nm, + typ: t, + kind: "literal", + properties: t.Value.(ParseLiteral).Properties, + line: t.Line, + }) + return nm + case "tuple": + nm := nameFromPath("Tuple", path) + typeNames[t] = nm + for _, it := range t.Items { + nameType(it, append(path, "Item")) + } + genTypes = append(genTypes, &newType{ + name: nm, + typ: t, + kind: "tuple", + items: t.Items, + line: t.Line, + }) + return nm + case "or": + nm := nameFromPath("Or", path) + typeNames[t] = nm + for i, it := range t.Items { + // these names depend on the ordering within the "or" type + nameType(it, append(path, fmt.Sprintf("Item%d", i))) + } + // this code handles an "or" of stringLiterals (_InitializeParams.trace) + names := make(map[string]int) + msg := "" + for _, it := range t.Items { + if line, ok := names[typeNames[it]]; ok { + // duplicate component names are bad + msg += fmt.Sprintf("lines %d %d dup, %s for %s\n", line, it.Line, typeNames[it], nm) + } + names[typeNames[it]] = t.Line + } + // this code handles an "or" of stringLiterals (_InitializeParams.trace) + if len(names) == 1 { + var solekey string + for k := range names { + solekey = k // the sole name + } + if solekey == "string" { // _InitializeParams.trace + typeNames[t] = "string" + return "string" + } + // otherwise unexpected + log.Printf("unexpected: single-case 'or' type has non-string key %s: %s", nm, solekey) + log.Fatal(msg) + } else if len(names) == 2 { + // if one of the names is null, just use the other, rather than generating an "or". + // This removes about 40 types from the generated code. An entry in goplsStar + // could be added to handle the null case, if necessary. + newNm := "" + sawNull := false + for k := range names { + if k == "null" { + sawNull = true + } else { + newNm = k + } + } + if sawNull { + typeNames[t] = newNm + return newNm + } + } + genTypes = append(genTypes, &newType{ + name: nm, + typ: t, + kind: "or", + items: t.Items, + line: t.Line, + }) + return nm + case "stringLiteral": // a single type, like 'kind' or 'rename' + typeNames[t] = "string" + return "string" + default: + log.Fatalf("nameType: %T unexpected, line:%d path:%v", t, t.Line, path) + panic("unreachable in nameType") + } +} + +func nameFromPath(prefix string, path []string) string { + nm := prefix + "_" + strings.Join(path, "_") + // methods have slashes + nm = strings.ReplaceAll(nm, "/", "_") + return nm +} diff --git a/lsp/protocol/generate/types.go b/lsp/protocol/generate/types.go new file mode 100644 index 00000000..0d01ae43 --- /dev/null +++ b/lsp/protocol/generate/types.go @@ -0,0 +1,170 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.19 +// +build go1.19 + +package main + +import ( + "fmt" + "sort" +) + +// Model contains the parsed version of the spec +type Model struct { + Version Metadata `json:"metaData"` + Requests []*Request `json:"requests"` + Notifications []*Notification `json:"notifications"` + Structures []*Structure `json:"structures"` + Enumerations []*Enumeration `json:"enumerations"` + TypeAliases []*TypeAlias `json:"typeAliases"` + Line int `json:"line"` +} + +// Metadata is information about the version of the spec +type Metadata struct { + Version string `json:"version"` + Line int `json:"line"` +} + +// A Request is the parsed version of an LSP request +type Request struct { + Documentation string `json:"documentation"` + ErrorData *Type `json:"errorData"` + Direction string `json:"messageDirection"` + Method string `json:"method"` + Params *Type `json:"params"` + PartialResult *Type `json:"partialResult"` + Proposed bool `json:"proposed"` + RegistrationMethod string `json:"registrationMethod"` + RegistrationOptions *Type `json:"registrationOptions"` + Result *Type `json:"result"` + Since string `json:"since"` + Line int `json:"line"` +} + +// A Notificatin is the parsed version of an LSP notification +type Notification struct { + Documentation string `json:"documentation"` + Direction string `json:"messageDirection"` + Method string `json:"method"` + Params *Type `json:"params"` + Proposed bool `json:"proposed"` + RegistrationMethod string `json:"registrationMethod"` + RegistrationOptions *Type `json:"registrationOptions"` + Since string `json:"since"` + Line int `json:"line"` +} + +// A Structure is the parsed version of an LSP structure from the spec +type Structure struct { + Documentation string `json:"documentation"` + Extends []*Type `json:"extends"` + Mixins []*Type `json:"mixins"` + Name string `json:"name"` + Properties []NameType `json:"properties"` + Proposed bool `json:"proposed"` + Since string `json:"since"` + Line int `json:"line"` +} + +// An enumeration is the parsed version of an LSP enumeration from the spec +type Enumeration struct { + Documentation string `json:"documentation"` + Name string `json:"name"` + Proposed bool `json:"proposed"` + Since string `json:"since"` + SupportsCustomValues bool `json:"supportsCustomValues"` + Type *Type `json:"type"` + Values []NameValue `json:"values"` + Line int `json:"line"` +} + +// A TypeAlias is the parsed version of an LSP type alias from the spec +type TypeAlias struct { + Documentation string `json:"documentation"` + Deprecated string `json:"deprecated"` + Name string `json:"name"` + Proposed bool `json:"proposed"` + Since string `json:"since"` + Type *Type `json:"type"` + Line int `json:"line"` +} + +// A NameValue describes an enumeration constant +type NameValue struct { + Documentation string `json:"documentation"` + Name string `json:"name"` + Proposed bool `json:"proposed"` + Since string `json:"since"` + Value any `json:"value"` // number or string + Line int `json:"line"` +} + +// A Type is the parsed version of an LSP type from the spec, +// or a Type the code constructs +type Type struct { + Kind string `json:"kind"` // -- which kind goes with which field -- + Items []*Type `json:"items"` // "and", "or", "tuple" + Element *Type `json:"element"` // "array" + Name string `json:"name"` // "base", "reference" + Key *Type `json:"key"` // "map" + Value any `json:"value"` // "map", "stringLiteral", "literal" + Line int `json:"line"` // JSON source line +} + +// ParsedLiteral is Type.Value when Type.Kind is "literal" +type ParseLiteral struct { + Properties `json:"properties"` +} + +// A NameType represents the name and type of a structure element +type NameType struct { + Name string `json:"name"` + Type *Type `json:"type"` + Optional bool `json:"optional"` + Documentation string `json:"documentation"` + Deprecated string `json:"deprecated"` + Since string `json:"since"` + Proposed bool `json:"proposed"` + Line int `json:"line"` +} + +// Properties are the collection of structure fields +type Properties []NameType + +// addLineNumbers adds a "line" field to each object in the JSON. +func addLineNumbers(buf []byte) []byte { + var ans []byte + // In the specification .json file, the delimiter '{' is + // always followed by a newline. There are other {s embedded in strings. + // json.Token does not return \n, or :, or , so using it would + // require parsing the json to reconstruct the missing information. + for linecnt, i := 1, 0; i < len(buf); i++ { + ans = append(ans, buf[i]) + switch buf[i] { + case '{': + if buf[i+1] == '\n' { + ans = append(ans, fmt.Sprintf(`"line": %d, `, linecnt)...) + // warning: this would fail if the spec file had + // `"value": {\n}`, but it does not, as comma is a separator. + } + case '\n': + linecnt++ + } + } + return ans +} + +type sortedMap[T any] map[string]T + +func (s sortedMap[T]) keys() []string { + var keys []string + for k := range s { + keys = append(keys, k) + } + sort.Strings(keys) + return keys +} diff --git a/lsp/protocol/tsdocument_changes.go b/lsp/protocol/tsdocument_changes.go new file mode 100644 index 00000000..2c7a524e --- /dev/null +++ b/lsp/protocol/tsdocument_changes.go @@ -0,0 +1,42 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package protocol + +import ( + "encoding/json" + "fmt" +) + +// DocumentChanges is a union of a file edit and directory rename operations +// for package renaming feature. At most one field of this struct is non-nil. +type DocumentChanges struct { + TextDocumentEdit *TextDocumentEdit + RenameFile *RenameFile +} + +func (d *DocumentChanges) UnmarshalJSON(data []byte) error { + var m map[string]interface{} + + if err := json.Unmarshal(data, &m); err != nil { + return err + } + + if _, ok := m["textDocument"]; ok { + d.TextDocumentEdit = new(TextDocumentEdit) + return json.Unmarshal(data, d.TextDocumentEdit) + } + + d.RenameFile = new(RenameFile) + return json.Unmarshal(data, d.RenameFile) +} + +func (d *DocumentChanges) MarshalJSON() ([]byte, error) { + if d.TextDocumentEdit != nil { + return json.Marshal(d.TextDocumentEdit) + } else if d.RenameFile != nil { + return json.Marshal(d.RenameFile) + } + return nil, fmt.Errorf("Empty DocumentChanges union value") +} diff --git a/lsp/protocol/tsjson.go b/lsp/protocol/tsjson.go new file mode 100644 index 00000000..f827aea3 --- /dev/null +++ b/lsp/protocol/tsjson.go @@ -0,0 +1,2152 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated for LSP. DO NOT EDIT. + +package protocol + +// Code generated from protocol/metaModel.json at ref main (hash 3dab7ac7081afaa20b22a9def39aba78457aebb9). +// https://github.com/microsoft/vscode-languageserver-node/blob/main/protocol/metaModel.json +// LSP metaData.version = 3.17.0. + +import "encoding/json" + +import "fmt" + +// UnmarshalError indicates that a JSON value did not conform to +// one of the expected cases of an LSP union type. +type UnmarshalError struct { + msg string +} + +func (e UnmarshalError) Error() string { + return e.msg +} + +// from line 4964 +func (t OrFEditRangePItemDefaults) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case FEditRangePItemDefaults: + return json.Marshal(x) + case Range: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [FEditRangePItemDefaults Range]", t) +} + +func (t *OrFEditRangePItemDefaults) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 FEditRangePItemDefaults + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 Range + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [FEditRangePItemDefaults Range]"} +} + +// from line 5715 +func (t OrPLocation_workspace_symbol) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case Location: + return json.Marshal(x) + case PLocationMsg_workspace_symbol: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [Location PLocationMsg_workspace_symbol]", t) +} + +func (t *OrPLocation_workspace_symbol) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 Location + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 PLocationMsg_workspace_symbol + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [Location PLocationMsg_workspace_symbol]"} +} + +// from line 4358 +func (t OrPSection_workspace_didChangeConfiguration) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case []string: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [[]string string]", t) +} + +func (t *OrPSection_workspace_didChangeConfiguration) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 []string + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [[]string string]"} +} + +// from line 7311 +func (t OrPTooltipPLabel) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case MarkupContent: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t) +} + +func (t *OrPTooltipPLabel) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 MarkupContent + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"} +} + +// from line 3772 +func (t OrPTooltip_textDocument_inlayHint) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case MarkupContent: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t) +} + +func (t *OrPTooltip_textDocument_inlayHint) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 MarkupContent + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"} +} + +// from line 6420 +func (t Or_CancelParams_id) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case int32: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [int32 string]", t) +} + +func (t *Or_CancelParams_id) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 int32 + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [int32 string]"} +} + +// from line 4777 +func (t Or_CompletionItem_documentation) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case MarkupContent: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t) +} + +func (t *Or_CompletionItem_documentation) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 MarkupContent + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"} +} + +// from line 4860 +func (t Or_CompletionItem_textEdit) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case InsertReplaceEdit: + return json.Marshal(x) + case TextEdit: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [InsertReplaceEdit TextEdit]", t) +} + +func (t *Or_CompletionItem_textEdit) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 InsertReplaceEdit + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 TextEdit + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [InsertReplaceEdit TextEdit]"} +} + +// from line 14174 +func (t Or_Definition) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case Location: + return json.Marshal(x) + case []Location: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [Location []Location]", t) +} + +func (t *Or_Definition) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 Location + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 []Location + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [Location []Location]"} +} + +// from line 8865 +func (t Or_Diagnostic_code) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case int32: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [int32 string]", t) +} + +func (t *Or_Diagnostic_code) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 int32 + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [int32 string]"} +} + +// from line 14306 +func (t Or_DocumentDiagnosticReport) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case RelatedFullDocumentDiagnosticReport: + return json.Marshal(x) + case RelatedUnchangedDocumentDiagnosticReport: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]", t) +} + +func (t *Or_DocumentDiagnosticReport) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 RelatedFullDocumentDiagnosticReport + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 RelatedUnchangedDocumentDiagnosticReport + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]"} +} + +// from line 3895 +func (t Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case FullDocumentDiagnosticReport: + return json.Marshal(x) + case UnchangedDocumentDiagnosticReport: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t) +} + +func (t *Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 FullDocumentDiagnosticReport + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 UnchangedDocumentDiagnosticReport + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"} +} + +// from line 14516 +func (t Or_DocumentFilter) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case NotebookCellTextDocumentFilter: + return json.Marshal(x) + case TextDocumentFilter: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [NotebookCellTextDocumentFilter TextDocumentFilter]", t) +} + +func (t *Or_DocumentFilter) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 NotebookCellTextDocumentFilter + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 TextDocumentFilter + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [NotebookCellTextDocumentFilter TextDocumentFilter]"} +} + +// from line 5086 +func (t Or_Hover_contents) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case MarkedString: + return json.Marshal(x) + case MarkupContent: + return json.Marshal(x) + case []MarkedString: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [MarkedString MarkupContent []MarkedString]", t) +} + +func (t *Or_Hover_contents) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 MarkedString + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 MarkupContent + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 []MarkedString + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [MarkedString MarkupContent []MarkedString]"} +} + +// from line 3731 +func (t Or_InlayHint_label) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case []InlayHintLabelPart: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [[]InlayHintLabelPart string]", t) +} + +func (t *Or_InlayHint_label) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 []InlayHintLabelPart + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [[]InlayHintLabelPart string]"} +} + +// from line 4163 +func (t Or_InlineCompletionItem_insertText) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case StringValue: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [StringValue string]", t) +} + +func (t *Or_InlineCompletionItem_insertText) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 StringValue + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [StringValue string]"} +} + +// from line 14284 +func (t Or_InlineValue) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case InlineValueEvaluatableExpression: + return json.Marshal(x) + case InlineValueText: + return json.Marshal(x) + case InlineValueVariableLookup: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]", t) +} + +func (t *Or_InlineValue) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 InlineValueEvaluatableExpression + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 InlineValueText + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 InlineValueVariableLookup + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]"} +} + +// from line 14481 +func (t Or_MarkedString) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case Msg_MarkedString: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [Msg_MarkedString string]", t) +} + +func (t *Or_MarkedString) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 Msg_MarkedString + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [Msg_MarkedString string]"} +} + +// from line 10472 +func (t Or_NotebookCellTextDocumentFilter_notebook) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case NotebookDocumentFilter: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t) +} + +func (t *Or_NotebookCellTextDocumentFilter_notebook) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 NotebookDocumentFilter + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"} +} + +// from line 10156 +func (t Or_NotebookDocumentSyncOptions_notebookSelector_Elem) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1: + return json.Marshal(x) + case PNotebookSelectorPNotebookDocumentSync: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1 PNotebookSelectorPNotebookDocumentSync]", t) +} + +func (t *Or_NotebookDocumentSyncOptions_notebookSelector_Elem) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1 + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 PNotebookSelectorPNotebookDocumentSync + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1 PNotebookSelectorPNotebookDocumentSync]"} +} + +// from line 10165 +func (t Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_notebook) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case NotebookDocumentFilter: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t) +} + +func (t *Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_notebook) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 NotebookDocumentFilter + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"} +} + +// from line 10211 +func (t Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_notebook) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case NotebookDocumentFilter: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t) +} + +func (t *Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_notebook) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 NotebookDocumentFilter + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"} +} + +// from line 7404 +func (t Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case FullDocumentDiagnosticReport: + return json.Marshal(x) + case UnchangedDocumentDiagnosticReport: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t) +} + +func (t *Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 FullDocumentDiagnosticReport + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 UnchangedDocumentDiagnosticReport + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"} +} + +// from line 7443 +func (t Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case FullDocumentDiagnosticReport: + return json.Marshal(x) + case UnchangedDocumentDiagnosticReport: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t) +} + +func (t *Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 FullDocumentDiagnosticReport + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 UnchangedDocumentDiagnosticReport + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"} +} + +// from line 11106 +func (t Or_RelativePattern_baseUri) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case URI: + return json.Marshal(x) + case WorkspaceFolder: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [URI WorkspaceFolder]", t) +} + +func (t *Or_RelativePattern_baseUri) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 URI + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 WorkspaceFolder + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [URI WorkspaceFolder]"} +} + +// from line 1413 +func (t Or_Result_textDocument_codeAction_Item0_Elem) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case CodeAction: + return json.Marshal(x) + case Command: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [CodeAction Command]", t) +} + +func (t *Or_Result_textDocument_codeAction_Item0_Elem) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 CodeAction + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 Command + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [CodeAction Command]"} +} + +// from line 980 +func (t Or_Result_textDocument_inlineCompletion) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case InlineCompletionList: + return json.Marshal(x) + case []InlineCompletionItem: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [InlineCompletionList []InlineCompletionItem]", t) +} + +func (t *Or_Result_textDocument_inlineCompletion) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 InlineCompletionList + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 []InlineCompletionItem + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [InlineCompletionList []InlineCompletionItem]"} +} + +// from line 12573 +func (t Or_SemanticTokensClientCapabilities_requests_full) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case FFullPRequests: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [FFullPRequests bool]", t) +} + +func (t *Or_SemanticTokensClientCapabilities_requests_full) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 FFullPRequests + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [FFullPRequests bool]"} +} + +// from line 12553 +func (t Or_SemanticTokensClientCapabilities_requests_range) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case FRangePRequests: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [FRangePRequests bool]", t) +} + +func (t *Or_SemanticTokensClientCapabilities_requests_range) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 FRangePRequests + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [FRangePRequests bool]"} +} + +// from line 6815 +func (t Or_SemanticTokensOptions_full) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case PFullESemanticTokensOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [PFullESemanticTokensOptions bool]", t) +} + +func (t *Or_SemanticTokensOptions_full) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 PFullESemanticTokensOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [PFullESemanticTokensOptions bool]"} +} + +// from line 6795 +func (t Or_SemanticTokensOptions_range) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case PRangeESemanticTokensOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [PRangeESemanticTokensOptions bool]", t) +} + +func (t *Or_SemanticTokensOptions_range) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 PRangeESemanticTokensOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [PRangeESemanticTokensOptions bool]"} +} + +// from line 8525 +func (t Or_ServerCapabilities_callHierarchyProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case CallHierarchyOptions: + return json.Marshal(x) + case CallHierarchyRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_callHierarchyProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 CallHierarchyOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 CallHierarchyRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]"} +} + +// from line 8333 +func (t Or_ServerCapabilities_codeActionProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case CodeActionOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [CodeActionOptions bool]", t) +} + +func (t *Or_ServerCapabilities_codeActionProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 CodeActionOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [CodeActionOptions bool]"} +} + +// from line 8369 +func (t Or_ServerCapabilities_colorProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case DocumentColorOptions: + return json.Marshal(x) + case DocumentColorRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [DocumentColorOptions DocumentColorRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_colorProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 DocumentColorOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 DocumentColorRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [DocumentColorOptions DocumentColorRegistrationOptions bool]"} +} + +// from line 8195 +func (t Or_ServerCapabilities_declarationProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case DeclarationOptions: + return json.Marshal(x) + case DeclarationRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [DeclarationOptions DeclarationRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_declarationProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 DeclarationOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 DeclarationRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [DeclarationOptions DeclarationRegistrationOptions bool]"} +} + +// from line 8217 +func (t Or_ServerCapabilities_definitionProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case DefinitionOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [DefinitionOptions bool]", t) +} + +func (t *Or_ServerCapabilities_definitionProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 DefinitionOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [DefinitionOptions bool]"} +} + +// from line 8682 +func (t Or_ServerCapabilities_diagnosticProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case DiagnosticOptions: + return json.Marshal(x) + case DiagnosticRegistrationOptions: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [DiagnosticOptions DiagnosticRegistrationOptions]", t) +} + +func (t *Or_ServerCapabilities_diagnosticProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 DiagnosticOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 DiagnosticRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [DiagnosticOptions DiagnosticRegistrationOptions]"} +} + +// from line 8409 +func (t Or_ServerCapabilities_documentFormattingProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case DocumentFormattingOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [DocumentFormattingOptions bool]", t) +} + +func (t *Or_ServerCapabilities_documentFormattingProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 DocumentFormattingOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [DocumentFormattingOptions bool]"} +} + +// from line 8297 +func (t Or_ServerCapabilities_documentHighlightProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case DocumentHighlightOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [DocumentHighlightOptions bool]", t) +} + +func (t *Or_ServerCapabilities_documentHighlightProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 DocumentHighlightOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [DocumentHighlightOptions bool]"} +} + +// from line 8427 +func (t Or_ServerCapabilities_documentRangeFormattingProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case DocumentRangeFormattingOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [DocumentRangeFormattingOptions bool]", t) +} + +func (t *Or_ServerCapabilities_documentRangeFormattingProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 DocumentRangeFormattingOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [DocumentRangeFormattingOptions bool]"} +} + +// from line 8315 +func (t Or_ServerCapabilities_documentSymbolProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case DocumentSymbolOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [DocumentSymbolOptions bool]", t) +} + +func (t *Or_ServerCapabilities_documentSymbolProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 DocumentSymbolOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [DocumentSymbolOptions bool]"} +} + +// from line 8472 +func (t Or_ServerCapabilities_foldingRangeProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case FoldingRangeOptions: + return json.Marshal(x) + case FoldingRangeRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_foldingRangeProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 FoldingRangeOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 FoldingRangeRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]"} +} + +// from line 8168 +func (t Or_ServerCapabilities_hoverProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case HoverOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [HoverOptions bool]", t) +} + +func (t *Or_ServerCapabilities_hoverProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 HoverOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [HoverOptions bool]"} +} + +// from line 8257 +func (t Or_ServerCapabilities_implementationProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case ImplementationOptions: + return json.Marshal(x) + case ImplementationRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [ImplementationOptions ImplementationRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_implementationProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 ImplementationOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 ImplementationRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [ImplementationOptions ImplementationRegistrationOptions bool]"} +} + +// from line 8659 +func (t Or_ServerCapabilities_inlayHintProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case InlayHintOptions: + return json.Marshal(x) + case InlayHintRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [InlayHintOptions InlayHintRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_inlayHintProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 InlayHintOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 InlayHintRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [InlayHintOptions InlayHintRegistrationOptions bool]"} +} + +// from line 8701 +func (t Or_ServerCapabilities_inlineCompletionProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case InlineCompletionOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [InlineCompletionOptions bool]", t) +} + +func (t *Or_ServerCapabilities_inlineCompletionProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 InlineCompletionOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [InlineCompletionOptions bool]"} +} + +// from line 8636 +func (t Or_ServerCapabilities_inlineValueProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case InlineValueOptions: + return json.Marshal(x) + case InlineValueRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [InlineValueOptions InlineValueRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_inlineValueProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 InlineValueOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 InlineValueRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [InlineValueOptions InlineValueRegistrationOptions bool]"} +} + +// from line 8548 +func (t Or_ServerCapabilities_linkedEditingRangeProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case LinkedEditingRangeOptions: + return json.Marshal(x) + case LinkedEditingRangeRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_linkedEditingRangeProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 LinkedEditingRangeOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 LinkedEditingRangeRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]"} +} + +// from line 8590 +func (t Or_ServerCapabilities_monikerProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case MonikerOptions: + return json.Marshal(x) + case MonikerRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [MonikerOptions MonikerRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_monikerProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 MonikerOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 MonikerRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [MonikerOptions MonikerRegistrationOptions bool]"} +} + +// from line 8140 +func (t Or_ServerCapabilities_notebookDocumentSync) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case NotebookDocumentSyncOptions: + return json.Marshal(x) + case NotebookDocumentSyncRegistrationOptions: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]", t) +} + +func (t *Or_ServerCapabilities_notebookDocumentSync) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 NotebookDocumentSyncOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 NotebookDocumentSyncRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]"} +} + +// from line 8279 +func (t Or_ServerCapabilities_referencesProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case ReferenceOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [ReferenceOptions bool]", t) +} + +func (t *Or_ServerCapabilities_referencesProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 ReferenceOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [ReferenceOptions bool]"} +} + +// from line 8454 +func (t Or_ServerCapabilities_renameProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case RenameOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [RenameOptions bool]", t) +} + +func (t *Or_ServerCapabilities_renameProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 RenameOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [RenameOptions bool]"} +} + +// from line 8494 +func (t Or_ServerCapabilities_selectionRangeProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case SelectionRangeOptions: + return json.Marshal(x) + case SelectionRangeRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_selectionRangeProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 SelectionRangeOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 SelectionRangeRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]"} +} + +// from line 8571 +func (t Or_ServerCapabilities_semanticTokensProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case SemanticTokensOptions: + return json.Marshal(x) + case SemanticTokensRegistrationOptions: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [SemanticTokensOptions SemanticTokensRegistrationOptions]", t) +} + +func (t *Or_ServerCapabilities_semanticTokensProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 SemanticTokensOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 SemanticTokensRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [SemanticTokensOptions SemanticTokensRegistrationOptions]"} +} + +// from line 8122 +func (t Or_ServerCapabilities_textDocumentSync) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case TextDocumentSyncKind: + return json.Marshal(x) + case TextDocumentSyncOptions: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [TextDocumentSyncKind TextDocumentSyncOptions]", t) +} + +func (t *Or_ServerCapabilities_textDocumentSync) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 TextDocumentSyncKind + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 TextDocumentSyncOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [TextDocumentSyncKind TextDocumentSyncOptions]"} +} + +// from line 8235 +func (t Or_ServerCapabilities_typeDefinitionProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case TypeDefinitionOptions: + return json.Marshal(x) + case TypeDefinitionRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_typeDefinitionProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 TypeDefinitionOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 TypeDefinitionRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]"} +} + +// from line 8613 +func (t Or_ServerCapabilities_typeHierarchyProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case TypeHierarchyOptions: + return json.Marshal(x) + case TypeHierarchyRegistrationOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]", t) +} + +func (t *Or_ServerCapabilities_typeHierarchyProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 TypeHierarchyOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 TypeHierarchyRegistrationOptions + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 bool + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]"} +} + +// from line 8391 +func (t Or_ServerCapabilities_workspaceSymbolProvider) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case WorkspaceSymbolOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [WorkspaceSymbolOptions bool]", t) +} + +func (t *Or_ServerCapabilities_workspaceSymbolProvider) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 WorkspaceSymbolOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [WorkspaceSymbolOptions bool]"} +} + +// from line 9159 +func (t Or_SignatureInformation_documentation) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case MarkupContent: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t) +} + +func (t *Or_SignatureInformation_documentation) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 MarkupContent + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"} +} + +// from line 6928 +func (t Or_TextDocumentEdit_edits_Elem) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case AnnotatedTextEdit: + return json.Marshal(x) + case TextEdit: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [AnnotatedTextEdit TextEdit]", t) +} + +func (t *Or_TextDocumentEdit_edits_Elem) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 AnnotatedTextEdit + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 TextEdit + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [AnnotatedTextEdit TextEdit]"} +} + +// from line 10131 +func (t Or_TextDocumentSyncOptions_save) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case SaveOptions: + return json.Marshal(x) + case bool: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [SaveOptions bool]", t) +} + +func (t *Or_TextDocumentSyncOptions_save) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 SaveOptions + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 bool + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [SaveOptions bool]"} +} + +// from line 14407 +func (t Or_WorkspaceDocumentDiagnosticReport) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case WorkspaceFullDocumentDiagnosticReport: + return json.Marshal(x) + case WorkspaceUnchangedDocumentDiagnosticReport: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]", t) +} + +func (t *Or_WorkspaceDocumentDiagnosticReport) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 WorkspaceFullDocumentDiagnosticReport + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 WorkspaceUnchangedDocumentDiagnosticReport + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]"} +} + +// from line 3292 +func (t Or_WorkspaceEdit_documentChanges_Elem) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case CreateFile: + return json.Marshal(x) + case DeleteFile: + return json.Marshal(x) + case RenameFile: + return json.Marshal(x) + case TextDocumentEdit: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [CreateFile DeleteFile RenameFile TextDocumentEdit]", t) +} + +func (t *Or_WorkspaceEdit_documentChanges_Elem) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 CreateFile + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 DeleteFile + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + var h2 RenameFile + if err := json.Unmarshal(x, &h2); err == nil { + t.Value = h2 + return nil + } + var h3 TextDocumentEdit + if err := json.Unmarshal(x, &h3); err == nil { + t.Value = h3 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [CreateFile DeleteFile RenameFile TextDocumentEdit]"} +} + +// from line 10301 +func (t Or_WorkspaceFoldersServerCapabilities_changeNotifications) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case bool: + return json.Marshal(x) + case string: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [bool string]", t) +} + +func (t *Or_WorkspaceFoldersServerCapabilities_changeNotifications) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 bool + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 string + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [bool string]"} +} + +// from line 248 +func (t Or_textDocument_declaration) MarshalJSON() ([]byte, error) { + switch x := t.Value.(type) { + case Declaration: + return json.Marshal(x) + case []DeclarationLink: + return json.Marshal(x) + case nil: + return []byte("null"), nil + } + return nil, fmt.Errorf("type %T not one of [Declaration []DeclarationLink]", t) +} + +func (t *Or_textDocument_declaration) UnmarshalJSON(x []byte) error { + if string(x) == "null" { + t.Value = nil + return nil + } + var h0 Declaration + if err := json.Unmarshal(x, &h0); err == nil { + t.Value = h0 + return nil + } + var h1 []DeclarationLink + if err := json.Unmarshal(x, &h1); err == nil { + t.Value = h1 + return nil + } + return &UnmarshalError{"unmarshal failed to match one of [Declaration []DeclarationLink]"} +} diff --git a/lsp/protocol/tsprotocol.go b/lsp/protocol/tsprotocol.go index 3e4b7dfa..c4f0e7cf 100644 --- a/lsp/protocol/tsprotocol.go +++ b/lsp/protocol/tsprotocol.go @@ -1,4628 +1,5657 @@ -// Package protocol contains data types and code for LSP jsonrpcs -// generated automatically from vscode-languageserver-node -// commit: 36ac51f057215e6e2e0408384e07ecf564a938da -// last fetched Tue Sep 24 2019 17:44:28 GMT-0400 (Eastern Daylight Time) +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated for LSP. DO NOT EDIT. + package protocol -// Code generated (see typescript/README.md) DO NOT EDIT. +// Code generated from protocol/metaModel.json at ref main (hash 3dab7ac7081afaa20b22a9def39aba78457aebb9). +// https://github.com/microsoft/vscode-languageserver-node/blob/main/protocol/metaModel.json +// LSP metaData.version = 3.17.0. -/*ImplementationClientCapabilities defined: - * Since 3.6.0 - */ -type ImplementationClientCapabilities struct { +import "encoding/json" - /*DynamicRegistration defined: - * Whether implementation supports dynamic registration. If this is set to `true` - * the client supports the new `ImplementationRegistrationOptions` return value - * for the corresponding server capability as well. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// A special text edit with an additional change annotation. +// +// @since 3.16.0. +type AnnotatedTextEdit struct { + // The actual identifier of the change annotation + AnnotationID ChangeAnnotationIdentifier `json:"annotationId"` + TextEdit +} - /*LinkSupport defined: - * The client supports additional metadata in the form of definition links. - * - * Since 3.14.0 - */ - LinkSupport bool `json:"linkSupport,omitempty"` +// The parameters passed via an apply workspace edit request. +type ApplyWorkspaceEditParams struct { + // An optional label of the workspace edit. This label is + // presented in the user interface for example on an undo + // stack to undo the workspace edit. + Label string `json:"label,omitempty"` + // The edits to apply. + Edit WorkspaceEdit `json:"edit"` } -// ImplementationOptions is -type ImplementationOptions struct { - WorkDoneProgressOptions +// The result returned from the apply workspace edit request. +// +// @since 3.17 renamed from ApplyWorkspaceEditResponse +type ApplyWorkspaceEditResult struct { + // Indicates whether the edit was applied or not. + Applied bool `json:"applied"` + // An optional textual description for why the edit was not applied. + // This may be used by the server for diagnostic logging or to provide + // a suitable error for a request that triggered the edit. + FailureReason string `json:"failureReason,omitempty"` + // Depending on the client's failure handling strategy `failedChange` might + // contain the index of the change that failed. This property is only available + // if the client signals a `failureHandlingStrategy` in its client capabilities. + FailedChange uint32 `json:"failedChange,omitempty"` } -// ImplementationRegistrationOptions is -type ImplementationRegistrationOptions struct { - TextDocumentRegistrationOptions - ImplementationOptions - StaticRegistrationOptions +// A base for all symbol information. +type BaseSymbolInformation struct { + // The name of this symbol. + Name string `json:"name"` + // The kind of this symbol. + Kind SymbolKind `json:"kind"` + // Tags for this symbol. + // + // @since 3.16.0 + Tags []SymbolTag `json:"tags,omitempty"` + // The name of the symbol containing this symbol. This information is for + // user interface purposes (e.g. to render a qualifier in the user interface + // if necessary). It can't be used to re-infer a hierarchy for the document + // symbols. + ContainerName string `json:"containerName,omitempty"` } -// ImplementationParams is -type ImplementationParams struct { - TextDocumentPositionParams - WorkDoneProgressParams - PartialResultParams +// @since 3.16.0 +type CallHierarchyClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is set to `true` + // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + // return value for the corresponding server capability as well. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } -/*TypeDefinitionClientCapabilities defined: - * Since 3.6.0 - */ -type TypeDefinitionClientCapabilities struct { +// Represents an incoming call, e.g. a caller of a method or constructor. +// +// @since 3.16.0 +type CallHierarchyIncomingCall struct { + // The item that makes the call. + From CallHierarchyItem `json:"from"` + // The ranges at which the calls appear. This is relative to the caller + // denoted by {@link CallHierarchyIncomingCall.from `this.from`}. + FromRanges []Range `json:"fromRanges"` +} - /*DynamicRegistration defined: - * Whether implementation supports dynamic registration. If this is set to `true` - * the client supports the new `TypeDefinitionRegistrationOptions` return value - * for the corresponding server capability as well. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// The parameter of a `callHierarchy/incomingCalls` request. +// +// @since 3.16.0 +type CallHierarchyIncomingCallsParams struct { + Item CallHierarchyItem `json:"item"` + WorkDoneProgressParams + PartialResultParams +} - /*LinkSupport defined: - * The client supports additional metadata in the form of definition links. - * - * Since 3.14.0 - */ - LinkSupport bool `json:"linkSupport,omitempty"` +// Represents programming constructs like functions or constructors in the context +// of call hierarchy. +// +// @since 3.16.0 +type CallHierarchyItem struct { + // The name of this item. + Name string `json:"name"` + // The kind of this item. + Kind SymbolKind `json:"kind"` + // Tags for this item. + Tags []SymbolTag `json:"tags,omitempty"` + // More detail for this item, e.g. the signature of a function. + Detail string `json:"detail,omitempty"` + // The resource identifier of this item. + URI DocumentURI `json:"uri"` + // The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. + Range Range `json:"range"` + // The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. + // Must be contained by the {@link CallHierarchyItem.range `range`}. + SelectionRange Range `json:"selectionRange"` + // A data entry field that is preserved between a call hierarchy prepare and + // incoming calls or outgoing calls requests. + Data interface{} `json:"data,omitempty"` } -// TypeDefinitionOptions is -type TypeDefinitionOptions struct { +// Call hierarchy options used during static registration. +// +// @since 3.16.0 +type CallHierarchyOptions struct { WorkDoneProgressOptions } -// TypeDefinitionRegistrationOptions is -type TypeDefinitionRegistrationOptions struct { - TextDocumentRegistrationOptions - TypeDefinitionOptions - StaticRegistrationOptions +// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc. +// +// @since 3.16.0 +type CallHierarchyOutgoingCall struct { + // The item that is called. + To CallHierarchyItem `json:"to"` + // The range at which this item is called. This is the range relative to the caller, e.g the item + // passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`} + // and not {@link CallHierarchyOutgoingCall.to `this.to`}. + FromRanges []Range `json:"fromRanges"` } -// TypeDefinitionParams is -type TypeDefinitionParams struct { - TextDocumentPositionParams +// The parameter of a `callHierarchy/outgoingCalls` request. +// +// @since 3.16.0 +type CallHierarchyOutgoingCallsParams struct { + Item CallHierarchyItem `json:"item"` WorkDoneProgressParams PartialResultParams } -// WorkspaceFoldersInitializeParams is -type WorkspaceFoldersInitializeParams struct { - - /*WorkspaceFolders defined: - * The actual configured workspace folders. - */ - WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders"` +// The parameter of a `textDocument/prepareCallHierarchy` request. +// +// @since 3.16.0 +type CallHierarchyPrepareParams struct { + TextDocumentPositionParams + WorkDoneProgressParams } -// WorkspaceFoldersClientCapabilities is -type WorkspaceFoldersClientCapabilities struct { - - /*Workspace defined: - * The workspace client capabilities - */ - Workspace *struct { - - /*WorkspaceFolders defined: - * The client has support for workspace folders - */ - WorkspaceFolders bool `json:"workspaceFolders,omitempty"` - } `json:"workspace,omitempty"` +// Call hierarchy options used during static or dynamic registration. +// +// @since 3.16.0 +type CallHierarchyRegistrationOptions struct { + TextDocumentRegistrationOptions + CallHierarchyOptions + StaticRegistrationOptions } - -// WorkspaceFoldersServerCapabilities is -type WorkspaceFoldersServerCapabilities struct { - - /*Workspace defined: - * The workspace server capabilities - */ - Workspace *struct { - - // WorkspaceFolders is - WorkspaceFolders *struct { - - /*Supported defined: - * The Server has support for workspace folders - */ - Supported bool `json:"supported,omitempty"` - - /*ChangeNotifications defined: - * Whether the server wants to receive workspace folder - * change notifications. - * - * If a strings is provided the string is treated as a ID - * under which the notification is registed on the client - * side. The ID can be used to unregister for these events - * using the `client/unregisterCapability` request. - */ - ChangeNotifications interface{} `json:"changeNotifications,omitempty"` // string | boolean - } `json:"workspaceFolders,omitempty"` - } `json:"workspace,omitempty"` -} - -// WorkspaceFolder is -type WorkspaceFolder struct { - - /*URI defined: - * The associated URI for this workspace folder. - */ - URI string `json:"uri"` - - /*Name defined: - * The name of the workspace folder. Used to refer to this - * workspace folder in thge user interface. - */ - Name string `json:"name"` +type CancelParams struct { + // The request id to cancel. + ID interface{} `json:"id"` } -/*DidChangeWorkspaceFoldersParams defined: - * The parameters of a `workspace/didChangeWorkspaceFolders` notification. - */ -type DidChangeWorkspaceFoldersParams struct { - - /*Event defined: - * The actual workspace folder change event. - */ - Event WorkspaceFoldersChangeEvent `json:"event"` +// Additional information that describes document changes. +// +// @since 3.16.0 +type ChangeAnnotation struct { + // A human-readable string describing the actual change. The string + // is rendered prominent in the user interface. + Label string `json:"label"` + // A flag which indicates that user confirmation is needed + // before applying the change. + NeedsConfirmation bool `json:"needsConfirmation,omitempty"` + // A human-readable string which is rendered less prominent in + // the user interface. + Description string `json:"description,omitempty"` } -/*WorkspaceFoldersChangeEvent defined: - * The workspace folder change event. - */ -type WorkspaceFoldersChangeEvent struct { - - /*Added defined: - * The array of added workspace folders - */ - Added []WorkspaceFolder `json:"added"` +// An identifier to refer to a change annotation stored with a workspace edit. +type ChangeAnnotationIdentifier = string // (alias) line 14397 +// Defines the capabilities provided by the client. +type ClientCapabilities struct { + // Workspace specific client capabilities. + Workspace *WorkspaceClientCapabilities `json:"workspace,omitempty"` + // Text document specific client capabilities. + TextDocument *TextDocumentClientCapabilities `json:"textDocument,omitempty"` + // Capabilities specific to the notebook document support. + // + // @since 3.17.0 + NotebookDocument *NotebookDocumentClientCapabilities `json:"notebookDocument,omitempty"` + // Window specific client capabilities. + Window *WindowClientCapabilities `json:"window,omitempty"` + // General client capabilities. + // + // @since 3.16.0 + General *GeneralClientCapabilities `json:"general,omitempty"` + // Experimental client capabilities. + Experimental interface{} `json:"experimental,omitempty"` +} - /*Removed defined: - * The array of the removed workspace folders - */ - Removed []WorkspaceFolder `json:"removed"` +// A code action represents a change that can be performed in code, e.g. to fix a problem or +// to refactor code. +// +// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. +type CodeAction struct { + // A short, human-readable, title for this code action. + Title string `json:"title"` + // The kind of the code action. + // + // Used to filter code actions. + Kind *CodeActionKind `json:"kind,omitempty"` + // The diagnostics that this code action resolves. + Diagnostics []Diagnostic `json:"diagnostics,omitempty"` + // Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted + // by keybindings. + // + // A quick fix should be marked preferred if it properly addresses the underlying error. + // A refactoring should be marked preferred if it is the most reasonable choice of actions to take. + // + // @since 3.15.0 + IsPreferred bool `json:"isPreferred,omitempty"` + // Marks that the code action cannot currently be applied. + // + // Clients should follow the following guidelines regarding disabled code actions: + // + // - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) + // code action menus. + // + // - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type + // of code action, such as refactorings. + // + // - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) + // that auto applies a code action and only disabled code actions are returned, the client should show the user an + // error message with `reason` in the editor. + // + // @since 3.16.0 + Disabled *PDisabledMsg_textDocument_codeAction `json:"disabled,omitempty"` + // The workspace edit this code action performs. + Edit *WorkspaceEdit `json:"edit,omitempty"` + // A command this code action executes. If a code action + // provides an edit and a command, first the edit is + // executed and then the command. + Command *Command `json:"command,omitempty"` + // A data entry field that is preserved on a code action between + // a `textDocument/codeAction` and a `codeAction/resolve` request. + // + // @since 3.16.0 + Data interface{} `json:"data,omitempty"` } -// ConfigurationClientCapabilities is -type ConfigurationClientCapabilities struct { +// The Client Capabilities of a {@link CodeActionRequest}. +type CodeActionClientCapabilities struct { + // Whether code action supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // The client support code action literals of type `CodeAction` as a valid + // response of the `textDocument/codeAction` request. If the property is not + // set the request can only return `Command` literals. + // + // @since 3.8.0 + CodeActionLiteralSupport *PCodeActionLiteralSupportPCodeAction `json:"codeActionLiteralSupport,omitempty"` + // Whether code action supports the `isPreferred` property. + // + // @since 3.15.0 + IsPreferredSupport bool `json:"isPreferredSupport,omitempty"` + // Whether code action supports the `disabled` property. + // + // @since 3.16.0 + DisabledSupport bool `json:"disabledSupport,omitempty"` + // Whether code action supports the `data` property which is + // preserved between a `textDocument/codeAction` and a + // `codeAction/resolve` request. + // + // @since 3.16.0 + DataSupport bool `json:"dataSupport,omitempty"` + // Whether the client supports resolving additional code action + // properties via a separate `codeAction/resolve` request. + // + // @since 3.16.0 + ResolveSupport *PResolveSupportPCodeAction `json:"resolveSupport,omitempty"` + // Whether the client honors the change annotations in + // text edits and resource operations returned via the + // `CodeAction#edit` property by for example presenting + // the workspace edit in the user interface and asking + // for confirmation. + // + // @since 3.16.0 + HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"` +} + +// Contains additional diagnostic information about the context in which +// a {@link CodeActionProvider.provideCodeActions code action} is run. +type CodeActionContext struct { + // An array of diagnostics known on the client side overlapping the range provided to the + // `textDocument/codeAction` request. They are provided so that the server knows which + // errors are currently presented to the user for the given range. There is no guarantee + // that these accurately reflect the error state of the resource. The primary parameter + // to compute code actions is the provided range. + Diagnostics []Diagnostic `json:"diagnostics"` + // Requested kind of actions to return. + // + // Actions not of this kind are filtered out by the client before being shown. So servers + // can omit computing them. + Only []CodeActionKind `json:"only,omitempty"` + // The reason why code actions were requested. + // + // @since 3.17.0 + TriggerKind *CodeActionTriggerKind `json:"triggerKind,omitempty"` +} - /*Workspace defined: - * The workspace client capabilities - */ - Workspace *struct { +// A set of predefined code action kinds +type CodeActionKind string - /*Configuration defined: - * The client supports `workspace/configuration` requests. - */ - Configuration bool `json:"configuration,omitempty"` - } `json:"workspace,omitempty"` +// Provider options for a {@link CodeActionRequest}. +type CodeActionOptions struct { + // CodeActionKinds that this server may return. + // + // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + // may list out every specific kind they provide. + CodeActionKinds []CodeActionKind `json:"codeActionKinds,omitempty"` + // The server provides support to resolve additional + // information for a code action. + // + // @since 3.16.0 + ResolveProvider bool `json:"resolveProvider,omitempty"` + WorkDoneProgressOptions } -// ConfigurationItem is -type ConfigurationItem struct { - - /*ScopeURI defined: - * The scope to get the configuration section for. - */ - ScopeURI string `json:"scopeUri,omitempty"` +// The parameters of a {@link CodeActionRequest}. +type CodeActionParams struct { + // The document in which the command was invoked. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The range for which the command was invoked. + Range Range `json:"range"` + // Context carrying additional information. + Context CodeActionContext `json:"context"` + WorkDoneProgressParams + PartialResultParams +} - /*Section defined: - * The configuration section asked for. - */ - Section string `json:"section,omitempty"` +// Registration options for a {@link CodeActionRequest}. +type CodeActionRegistrationOptions struct { + TextDocumentRegistrationOptions + CodeActionOptions } -/*ConfigurationParams defined: - * The parameters of a configuration request. - */ -type ConfigurationParams struct { +// The reason why code actions were requested. +// +// @since 3.17.0 +type CodeActionTriggerKind uint32 - // Items is - Items []ConfigurationItem `json:"items"` +// Structure to capture a description for an error code. +// +// @since 3.16.0 +type CodeDescription struct { + // An URI to open with more information about the diagnostic error. + Href URI `json:"href"` } -// DocumentColorClientCapabilities is -type DocumentColorClientCapabilities struct { +// A code lens represents a {@link Command command} that should be shown along with +// source text, like the number of references, a way to run tests, etc. +// +// A code lens is _unresolved_ when no command is associated to it. For performance +// reasons the creation of a code lens and resolving should be done in two stages. +type CodeLens struct { + // The range in which this code lens is valid. Should only span a single line. + Range Range `json:"range"` + // The command this code lens represents. + Command *Command `json:"command,omitempty"` + // A data entry field that is preserved on a code lens item between + // a {@link CodeLensRequest} and a {@link CodeLensResolveRequest} + Data interface{} `json:"data,omitempty"` +} - /*DynamicRegistration defined: - * Whether implementation supports dynamic registration. If this is set to `true` - * the client supports the new `DocumentColorRegistrationOptions` return value - * for the corresponding server capability as well. - */ +// The client capabilities of a {@link CodeLensRequest}. +type CodeLensClientCapabilities struct { + // Whether code lens supports dynamic registration. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } -// DocumentColorOptions is -type DocumentColorOptions struct { - - /*ResolveProvider defined: - * Code lens has a resolve provider as well. - */ +// Code Lens provider options of a {@link CodeLensRequest}. +type CodeLensOptions struct { + // Code lens has a resolve provider as well. ResolveProvider bool `json:"resolveProvider,omitempty"` WorkDoneProgressOptions } -// DocumentColorRegistrationOptions is -type DocumentColorRegistrationOptions struct { - TextDocumentRegistrationOptions - StaticRegistrationOptions - DocumentColorOptions -} - -/*DocumentColorParams defined: - * Parameters for a [DocumentColorRequest](#DocumentColorRequest). - */ -type DocumentColorParams struct { - - /*TextDocument defined: - * The text document. - */ +// The parameters of a {@link CodeLensRequest}. +type CodeLensParams struct { + // The document to request code lens for. TextDocument TextDocumentIdentifier `json:"textDocument"` WorkDoneProgressParams PartialResultParams } -/*ColorPresentationParams defined: - * Parameters for a [ColorPresentationRequest](#ColorPresentationRequest). - */ -type ColorPresentationParams struct { +// Registration options for a {@link CodeLensRequest}. +type CodeLensRegistrationOptions struct { + TextDocumentRegistrationOptions + CodeLensOptions +} - /*TextDocument defined: - * The text document. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` +// @since 3.16.0 +type CodeLensWorkspaceClientCapabilities struct { + // Whether the client implementation supports a refresh request sent from the + // server to the client. + // + // Note that this event is global and will force the client to refresh all + // code lenses currently shown. It should be used with absolute care and is + // useful for situation where a server for example detect a project wide + // change that requires such a calculation. + RefreshSupport bool `json:"refreshSupport,omitempty"` +} - /*Color defined: - * The color to request presentations for. - */ +// Represents a color in RGBA space. +type Color struct { + // The red component of this color in the range [0-1]. + Red float64 `json:"red"` + // The green component of this color in the range [0-1]. + Green float64 `json:"green"` + // The blue component of this color in the range [0-1]. + Blue float64 `json:"blue"` + // The alpha component of this color in the range [0-1]. + Alpha float64 `json:"alpha"` +} + +// Represents a color range from a document. +type ColorInformation struct { + // The range in the document where this color appears. + Range Range `json:"range"` + // The actual color value for this color range. Color Color `json:"color"` +} +type ColorPresentation struct { + // The label of this color presentation. It will be shown on the color + // picker header. By default this is also the text that is inserted when selecting + // this color presentation. + Label string `json:"label"` + // An {@link TextEdit edit} which is applied to a document when selecting + // this presentation for the color. When `falsy` the {@link ColorPresentation.label label} + // is used. + TextEdit *TextEdit `json:"textEdit,omitempty"` + // An optional array of additional {@link TextEdit text edits} that are applied when + // selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves. + AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` +} - /*Range defined: - * The range where the color would be inserted. Serves as a context. - */ +// Parameters for a {@link ColorPresentationRequest}. +type ColorPresentationParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The color to request presentations for. + Color Color `json:"color"` + // The range where the color would be inserted. Serves as a context. Range Range `json:"range"` WorkDoneProgressParams PartialResultParams } -// FoldingRangeClientCapabilities is -type FoldingRangeClientCapabilities struct { +// Represents a reference to a command. Provides a title which +// will be used to represent a command in the UI and, optionally, +// an array of arguments which will be passed to the command handler +// function when invoked. +type Command struct { + // Title of the command, like `save`. + Title string `json:"title"` + // The identifier of the actual command handler. + Command string `json:"command"` + // Arguments that the command handler should be + // invoked with. + Arguments []json.RawMessage `json:"arguments,omitempty"` +} - /*DynamicRegistration defined: - * Whether implementation supports dynamic registration for folding range providers. If this is set to `true` - * the client supports the new `FoldingRangeRegistrationOptions` return value for the corresponding server - * capability as well. - */ +// Completion client capabilities +type CompletionClientCapabilities struct { + // Whether completion supports dynamic registration. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // The client supports the following `CompletionItem` specific + // capabilities. + CompletionItem *PCompletionItemPCompletion `json:"completionItem,omitempty"` + CompletionItemKind *PCompletionItemKindPCompletion `json:"completionItemKind,omitempty"` + // Defines how the client handles whitespace and indentation + // when accepting a completion item that uses multi line + // text in either `insertText` or `textEdit`. + // + // @since 3.17.0 + InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"` + // The client supports to send additional context information for a + // `textDocument/completion` request. + ContextSupport bool `json:"contextSupport,omitempty"` + // The client supports the following `CompletionList` specific + // capabilities. + // + // @since 3.17.0 + CompletionList *PCompletionListPCompletion `json:"completionList,omitempty"` +} - /*RangeLimit defined: - * The maximum number of folding ranges that the client prefers to receive per document. The value serves as a - * hint, servers are free to follow the limit. - */ - RangeLimit float64 `json:"rangeLimit,omitempty"` +// Contains additional information about the context in which a completion request is triggered. +type CompletionContext struct { + // How the completion was triggered. + TriggerKind CompletionTriggerKind `json:"triggerKind"` + // The trigger character (a single character) that has trigger code complete. + // Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` + TriggerCharacter string `json:"triggerCharacter,omitempty"` +} - /*LineFoldingOnly defined: - * If set, the client signals that it only supports folding complete lines. If set, client will - * ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. - */ - LineFoldingOnly bool `json:"lineFoldingOnly,omitempty"` +// A completion item represents a text snippet that is +// proposed to complete text that is being typed. +type CompletionItem struct { + // The label of this completion item. + // + // The label property is also by default the text that + // is inserted when selecting this completion. + // + // If label details are provided the label itself should + // be an unqualified name of the completion item. + Label string `json:"label"` + // Additional details for the label + // + // @since 3.17.0 + LabelDetails *CompletionItemLabelDetails `json:"labelDetails,omitempty"` + // The kind of this completion item. Based of the kind + // an icon is chosen by the editor. + Kind *CompletionItemKind `json:"kind,omitempty"` + // Tags for this completion item. + // + // @since 3.15.0 + Tags []CompletionItemTag `json:"tags,omitempty"` + // A human-readable string with additional information + // about this item, like type or symbol information. + Detail string `json:"detail,omitempty"` + // A human-readable string that represents a doc-comment. + Documentation *Or_CompletionItem_documentation `json:"documentation,omitempty"` + // Indicates if this item is deprecated. + // @deprecated Use `tags` instead. + Deprecated bool `json:"deprecated,omitempty"` + // Select this item when showing. + // + // *Note* that only one completion item can be selected and that the + // tool / client decides which item that is. The rule is that the *first* + // item of those that match best is selected. + Preselect bool `json:"preselect,omitempty"` + // A string that should be used when comparing this item + // with other items. When `falsy` the {@link CompletionItem.label label} + // is used. + SortText string `json:"sortText,omitempty"` + // A string that should be used when filtering a set of + // completion items. When `falsy` the {@link CompletionItem.label label} + // is used. + FilterText string `json:"filterText,omitempty"` + // A string that should be inserted into a document when selecting + // this completion. When `falsy` the {@link CompletionItem.label label} + // is used. + // + // The `insertText` is subject to interpretation by the client side. + // Some tools might not take the string literally. For example + // VS Code when code complete is requested in this example + // `con` and a completion item with an `insertText` of + // `console` is provided it will only insert `sole`. Therefore it is + // recommended to use `textEdit` instead since it avoids additional client + // side interpretation. + InsertText string `json:"insertText,omitempty"` + // The format of the insert text. The format applies to both the + // `insertText` property and the `newText` property of a provided + // `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`. + // + // Please note that the insertTextFormat doesn't apply to + // `additionalTextEdits`. + InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"` + // How whitespace and indentation is handled during completion + // item insertion. If not provided the clients default value depends on + // the `textDocument.completion.insertTextMode` client capability. + // + // @since 3.16.0 + InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"` + // An {@link TextEdit edit} which is applied to a document when selecting + // this completion. When an edit is provided the value of + // {@link CompletionItem.insertText insertText} is ignored. + // + // Most editors support two different operations when accepting a completion + // item. One is to insert a completion text and the other is to replace an + // existing text with a completion text. Since this can usually not be + // predetermined by a server it can report both ranges. Clients need to + // signal support for `InsertReplaceEdits` via the + // `textDocument.completion.insertReplaceSupport` client capability + // property. + // + // *Note 1:* The text edit's range as well as both ranges from an insert + // replace edit must be a [single line] and they must contain the position + // at which completion has been requested. + // *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range + // must be a prefix of the edit's replace range, that means it must be + // contained and starting at the same position. + // + // @since 3.16.0 additional type `InsertReplaceEdit` + TextEdit *TextEdit `json:"textEdit,omitempty"` + // The edit text used if the completion item is part of a CompletionList and + // CompletionList defines an item default for the text edit range. + // + // Clients will only honor this property if they opt into completion list + // item defaults using the capability `completionList.itemDefaults`. + // + // If not provided and a list's default range is provided the label + // property is used as a text. + // + // @since 3.17.0 + TextEditText string `json:"textEditText,omitempty"` + // An optional array of additional {@link TextEdit text edits} that are applied when + // selecting this completion. Edits must not overlap (including the same insert position) + // with the main {@link CompletionItem.textEdit edit} nor with themselves. + // + // Additional text edits should be used to change text unrelated to the current cursor position + // (for example adding an import statement at the top of the file if the completion item will + // insert an unqualified type). + AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` + // An optional set of characters that when pressed while this completion is active will accept it first and + // then type that character. *Note* that all commit characters should have `length=1` and that superfluous + // characters will be ignored. + CommitCharacters []string `json:"commitCharacters,omitempty"` + // An optional {@link Command command} that is executed *after* inserting this completion. *Note* that + // additional modifications to the current document should be described with the + // {@link CompletionItem.additionalTextEdits additionalTextEdits}-property. + Command *Command `json:"command,omitempty"` + // A data entry field that is preserved on a completion item between a + // {@link CompletionRequest} and a {@link CompletionResolveRequest}. + Data interface{} `json:"data,omitempty"` } -// FoldingRangeOptions is -type FoldingRangeOptions struct { +// The kind of a completion entry. +type CompletionItemKind uint32 + +// Additional details for a completion item label. +// +// @since 3.17.0 +type CompletionItemLabelDetails struct { + // An optional string which is rendered less prominently directly after {@link CompletionItem.label label}, + // without any spacing. Should be used for function signatures and type annotations. + Detail string `json:"detail,omitempty"` + // An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used + // for fully qualified names and file paths. + Description string `json:"description,omitempty"` +} + +// Completion item tags are extra annotations that tweak the rendering of a completion +// item. +// +// @since 3.15.0 +type CompletionItemTag uint32 + +// Represents a collection of {@link CompletionItem completion items} to be presented +// in the editor. +type CompletionList struct { + // This list it not complete. Further typing results in recomputing this list. + // + // Recomputed lists have all their items replaced (not appended) in the + // incomplete completion sessions. + IsIncomplete bool `json:"isIncomplete"` + // In many cases the items of an actual completion result share the same + // value for properties like `commitCharacters` or the range of a text + // edit. A completion list can therefore define item defaults which will + // be used if a completion item itself doesn't specify the value. + // + // If a completion list specifies a default value and a completion item + // also specifies a corresponding value the one from the item is used. + // + // Servers are only allowed to return default values if the client + // signals support for this via the `completionList.itemDefaults` + // capability. + // + // @since 3.17.0 + ItemDefaults *PItemDefaultsMsg_textDocument_completion `json:"itemDefaults,omitempty"` + // The completion items. + Items []CompletionItem `json:"items"` +} + +// Completion options. +type CompletionOptions struct { + // Most tools trigger completion request automatically without explicitly requesting + // it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + // starts to type an identifier. For example if the user types `c` in a JavaScript file + // code complete will automatically pop up present `console` besides others as a + // completion item. Characters that make up identifiers don't need to be listed here. + // + // If code complete should automatically be trigger on characters not being valid inside + // an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + TriggerCharacters []string `json:"triggerCharacters,omitempty"` + // The list of all possible characters that commit a completion. This field can be used + // if clients don't support individual commit characters per completion item. See + // `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + // + // If a server provides both `allCommitCharacters` and commit characters on an individual + // completion item the ones on the completion item win. + // + // @since 3.2.0 + AllCommitCharacters []string `json:"allCommitCharacters,omitempty"` + // The server provides support to resolve additional + // information for a completion item. + ResolveProvider bool `json:"resolveProvider,omitempty"` + // The server supports the following `CompletionItem` specific + // capabilities. + // + // @since 3.17.0 + CompletionItem *PCompletionItemPCompletionProvider `json:"completionItem,omitempty"` WorkDoneProgressOptions } -// FoldingRangeRegistrationOptions is -type FoldingRangeRegistrationOptions struct { +// Completion parameters +type CompletionParams struct { + // The completion context. This is only available it the client specifies + // to send this using the client capability `textDocument.completion.contextSupport === true` + Context *CompletionContext `json:"context,omitempty"` + TextDocumentPositionParams + WorkDoneProgressParams + PartialResultParams +} + +// Registration options for a {@link CompletionRequest}. +type CompletionRegistrationOptions struct { TextDocumentRegistrationOptions - FoldingRangeOptions - StaticRegistrationOptions + CompletionOptions } -/*FoldingRange defined: - * Represents a folding range. - */ -type FoldingRange struct { +// How a completion was triggered +type CompletionTriggerKind uint32 +type ConfigurationItem struct { + // The scope to get the configuration section for. + ScopeURI string `json:"scopeUri,omitempty"` + // The configuration section asked for. + Section string `json:"section,omitempty"` +} - /*StartLine defined: - * The zero-based line number from where the folded range starts. - */ - StartLine float64 `json:"startLine"` - - /*StartCharacter defined: - * The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. - */ - StartCharacter float64 `json:"startCharacter,omitempty"` - - /*EndLine defined: - * The zero-based line number where the folded range ends. - */ - EndLine float64 `json:"endLine"` - - /*EndCharacter defined: - * The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. - */ - EndCharacter float64 `json:"endCharacter,omitempty"` - - /*Kind defined: - * Describes the kind of the folding range such as `comment' or 'region'. The kind - * is used to categorize folding ranges and used by commands like 'Fold all comments'. See - * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds. - */ - Kind string `json:"kind,omitempty"` +// The parameters of a configuration request. +type ConfigurationParams struct { + Items []ConfigurationItem `json:"items"` } -/*FoldingRangeParams defined: - * Parameters for a [FoldingRangeRequest](#FoldingRangeRequest). - */ -type FoldingRangeParams struct { +// Create file operation. +type CreateFile struct { + // A create + Kind string `json:"kind"` + // The resource to create. + URI DocumentURI `json:"uri"` + // Additional options + Options *CreateFileOptions `json:"options,omitempty"` + ResourceOperation +} - /*TextDocument defined: - * The text document. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` - WorkDoneProgressParams - PartialResultParams +// Options to create a file. +type CreateFileOptions struct { + // Overwrite existing file. Overwrite wins over `ignoreIfExists` + Overwrite bool `json:"overwrite,omitempty"` + // Ignore if exists. + IgnoreIfExists bool `json:"ignoreIfExists,omitempty"` } -/*DeclarationClientCapabilities defined: - * Since 3.14.0 - */ -type DeclarationClientCapabilities struct { +// The parameters sent in notifications/requests for user-initiated creation of +// files. +// +// @since 3.16.0 +type CreateFilesParams struct { + // An array of all files/folders created in this operation. + Files []FileCreate `json:"files"` +} - /*DynamicRegistration defined: - * Whether declaration supports dynamic registration. If this is set to `true` - * the client supports the new `DeclarationRegistrationOptions` return value - * for the corresponding server capability as well. - */ +// The declaration of a symbol representation as one or many {@link Location locations}. +type Declaration = []Location // (alias) line 14254 +// @since 3.14.0 +type DeclarationClientCapabilities struct { + // Whether declaration supports dynamic registration. If this is set to `true` + // the client supports the new `DeclarationRegistrationOptions` return value + // for the corresponding server capability as well. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` - - /*LinkSupport defined: - * The client supports additional metadata in the form of declaration links. - */ + // The client supports additional metadata in the form of declaration links. LinkSupport bool `json:"linkSupport,omitempty"` } -// DeclarationOptions is +// Information about where a symbol is declared. +// +// Provides additional metadata over normal {@link Location location} declarations, including the range of +// the declaring symbol. +// +// Servers should prefer returning `DeclarationLink` over `Declaration` if supported +// by the client. +type DeclarationLink = LocationLink // (alias) line 14274 type DeclarationOptions struct { WorkDoneProgressOptions } - -// DeclarationRegistrationOptions is +type DeclarationParams struct { + TextDocumentPositionParams + WorkDoneProgressParams + PartialResultParams +} type DeclarationRegistrationOptions struct { DeclarationOptions TextDocumentRegistrationOptions StaticRegistrationOptions } -// DeclarationParams is -type DeclarationParams struct { +// The definition of a symbol represented as one or many {@link Location locations}. +// For most programming languages there is only one location at which a symbol is +// defined. +// +// Servers should prefer returning `DefinitionLink` over `Definition` if supported +// by the client. +type Definition = Or_Definition // (alias) line 14172 +// Client Capabilities for a {@link DefinitionRequest}. +type DefinitionClientCapabilities struct { + // Whether definition supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // The client supports additional metadata in the form of definition links. + // + // @since 3.14.0 + LinkSupport bool `json:"linkSupport,omitempty"` +} + +// Information about where a symbol is defined. +// +// Provides additional metadata over normal {@link Location location} definitions, including the range of +// the defining symbol +type DefinitionLink = LocationLink // (alias) line 14192 +// Server Capabilities for a {@link DefinitionRequest}. +type DefinitionOptions struct { + WorkDoneProgressOptions +} + +// Parameters for a {@link DefinitionRequest}. +type DefinitionParams struct { TextDocumentPositionParams WorkDoneProgressParams PartialResultParams } -// SelectionRangeClientCapabilities is -type SelectionRangeClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether implementation supports dynamic registration for selection range providers. If this is set to `true` - * the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server - * capability as well. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// Registration options for a {@link DefinitionRequest}. +type DefinitionRegistrationOptions struct { + TextDocumentRegistrationOptions + DefinitionOptions } -// SelectionRangeOptions is -type SelectionRangeOptions struct { - WorkDoneProgressOptions +// Delete file operation +type DeleteFile struct { + // A delete + Kind string `json:"kind"` + // The file to delete. + URI DocumentURI `json:"uri"` + // Delete options. + Options *DeleteFileOptions `json:"options,omitempty"` + ResourceOperation } -// SelectionRangeRegistrationOptions is -type SelectionRangeRegistrationOptions struct { - SelectionRangeOptions - TextDocumentRegistrationOptions - StaticRegistrationOptions +// Delete file options +type DeleteFileOptions struct { + // Delete the content recursively if a folder is denoted. + Recursive bool `json:"recursive,omitempty"` + // Ignore the operation if the file doesn't exist. + IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"` } -/*SelectionRangeParams defined: - * A parameter literal used in selection range requests. - */ -type SelectionRangeParams struct { - - /*TextDocument defined: - * The text document. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` - - /*Positions defined: - * The positions inside the text document. - */ - Positions []Position `json:"positions"` - WorkDoneProgressParams - PartialResultParams +// The parameters sent in notifications/requests for user-initiated deletes of +// files. +// +// @since 3.16.0 +type DeleteFilesParams struct { + // An array of all files/folders deleted in this operation. + Files []FileDelete `json:"files"` } -/*Registration defined: - * General parameters to to register for an notification or to register a provider. - */ -type Registration struct { - - /*ID defined: - * The id used to register the request. The id can be used to deregister - * the request again. - */ - ID string `json:"id"` - - /*Method defined: - * The method to register for. - */ - Method string `json:"method"` +// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects +// are only valid in the scope of a resource. +type Diagnostic struct { + // The range at which the message applies + Range Range `json:"range"` + // The diagnostic's severity. Can be omitted. If omitted it is up to the + // client to interpret diagnostics as error, warning, info or hint. + Severity *DiagnosticSeverity `json:"severity,omitempty"` + // The diagnostic's code, which usually appear in the user interface. + Code interface{} `json:"code,omitempty"` + // An optional property to describe the error code. + // Requires the code field (above) to be present/not null. + // + // @since 3.16.0 + CodeDescription *CodeDescription `json:"codeDescription,omitempty"` + // A human-readable string describing the source of this + // diagnostic, e.g. 'typescript' or 'super lint'. It usually + // appears in the user interface. + Source string `json:"source,omitempty"` + // The diagnostic's message. It usually appears in the user interface + Message string `json:"message"` + // Additional metadata about the diagnostic. + // + // @since 3.15.0 + Tags []DiagnosticTag `json:"tags,omitempty"` + // An array of related diagnostic information, e.g. when symbol-names within + // a scope collide all definitions can be marked via this property. + RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"` + // A data entry field that is preserved between a `textDocument/publishDiagnostics` + // notification and `textDocument/codeAction` request. + // + // @since 3.16.0 + Data *json.RawMessage `json:"data,omitempty"` +} + +// Client capabilities specific to diagnostic pull requests. +// +// @since 3.17.0 +type DiagnosticClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is set to `true` + // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + // return value for the corresponding server capability as well. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Whether the clients supports related documents for document diagnostic pulls. + RelatedDocumentSupport bool `json:"relatedDocumentSupport,omitempty"` +} + +// Diagnostic options. +// +// @since 3.17.0 +type DiagnosticOptions struct { + // An optional identifier under which the diagnostics are + // managed by the client. + Identifier string `json:"identifier,omitempty"` + // Whether the language has inter file dependencies meaning that + // editing code in one file can result in a different diagnostic + // set in another file. Inter file dependencies are common for + // most programming languages and typically uncommon for linters. + InterFileDependencies bool `json:"interFileDependencies"` + // The server provides support for workspace diagnostics as well. + WorkspaceDiagnostics bool `json:"workspaceDiagnostics"` + WorkDoneProgressOptions +} - /*RegisterOptions defined: - * Options necessary for the registration. - */ - RegisterOptions interface{} `json:"registerOptions,omitempty"` +// Diagnostic registration options. +// +// @since 3.17.0 +type DiagnosticRegistrationOptions struct { + TextDocumentRegistrationOptions + DiagnosticOptions + StaticRegistrationOptions } -// RegistrationParams is -type RegistrationParams struct { +// Represents a related message and source code location for a diagnostic. This should be +// used to point to code locations that cause or related to a diagnostics, e.g when duplicating +// a symbol in a scope. +type DiagnosticRelatedInformation struct { + // The location of this related diagnostic information. + Location Location `json:"location"` + // The message of this related diagnostic information. + Message string `json:"message"` +} - // Registrations is - Registrations []Registration `json:"registrations"` +// Cancellation data returned from a diagnostic request. +// +// @since 3.17.0 +type DiagnosticServerCancellationData struct { + RetriggerRequest bool `json:"retriggerRequest"` } -/*Unregistration defined: - * General parameters to unregister a request or notification. - */ -type Unregistration struct { +// The diagnostic's severity. +type DiagnosticSeverity uint32 - /*ID defined: - * The id used to unregister the request or notification. Usually an id - * provided during the register request. - */ - ID string `json:"id"` +// The diagnostic tags. +// +// @since 3.15.0 +type DiagnosticTag uint32 - /*Method defined: - * The method to unregister for. - */ - Method string `json:"method"` +// Workspace client capabilities specific to diagnostic pull requests. +// +// @since 3.17.0 +type DiagnosticWorkspaceClientCapabilities struct { + // Whether the client implementation supports a refresh request sent from + // the server to the client. + // + // Note that this event is global and will force the client to refresh all + // pulled diagnostics currently shown. It should be used with absolute care and + // is useful for situation where a server for example detects a project wide + // change that requires such a calculation. + RefreshSupport bool `json:"refreshSupport,omitempty"` } - -// UnregistrationParams is -type UnregistrationParams struct { - - // Unregisterations is - Unregisterations []Unregistration `json:"unregisterations"` +type DidChangeConfigurationClientCapabilities struct { + // Did change configuration notification supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } -// WorkDoneProgressParams is -type WorkDoneProgressParams struct { +// The parameters of a change configuration notification. +type DidChangeConfigurationParams struct { + // The actual changed settings + Settings interface{} `json:"settings"` +} +type DidChangeConfigurationRegistrationOptions struct { + Section *OrPSection_workspace_didChangeConfiguration `json:"section,omitempty"` +} + +// The params sent in a change notebook document notification. +// +// @since 3.17.0 +type DidChangeNotebookDocumentParams struct { + // The notebook document that did change. The version number points + // to the version after all provided changes have been applied. If + // only the text document content of a cell changes the notebook version + // doesn't necessarily have to change. + NotebookDocument VersionedNotebookDocumentIdentifier `json:"notebookDocument"` + // The actual changes to the notebook document. + // + // The changes describe single state changes to the notebook document. + // So if there are two changes c1 (at array index 0) and c2 (at array + // index 1) for a notebook in state S then c1 moves the notebook from + // S to S' and c2 from S' to S''. So c1 is computed on the state S and + // c2 is computed on the state S'. + // + // To mirror the content of a notebook using change events use the following approach: + // + // - start with the same initial content + // - apply the 'notebookDocument/didChange' notifications in the order you receive them. + // - apply the `NotebookChangeEvent`s in a single notification in the order + // you receive them. + Change NotebookDocumentChangeEvent `json:"change"` +} + +// The change text document notification's parameters. +type DidChangeTextDocumentParams struct { + // The document that did change. The version number points + // to the version after all provided content changes have + // been applied. + TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` + // The actual content changes. The content changes describe single state changes + // to the document. So if there are two content changes c1 (at array index 0) and + // c2 (at array index 1) for a document in state S then c1 moves the document from + // S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed + // on the state S'. + // + // To mirror the content of a document using change events use the following approach: + // + // - start with the same initial content + // - apply the 'textDocument/didChange' notifications in the order you receive them. + // - apply the `TextDocumentContentChangeEvent`s in a single notification in the order + // you receive them. + ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"` +} +type DidChangeWatchedFilesClientCapabilities struct { + // Did change watched files notification supports dynamic registration. Please note + // that the current protocol doesn't support static configuration for file changes + // from the server side. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Whether the client has support for {@link RelativePattern relative pattern} + // or not. + // + // @since 3.17.0 + RelativePatternSupport bool `json:"relativePatternSupport,omitempty"` +} - /*WorkDoneToken defined: - * An optional token that a server can use to report work done progress. - */ - WorkDoneToken *ProgressToken `json:"workDoneToken,omitempty"` +// The watched files change notification's parameters. +type DidChangeWatchedFilesParams struct { + // The actual file events. + Changes []FileEvent `json:"changes"` } -// PartialResultParams is -type PartialResultParams struct { +// Describe options to be used when registered for text document change events. +type DidChangeWatchedFilesRegistrationOptions struct { + // The watchers to register. + Watchers []FileSystemWatcher `json:"watchers"` +} - /*PartialResultToken defined: - * An optional token that a server can use to report partial results (e.g. streaming) to - * the client. - */ - PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"` +// The parameters of a `workspace/didChangeWorkspaceFolders` notification. +type DidChangeWorkspaceFoldersParams struct { + // The actual workspace folder change event. + Event WorkspaceFoldersChangeEvent `json:"event"` } -/*TextDocumentPositionParams defined: - * A parameter literal used in requests to pass a text document and a position inside that - * document. - */ -type TextDocumentPositionParams struct { +// The params sent in a close notebook document notification. +// +// @since 3.17.0 +type DidCloseNotebookDocumentParams struct { + // The notebook document that got closed. + NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"` + // The text documents that represent the content + // of a notebook cell that got closed. + CellTextDocuments []TextDocumentIdentifier `json:"cellTextDocuments"` +} - /*TextDocument defined: - * The text document. - */ +// The parameters sent in a close text document notification +type DidCloseTextDocumentParams struct { + // The document that was closed. TextDocument TextDocumentIdentifier `json:"textDocument"` - - /*Position defined: - * The position inside the text document. - */ - Position Position `json:"position"` } -/*WorkspaceClientCapabilities defined: - * Workspace specific client capabilities. - */ -type WorkspaceClientCapabilities struct { - - /*ApplyEdit defined: - * The client supports applying batch edits - * to the workspace by supporting the request - * 'workspace/applyEdit' - */ - ApplyEdit bool `json:"applyEdit,omitempty"` - - /*WorkspaceEdit defined: - * Capabilities specific to `WorkspaceEdit`s - */ - WorkspaceEdit *WorkspaceEditClientCapabilities `json:"workspaceEdit,omitempty"` - - /*DidChangeConfiguration defined: - * Capabilities specific to the `workspace/didChangeConfiguration` notification. - */ - DidChangeConfiguration *DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitempty"` - - /*DidChangeWatchedFiles defined: - * Capabilities specific to the `workspace/didChangeWatchedFiles` notification. - */ - DidChangeWatchedFiles *DidChangeWatchedFilesClientCapabilities `json:"didChangeWatchedFiles,omitempty"` - - /*Symbol defined: - * Capabilities specific to the `workspace/symbol` request. - */ - Symbol *WorkspaceSymbolClientCapabilities `json:"symbol,omitempty"` - - /*ExecuteCommand defined: - * Capabilities specific to the `workspace/executeCommand` request. - */ - ExecuteCommand *ExecuteCommandClientCapabilities `json:"executeCommand,omitempty"` +// The params sent in an open notebook document notification. +// +// @since 3.17.0 +type DidOpenNotebookDocumentParams struct { + // The notebook document that got opened. + NotebookDocument NotebookDocument `json:"notebookDocument"` + // The text documents that represent the content + // of a notebook cell. + CellTextDocuments []TextDocumentItem `json:"cellTextDocuments"` } -/*TextDocumentClientCapabilities defined: - * Text document specific client capabilities. - */ -type TextDocumentClientCapabilities struct { - - /*Synchronization defined: - * Defines which synchronization capabilities the client supports. - */ - Synchronization *TextDocumentSyncClientCapabilities `json:"synchronization,omitempty"` - - /*Completion defined: - * Capabilities specific to the `textDocument/completion` - */ - Completion *CompletionClientCapabilities `json:"completion,omitempty"` - - /*Hover defined: - * Capabilities specific to the `textDocument/hover` - */ - Hover *HoverClientCapabilities `json:"hover,omitempty"` - - /*SignatureHelp defined: - * Capabilities specific to the `textDocument/signatureHelp` - */ - SignatureHelp *SignatureHelpClientCapabilities `json:"signatureHelp,omitempty"` - - /*Declaration defined: - * Capabilities specific to the `textDocument/declaration` - * - * @since 3.14.0 - */ - Declaration *DeclarationClientCapabilities `json:"declaration,omitempty"` - - /*Definition defined: - * Capabilities specific to the `textDocument/definition` - */ - Definition *DefinitionClientCapabilities `json:"definition,omitempty"` - - /*TypeDefinition defined: - * Capabilities specific to the `textDocument/typeDefinition` - * - * @since 3.6.0 - */ - TypeDefinition *TypeDefinitionClientCapabilities `json:"typeDefinition,omitempty"` - - /*Implementation defined: - * Capabilities specific to the `textDocument/implementation` - * - * @since 3.6.0 - */ - Implementation *ImplementationClientCapabilities `json:"implementation,omitempty"` - - /*References defined: - * Capabilities specific to the `textDocument/references` - */ - References *ReferenceClientCapabilities `json:"references,omitempty"` - - /*DocumentHighlight defined: - * Capabilities specific to the `textDocument/documentHighlight` - */ - DocumentHighlight *DocumentHighlightClientCapabilities `json:"documentHighlight,omitempty"` - - /*DocumentSymbol defined: - * Capabilities specific to the `textDocument/documentSymbol` - */ - DocumentSymbol *DocumentSymbolClientCapabilities `json:"documentSymbol,omitempty"` - - /*CodeAction defined: - * Capabilities specific to the `textDocument/codeAction` - */ - CodeAction *CodeActionClientCapabilities `json:"codeAction,omitempty"` - - /*CodeLens defined: - * Capabilities specific to the `textDocument/codeLens` - */ - CodeLens *CodeLensClientCapabilities `json:"codeLens,omitempty"` - - /*DocumentLink defined: - * Capabilities specific to the `textDocument/documentLink` - */ - DocumentLink *DocumentLinkClientCapabilities `json:"documentLink,omitempty"` - - /*ColorProvider defined: - * Capabilities specific to the `textDocument/documentColor` - */ - ColorProvider *DocumentColorClientCapabilities `json:"colorProvider,omitempty"` +// The parameters sent in an open text document notification +type DidOpenTextDocumentParams struct { + // The document that was opened. + TextDocument TextDocumentItem `json:"textDocument"` +} - /*Formatting defined: - * Capabilities specific to the `textDocument/formatting` - */ - Formatting *DocumentFormattingClientCapabilities `json:"formatting,omitempty"` +// The params sent in a save notebook document notification. +// +// @since 3.17.0 +type DidSaveNotebookDocumentParams struct { + // The notebook document that got saved. + NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"` +} - /*RangeFormatting defined: - * Capabilities specific to the `textDocument/rangeFormatting` - */ - RangeFormatting *DocumentRangeFormattingClientCapabilities `json:"rangeFormatting,omitempty"` +// The parameters sent in a save text document notification +type DidSaveTextDocumentParams struct { + // The document that was saved. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // Optional the content when saved. Depends on the includeText value + // when the save notification was requested. + Text string `json:"text,omitempty"` +} +type DocumentColorClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is set to `true` + // the client supports the new `DocumentColorRegistrationOptions` return value + // for the corresponding server capability as well. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +} +type DocumentColorOptions struct { + WorkDoneProgressOptions +} - /*OnTypeFormatting defined: - * Capabilities specific to the `textDocument/onTypeFormatting` - */ - OnTypeFormatting *DocumentOnTypeFormattingClientCapabilities `json:"onTypeFormatting,omitempty"` +// Parameters for a {@link DocumentColorRequest}. +type DocumentColorParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + WorkDoneProgressParams + PartialResultParams +} +type DocumentColorRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentColorOptions + StaticRegistrationOptions +} - /*Rename defined: - * Capabilities specific to the `textDocument/rename` - */ - Rename *RenameClientCapabilities `json:"rename,omitempty"` +// Parameters of the document diagnostic request. +// +// @since 3.17.0 +type DocumentDiagnosticParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The additional identifier provided during registration. + Identifier string `json:"identifier,omitempty"` + // The result id of a previous response if provided. + PreviousResultID string `json:"previousResultId,omitempty"` + WorkDoneProgressParams + PartialResultParams +} +type DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias) line 13909 +// The document diagnostic report kinds. +// +// @since 3.17.0 +type DocumentDiagnosticReportKind string + +// A partial result for a document diagnostic report. +// +// @since 3.17.0 +type DocumentDiagnosticReportPartialResult struct { + RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments"` +} + +// A document filter describes a top level text document or +// a notebook cell document. +// +// @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter. +type DocumentFilter = Or_DocumentFilter // (alias) line 14514 +// Client capabilities of a {@link DocumentFormattingRequest}. +type DocumentFormattingClientCapabilities struct { + // Whether formatting supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +} - /*FoldingRange defined: - * Capabilities specific to `textDocument/foldingRange` requests. - * - * @since 3.10.0 - */ - FoldingRange *FoldingRangeClientCapabilities `json:"foldingRange,omitempty"` +// Provider options for a {@link DocumentFormattingRequest}. +type DocumentFormattingOptions struct { + WorkDoneProgressOptions +} - /*SelectionRange defined: - * Capabilities specific to `textDocument/selectionRange` requests - * - * @since 3.15.0 - */ - SelectionRange *SelectionRangeClientCapabilities `json:"selectionRange,omitempty"` +// The parameters of a {@link DocumentFormattingRequest}. +type DocumentFormattingParams struct { + // The document to format. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The format options. + Options FormattingOptions `json:"options"` + WorkDoneProgressParams +} - /*PublishDiagnostics defined: - * Capabilities specific to `textDocument/publishDiagnostics`. - */ - PublishDiagnostics *PublishDiagnosticsClientCapabilities `json:"publishDiagnostics,omitempty"` +// Registration options for a {@link DocumentFormattingRequest}. +type DocumentFormattingRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentFormattingOptions } -/*InnerClientCapabilities defined: - * Defines the capabilities provided by the client. - */ -type InnerClientCapabilities struct { +// A document highlight is a range inside a text document which deserves +// special attention. Usually a document highlight is visualized by changing +// the background color of its range. +type DocumentHighlight struct { + // The range this highlight applies to. + Range Range `json:"range"` + // The highlight kind, default is {@link DocumentHighlightKind.Text text}. + Kind *DocumentHighlightKind `json:"kind,omitempty"` +} - /*Workspace defined: - * Workspace specific client capabilities. - */ - Workspace *WorkspaceClientCapabilities `json:"workspace,omitempty"` +// Client Capabilities for a {@link DocumentHighlightRequest}. +type DocumentHighlightClientCapabilities struct { + // Whether document highlight supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +} - /*TextDocument defined: - * Text document specific client capabilities. - */ - TextDocument *TextDocumentClientCapabilities `json:"textDocument,omitempty"` +// A document highlight kind. +type DocumentHighlightKind uint32 - /*Window defined: - * Window specific client capabilities. - */ - Window interface{} `json:"window,omitempty"` +// Provider options for a {@link DocumentHighlightRequest}. +type DocumentHighlightOptions struct { + WorkDoneProgressOptions +} - /*Experimental defined: - * Experimental client capabilities. - */ - Experimental interface{} `json:"experimental,omitempty"` +// Parameters for a {@link DocumentHighlightRequest}. +type DocumentHighlightParams struct { + TextDocumentPositionParams + WorkDoneProgressParams + PartialResultParams } -// ClientCapabilities is -type ClientCapabilities struct { +// Registration options for a {@link DocumentHighlightRequest}. +type DocumentHighlightRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentHighlightOptions +} - /*Workspace defined: - * Workspace specific client capabilities. - */ - Workspace struct { - - /*ApplyEdit defined: - * The client supports applying batch edits - * to the workspace by supporting the request - * 'workspace/applyEdit' - */ - ApplyEdit bool `json:"applyEdit,omitempty"` - - /*WorkspaceEdit defined: - * Capabilities specific to `WorkspaceEdit`s - */ - WorkspaceEdit WorkspaceEditClientCapabilities `json:"workspaceEdit,omitempty"` - - /*DidChangeConfiguration defined: - * Capabilities specific to the `workspace/didChangeConfiguration` notification. - */ - DidChangeConfiguration DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitempty"` - - /*DidChangeWatchedFiles defined: - * Capabilities specific to the `workspace/didChangeWatchedFiles` notification. - */ - DidChangeWatchedFiles DidChangeWatchedFilesClientCapabilities `json:"didChangeWatchedFiles,omitempty"` - - /*Symbol defined: - * Capabilities specific to the `workspace/symbol` request. - */ - Symbol WorkspaceSymbolClientCapabilities `json:"symbol,omitempty"` - - /*ExecuteCommand defined: - * Capabilities specific to the `workspace/executeCommand` request. - */ - ExecuteCommand ExecuteCommandClientCapabilities `json:"executeCommand,omitempty"` - - /*WorkspaceFolders defined: - * The client has support for workspace folders - */ - WorkspaceFolders bool `json:"workspaceFolders,omitempty"` - - /*Configuration defined: - * The client supports `workspace/configuration` requests. - */ - Configuration bool `json:"configuration,omitempty"` - } `json:"workspace,omitempty"` - - /*TextDocument defined: - * Text document specific client capabilities. - */ - TextDocument TextDocumentClientCapabilities `json:"textDocument,omitempty"` - - /*Window defined: - * Window specific client capabilities. - */ - Window interface{} `json:"window,omitempty"` - - /*Experimental defined: - * Experimental client capabilities. - */ - Experimental interface{} `json:"experimental,omitempty"` +// A document link is a range in a text document that links to an internal or external resource, like another +// text document or a web site. +type DocumentLink struct { + // The range this link applies to. + Range Range `json:"range"` + // The uri this link points to. If missing a resolve request is sent later. + Target *URI `json:"target,omitempty"` + // The tooltip text when you hover over this link. + // + // If a tooltip is provided, is will be displayed in a string that includes instructions on how to + // trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, + // user settings, and localization. + // + // @since 3.15.0 + Tooltip string `json:"tooltip,omitempty"` + // A data entry field that is preserved on a document link between a + // DocumentLinkRequest and a DocumentLinkResolveRequest. + Data interface{} `json:"data,omitempty"` +} - /*DynamicRegistration defined: - * Whether implementation supports dynamic registration for selection range providers. If this is set to `true` - * the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server - * capability as well. - */ +// The client capabilities of a {@link DocumentLinkRequest}. +type DocumentLinkClientCapabilities struct { + // Whether document link supports dynamic registration. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Whether the client supports the `tooltip` property on `DocumentLink`. + // + // @since 3.15.0 + TooltipSupport bool `json:"tooltipSupport,omitempty"` } -/*StaticRegistrationOptions defined: - * Static registration options to be returned in the initialize - * request. - */ -type StaticRegistrationOptions struct { +// Provider options for a {@link DocumentLinkRequest}. +type DocumentLinkOptions struct { + // Document links have a resolve provider as well. + ResolveProvider bool `json:"resolveProvider,omitempty"` + WorkDoneProgressOptions +} - /*ID defined: - * The id used to register the request. The id can be used to deregister - * the request again. See also Registration#id. - */ - ID string `json:"id,omitempty"` +// The parameters of a {@link DocumentLinkRequest}. +type DocumentLinkParams struct { + // The document to provide document links for. + TextDocument TextDocumentIdentifier `json:"textDocument"` + WorkDoneProgressParams + PartialResultParams } -/*TextDocumentRegistrationOptions defined: - * General text document registration options. - */ -type TextDocumentRegistrationOptions struct { +// Registration options for a {@link DocumentLinkRequest}. +type DocumentLinkRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentLinkOptions +} - /*DocumentSelector defined: - * A document selector to identify the scope of the registration. If set to null - * the document selector provided on the client side will be used. - */ - DocumentSelector DocumentSelector `json:"documentSelector"` +// Client capabilities of a {@link DocumentOnTypeFormattingRequest}. +type DocumentOnTypeFormattingClientCapabilities struct { + // Whether on type formatting supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } -/*SaveOptions defined: - * Save options. - */ -type SaveOptions struct { +// Provider options for a {@link DocumentOnTypeFormattingRequest}. +type DocumentOnTypeFormattingOptions struct { + // A character on which formatting should be triggered, like `{`. + FirstTriggerCharacter string `json:"firstTriggerCharacter"` + // More trigger characters. + MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"` +} - /*IncludeText defined: - * The client is supposed to include the content on save. - */ - IncludeText bool `json:"includeText,omitempty"` +// The parameters of a {@link DocumentOnTypeFormattingRequest}. +type DocumentOnTypeFormattingParams struct { + // The document to format. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The position around which the on type formatting should happen. + // This is not necessarily the exact position where the character denoted + // by the property `ch` got typed. + Position Position `json:"position"` + // The character that has been typed that triggered the formatting + // on type request. That is not necessarily the last character that + // got inserted into the document since the client could auto insert + // characters as well (e.g. like automatic brace completion). + Ch string `json:"ch"` + // The formatting options. + Options FormattingOptions `json:"options"` } -// WorkDoneProgressOptions is -type WorkDoneProgressOptions struct { +// Registration options for a {@link DocumentOnTypeFormattingRequest}. +type DocumentOnTypeFormattingRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentOnTypeFormattingOptions +} - // WorkDoneProgress is - WorkDoneProgress bool `json:"workDoneProgress,omitempty"` +// Client capabilities of a {@link DocumentRangeFormattingRequest}. +type DocumentRangeFormattingClientCapabilities struct { + // Whether range formatting supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Whether the client supports formatting multiple ranges at once. + // + // @since 3.18.0 + // @proposed + RangesSupport bool `json:"rangesSupport,omitempty"` } -/*InnerServerCapabilities defined: - * Defines the capabilities provided by a language - * server. - */ -type InnerServerCapabilities struct { +// Provider options for a {@link DocumentRangeFormattingRequest}. +type DocumentRangeFormattingOptions struct { + // Whether the server supports formatting multiple ranges at once. + // + // @since 3.18.0 + // @proposed + RangesSupport bool `json:"rangesSupport,omitempty"` + WorkDoneProgressOptions +} - /*TextDocumentSync defined: - * Defines how text documents are synced. Is either a detailed structure defining each notification or - * for backwards compatibility the TextDocumentSyncKind number. - */ - TextDocumentSync interface{} `json:"textDocumentSync,omitempty"` // TextDocumentSyncOptions | TextDocumentSyncKind +// The parameters of a {@link DocumentRangeFormattingRequest}. +type DocumentRangeFormattingParams struct { + // The document to format. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The range to format + Range Range `json:"range"` + // The format options + Options FormattingOptions `json:"options"` + WorkDoneProgressParams +} - /*CompletionProvider defined: - * The server provides completion support. - */ - CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"` +// Registration options for a {@link DocumentRangeFormattingRequest}. +type DocumentRangeFormattingRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentRangeFormattingOptions +} - /*HoverProvider defined: - * The server provides hover support. - */ - HoverProvider bool `json:"hoverProvider,omitempty"` // boolean | HoverOptions +// The parameters of a {@link DocumentRangesFormattingRequest}. +// +// @since 3.18.0 +// @proposed +type DocumentRangesFormattingParams struct { + // The document to format. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The ranges to format + Ranges []Range `json:"ranges"` + // The format options + Options FormattingOptions `json:"options"` + WorkDoneProgressParams +} - /*SignatureHelpProvider defined: - * The server provides signature help support. - */ - SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"` - - /*DeclarationProvider defined: - * The server provides Goto Declaration support. - */ - DeclarationProvider bool `json:"declarationProvider,omitempty"` // boolean | DeclarationOptions | DeclarationRegistrationOptions - - /*DefinitionProvider defined: - * The server provides goto definition support. - */ - DefinitionProvider bool `json:"definitionProvider,omitempty"` // boolean | DefinitionOptions - - /*TypeDefinitionProvider defined: - * The server provides Goto Type Definition support. - */ - TypeDefinitionProvider bool `json:"typeDefinitionProvider,omitempty"` // boolean | TypeDefinitionOptions | TypeDefinitionRegistrationOptions - - /*ImplementationProvider defined: - * The server provides Goto Implementation support. - */ - ImplementationProvider bool `json:"implementationProvider,omitempty"` // boolean | ImplementationOptions | ImplementationRegistrationOptions - - /*ReferencesProvider defined: - * The server provides find references support. - */ - ReferencesProvider bool `json:"referencesProvider,omitempty"` // boolean | ReferenceOptions - - /*DocumentHighlightProvider defined: - * The server provides document highlight support. - */ - DocumentHighlightProvider bool `json:"documentHighlightProvider,omitempty"` // boolean | DocumentHighlightOptions - - /*DocumentSymbolProvider defined: - * The server provides document symbol support. - */ - DocumentSymbolProvider bool `json:"documentSymbolProvider,omitempty"` // boolean | DocumentSymbolOptions - - /*CodeActionProvider defined: - * The server provides code actions. CodeActionOptions may only be - * specified if the client states that it supports - * `codeActionLiteralSupport` in its initial `initialize` request. - */ - CodeActionProvider interface{} `json:"codeActionProvider,omitempty"` // boolean | CodeActionOptions - - /*CodeLensProvider defined: - * The server provides code lens. - */ - CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"` - - /*DocumentLinkProvider defined: - * The server provides document link support. - */ - DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitempty"` - - /*ColorProvider defined: - * The server provides color provider support. - */ - ColorProvider bool `json:"colorProvider,omitempty"` // boolean | DocumentColorOptions | DocumentColorRegistrationOptions - - /*WorkspaceSymbolProvider defined: - * The server provides workspace symbol support. - */ - WorkspaceSymbolProvider bool `json:"workspaceSymbolProvider,omitempty"` // boolean | WorkspaceSymbolOptions - - /*DocumentFormattingProvider defined: - * The server provides document formatting. - */ - DocumentFormattingProvider bool `json:"documentFormattingProvider,omitempty"` // boolean | DocumentFormattingOptions - - /*DocumentRangeFormattingProvider defined: - * The server provides document range formatting. - */ - DocumentRangeFormattingProvider bool `json:"documentRangeFormattingProvider,omitempty"` // boolean | DocumentRangeFormattingOptions - - /*DocumentOnTypeFormattingProvider defined: - * The server provides document formatting on typing. - */ - DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"` - - /*RenameProvider defined: - * The server provides rename support. RenameOptions may only be - * specified if the client states that it supports - * `prepareSupport` in its initial `initialize` request. - */ - RenameProvider interface{} `json:"renameProvider,omitempty"` // boolean | RenameOptions - - /*FoldingRangeProvider defined: - * The server provides folding provider support. - */ - FoldingRangeProvider bool `json:"foldingRangeProvider,omitempty"` // boolean | FoldingRangeOptions | FoldingRangeRegistrationOptions - - /*SelectionRangeProvider defined: - * The server provides selection range support. - */ - SelectionRangeProvider bool `json:"selectionRangeProvider,omitempty"` // boolean | SelectionRangeOptions | SelectionRangeRegistrationOptions - - /*ExecuteCommandProvider defined: - * The server provides execute command support. - */ - ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"` - - /*Experimental defined: - * Experimental server capabilities. - */ - Experimental interface{} `json:"experimental,omitempty"` -} - -// ServerCapabilities is -type ServerCapabilities struct { - - /*TextDocumentSync defined: - * Defines how text documents are synced. Is either a detailed structure defining each notification or - * for backwards compatibility the TextDocumentSyncKind number. - */ - TextDocumentSync interface{} `json:"textDocumentSync,omitempty"` // TextDocumentSyncOptions | TextDocumentSyncKind - - /*CompletionProvider defined: - * The server provides completion support. - */ - CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"` - - /*HoverProvider defined: - * The server provides hover support. - */ - HoverProvider bool `json:"hoverProvider,omitempty"` // boolean | HoverOptions - - /*SignatureHelpProvider defined: - * The server provides signature help support. - */ - SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"` - - /*DeclarationProvider defined: - * The server provides Goto Declaration support. - */ - DeclarationProvider bool `json:"declarationProvider,omitempty"` // boolean | DeclarationOptions | DeclarationRegistrationOptions - - /*DefinitionProvider defined: - * The server provides goto definition support. - */ - DefinitionProvider bool `json:"definitionProvider,omitempty"` // boolean | DefinitionOptions - - /*TypeDefinitionProvider defined: - * The server provides Goto Type Definition support. - */ - TypeDefinitionProvider bool `json:"typeDefinitionProvider,omitempty"` // boolean | TypeDefinitionOptions | TypeDefinitionRegistrationOptions - - /*ImplementationProvider defined: - * The server provides Goto Implementation support. - */ - ImplementationProvider bool `json:"implementationProvider,omitempty"` // boolean | ImplementationOptions | ImplementationRegistrationOptions - - /*ReferencesProvider defined: - * The server provides find references support. - */ - ReferencesProvider bool `json:"referencesProvider,omitempty"` // boolean | ReferenceOptions - - /*DocumentHighlightProvider defined: - * The server provides document highlight support. - */ - DocumentHighlightProvider bool `json:"documentHighlightProvider,omitempty"` // boolean | DocumentHighlightOptions - - /*DocumentSymbolProvider defined: - * The server provides document symbol support. - */ - DocumentSymbolProvider bool `json:"documentSymbolProvider,omitempty"` // boolean | DocumentSymbolOptions - - /*CodeActionProvider defined: - * The server provides code actions. CodeActionOptions may only be - * specified if the client states that it supports - * `codeActionLiteralSupport` in its initial `initialize` request. - */ - CodeActionProvider interface{} `json:"codeActionProvider,omitempty"` // boolean | CodeActionOptions - - /*CodeLensProvider defined: - * The server provides code lens. - */ - CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"` - - /*DocumentLinkProvider defined: - * The server provides document link support. - */ - DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitempty"` - - /*ColorProvider defined: - * The server provides color provider support. - */ - ColorProvider bool `json:"colorProvider,omitempty"` // boolean | DocumentColorOptions | DocumentColorRegistrationOptions - - /*WorkspaceSymbolProvider defined: - * The server provides workspace symbol support. - */ - WorkspaceSymbolProvider bool `json:"workspaceSymbolProvider,omitempty"` // boolean | WorkspaceSymbolOptions - - /*DocumentFormattingProvider defined: - * The server provides document formatting. - */ - DocumentFormattingProvider bool `json:"documentFormattingProvider,omitempty"` // boolean | DocumentFormattingOptions - - /*DocumentRangeFormattingProvider defined: - * The server provides document range formatting. - */ - DocumentRangeFormattingProvider bool `json:"documentRangeFormattingProvider,omitempty"` // boolean | DocumentRangeFormattingOptions - - /*DocumentOnTypeFormattingProvider defined: - * The server provides document formatting on typing. - */ - DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"` - - /*RenameProvider defined: - * The server provides rename support. RenameOptions may only be - * specified if the client states that it supports - * `prepareSupport` in its initial `initialize` request. - */ - RenameProvider interface{} `json:"renameProvider,omitempty"` // boolean | RenameOptions - - /*FoldingRangeProvider defined: - * The server provides folding provider support. - */ - FoldingRangeProvider bool `json:"foldingRangeProvider,omitempty"` // boolean | FoldingRangeOptions | FoldingRangeRegistrationOptions - - /*SelectionRangeProvider defined: - * The server provides selection range support. - */ - SelectionRangeProvider bool `json:"selectionRangeProvider,omitempty"` // boolean | SelectionRangeOptions | SelectionRangeRegistrationOptions - - /*ExecuteCommandProvider defined: - * The server provides execute command support. - */ - ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"` - - /*Experimental defined: - * Experimental server capabilities. - */ - Experimental interface{} `json:"experimental,omitempty"` - - /*Workspace defined: - * The workspace server capabilities - */ - Workspace *struct { - - // WorkspaceFolders is - WorkspaceFolders *struct { - - /*Supported defined: - * The Server has support for workspace folders - */ - Supported bool `json:"supported,omitempty"` - - /*ChangeNotifications defined: - * Whether the server wants to receive workspace folder - * change notifications. - * - * If a strings is provided the string is treated as a ID - * under which the notification is registed on the client - * side. The ID can be used to unregister for these events - * using the `client/unregisterCapability` request. - */ - ChangeNotifications interface{} `json:"changeNotifications,omitempty"` // string | boolean - } `json:"workspaceFolders,omitempty"` - } `json:"workspace,omitempty"` -} - -/*InnerInitializeParams defined: - * The initialize parameters - */ -type InnerInitializeParams struct { - - /*ProcessID defined: - * The process Id of the parent process that started - * the server. - */ - ProcessID float64 `json:"processId"` - - /*ClientInfo defined: - * Information about the client - * - * @since 3.15.0 - */ - ClientInfo *struct { - - /*Name defined: - * The name of the client as defined by the client. - */ - Name string `json:"name"` - - /*Version defined: - * The client's version as defined by the client. - */ - Version string `json:"version,omitempty"` - } `json:"clientInfo,omitempty"` - - /*RootPath defined: - * The rootPath of the workspace. Is null - * if no folder is open. - * - * @deprecated in favour of rootUri. - */ - RootPath string `json:"rootPath,omitempty"` - - /*RootURI defined: - * The rootUri of the workspace. Is null if no - * folder is open. If both `rootPath` and `rootUri` are set - * `rootUri` wins. - * - * @deprecated in favour of workspaceFolders. - */ - RootURI DocumentURI `json:"rootUri"` - - /*Capabilities defined: - * The capabilities provided by the client (editor or tool) - */ - Capabilities ClientCapabilities `json:"capabilities"` - - /*InitializationOptions defined: - * User provided initialization options. - */ - InitializationOptions interface{} `json:"initializationOptions,omitempty"` - - /*Trace defined: - * The initial trace setting. If omitted trace is disabled ('off'). - */ - Trace string `json:"trace,omitempty"` // 'off' | 'messages' | 'verbose' - WorkDoneProgressParams +// A document selector is the combination of one or many document filters. +// +// @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`; +// +// The use of a string as a document filter is deprecated @since 3.16.0. +type DocumentSelector = []DocumentFilter // (alias) line 14369 +// Represents programming constructs like variables, classes, interfaces etc. +// that appear in a document. Document symbols can be hierarchical and they +// have two ranges: one that encloses its definition and one that points to +// its most interesting range, e.g. the range of an identifier. +type DocumentSymbol struct { + // The name of this symbol. Will be displayed in the user interface and therefore must not be + // an empty string or a string only consisting of white spaces. + Name string `json:"name"` + // More detail for this symbol, e.g the signature of a function. + Detail string `json:"detail,omitempty"` + // The kind of this symbol. + Kind SymbolKind `json:"kind"` + // Tags for this document symbol. + // + // @since 3.16.0 + Tags []SymbolTag `json:"tags,omitempty"` + // Indicates if this symbol is deprecated. + // + // @deprecated Use tags instead + Deprecated bool `json:"deprecated,omitempty"` + // The range enclosing this symbol not including leading/trailing whitespace but everything else + // like comments. This information is typically used to determine if the clients cursor is + // inside the symbol to reveal in the symbol in the UI. + Range Range `json:"range"` + // The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. + // Must be contained by the `range`. + SelectionRange Range `json:"selectionRange"` + // Children of this symbol, e.g. properties of a class. + Children []DocumentSymbol `json:"children,omitempty"` } -// InitializeParams is -type InitializeParams struct { - - /*ProcessID defined: - * The process Id of the parent process that started - * the server. - */ - ProcessID float64 `json:"processId"` - - /*ClientInfo defined: - * Information about the client - * - * @since 3.15.0 - */ - ClientInfo *struct { - - /*Name defined: - * The name of the client as defined by the client. - */ - Name string `json:"name"` - - /*Version defined: - * The client's version as defined by the client. - */ - Version string `json:"version,omitempty"` - } `json:"clientInfo,omitempty"` - - /*RootPath defined: - * The rootPath of the workspace. Is null - * if no folder is open. - * - * @deprecated in favour of rootUri. - */ - RootPath string `json:"rootPath,omitempty"` - - /*RootURI defined: - * The rootUri of the workspace. Is null if no - * folder is open. If both `rootPath` and `rootUri` are set - * `rootUri` wins. - * - * @deprecated in favour of workspaceFolders. - */ - RootURI DocumentURI `json:"rootUri"` - - /*Capabilities defined: - * The capabilities provided by the client (editor or tool) - */ - Capabilities ClientCapabilities `json:"capabilities"` - - /*InitializationOptions defined: - * User provided initialization options. - */ - InitializationOptions interface{} `json:"initializationOptions,omitempty"` - - /*Trace defined: - * The initial trace setting. If omitted trace is disabled ('off'). - */ - Trace string `json:"trace,omitempty"` // 'off' | 'messages' | 'verbose' - - /*WorkspaceFolders defined: - * The actual configured workspace folders. - */ - WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders"` - - ExtendedClientCapilities map[string]interface{} `json:"extendedClientCapabilities"` +// Client Capabilities for a {@link DocumentSymbolRequest}. +type DocumentSymbolClientCapabilities struct { + // Whether document symbol supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Specific capabilities for the `SymbolKind` in the + // `textDocument/documentSymbol` request. + SymbolKind *PSymbolKindPDocumentSymbol `json:"symbolKind,omitempty"` + // The client supports hierarchical document symbols. + HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"` + // The client supports tags on `SymbolInformation`. Tags are supported on + // `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true. + // Clients supporting tags have to handle unknown tags gracefully. + // + // @since 3.16.0 + TagSupport *PTagSupportPDocumentSymbol `json:"tagSupport,omitempty"` + // The client supports an additional label presented in the UI when + // registering a document symbol provider. + // + // @since 3.16.0 + LabelSupport bool `json:"labelSupport,omitempty"` +} + +// Provider options for a {@link DocumentSymbolRequest}. +type DocumentSymbolOptions struct { + // A human-readable string that is shown when multiple outlines trees + // are shown for the same document. + // + // @since 3.16.0 + Label string `json:"label,omitempty"` + WorkDoneProgressOptions } -/*InitializeResult defined: - * The result returned from an initialize request. - */ -type InitializeResult struct { - - /*Capabilities defined: - * The capabilities the language server provides. - */ - Capabilities ServerCapabilities `json:"capabilities"` - - /*ServerInfo defined: - * Information about the server. - * - * @since 3.15.0 - */ - ServerInfo *struct { - - /*Name defined: - * The name of the server as defined by the server. - */ - Name string `json:"name"` - - /*Version defined: - * The servers's version as defined by the server. - */ - Version string `json:"version,omitempty"` - } `json:"serverInfo,omitempty"` - - /*Custom defined: - * Custom initialization results. - */ - Custom map[string]interface{} `json:"custom"` // [custom: string]: any; +// Parameters for a {@link DocumentSymbolRequest}. +type DocumentSymbolParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + WorkDoneProgressParams + PartialResultParams } -// InitializedParams is -type InitializedParams struct { +// Registration options for a {@link DocumentSymbolRequest}. +type DocumentSymbolRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentSymbolOptions } +type DocumentURI = string -// DidChangeConfigurationClientCapabilities is -type DidChangeConfigurationClientCapabilities struct { +// Predefined error codes. +type ErrorCodes int32 - /*DynamicRegistration defined: - * Did change configuration notification supports dynamic registration. - */ +// The client capabilities of a {@link ExecuteCommandRequest}. +type ExecuteCommandClientCapabilities struct { + // Execute command supports dynamic registration. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } -// DidChangeConfigurationRegistrationOptions is -type DidChangeConfigurationRegistrationOptions struct { - - // Section is - Section string `json:"section,omitempty"` // string | string[] -} - -/*DidChangeConfigurationParams defined: - * The parameters of a change configuration notification. - */ -type DidChangeConfigurationParams struct { - - /*Settings defined: - * The actual changed settings - */ - Settings interface{} `json:"settings"` -} - -/*ShowMessageParams defined: - * The parameters of a notification message. - */ -type ShowMessageParams struct { - - /*Type defined: - * The message type. See {@link MessageType} - */ - Type MessageType `json:"type"` - - /*Message defined: - * The actual message - */ - Message string `json:"message"` +// The server capabilities of a {@link ExecuteCommandRequest}. +type ExecuteCommandOptions struct { + // The commands to be executed on the server + Commands []string `json:"commands"` + WorkDoneProgressOptions } -// MessageActionItem is -type MessageActionItem struct { - - /*Title defined: - * A short title like 'Retry', 'Open Log' etc. - */ - Title string `json:"title"` +// The parameters of a {@link ExecuteCommandRequest}. +type ExecuteCommandParams struct { + // The identifier of the actual command handler. + Command string `json:"command"` + // Arguments that the command should be invoked with. + Arguments []json.RawMessage `json:"arguments,omitempty"` + WorkDoneProgressParams } -// ShowMessageRequestParams is -type ShowMessageRequestParams struct { - - /*Type defined: - * The message type. See {@link MessageType} - */ - Type MessageType `json:"type"` - - /*Message defined: - * The actual message - */ - Message string `json:"message"` - - /*Actions defined: - * The message action items to present. - */ - Actions []MessageActionItem `json:"actions,omitempty"` +// Registration options for a {@link ExecuteCommandRequest}. +type ExecuteCommandRegistrationOptions struct { + ExecuteCommandOptions } - -/*LogMessageParams defined: - * The log message parameters. - */ -type LogMessageParams struct { - - /*Type defined: - * The message type. See {@link MessageType} - */ - Type MessageType `json:"type"` - - /*Message defined: - * The actual message - */ - Message string `json:"message"` +type ExecutionSummary struct { + // A strict monotonically increasing value + // indicating the execution order of a cell + // inside a notebook. + ExecutionOrder uint32 `json:"executionOrder"` + // Whether the execution was successful or + // not if known by the client. + Success bool `json:"success,omitempty"` } -// TextDocumentSyncClientCapabilities is -type TextDocumentSyncClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether text document synchronization supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` - - /*WillSave defined: - * The client supports sending will save notifications. - */ - WillSave bool `json:"willSave,omitempty"` - - /*WillSaveWaitUntil defined: - * The client supports sending a will save request and - * waits for a response providing text edits which will - * be applied to the document before it is saved. - */ - WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"` - - /*DidSave defined: - * The client supports did save notifications. - */ - DidSave bool `json:"didSave,omitempty"` +// created for Literal (Lit_CodeActionClientCapabilities_codeActionLiteralSupport_codeActionKind) +type FCodeActionKindPCodeActionLiteralSupport struct { + // The code action kind values the client supports. When this + // property exists the client also guarantees that it will + // handle values outside its set gracefully and falls back + // to a default value when unknown. + ValueSet []CodeActionKind `json:"valueSet"` } -// TextDocumentSyncOptions is -type TextDocumentSyncOptions struct { - - /*OpenClose defined: - * Open and close notifications are sent to the server. If omitted open close notification should not - * be sent. - */ - OpenClose bool `json:"openClose,omitempty"` - - /*Change defined: - * Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full - * and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. - */ - Change TextDocumentSyncKind `json:"change,omitempty"` - - /*WillSave defined: - * If present will save notifications are sent to the server. If omitted the notification should not be - * sent. - */ - WillSave bool `json:"willSave,omitempty"` - - /*WillSaveWaitUntil defined: - * If present will save wait until requests are sent to the server. If omitted the request should not be - * sent. - */ - WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"` - - /*Save defined: - * If present save notifications are sent to the server. If omitted the notification should not be - * sent. - */ - Save *SaveOptions `json:"save,omitempty"` +// created for Literal (Lit_CompletionList_itemDefaults_editRange_Item1) +type FEditRangePItemDefaults struct { + Insert Range `json:"insert"` + Replace Range `json:"replace"` } -/*DidOpenTextDocumentParams defined: - * The parameters send in a open text document notification - */ -type DidOpenTextDocumentParams struct { - - /*TextDocument defined: - * The document that was opened. - */ - TextDocument TextDocumentItem `json:"textDocument"` +// created for Literal (Lit_SemanticTokensClientCapabilities_requests_full_Item1) +type FFullPRequests struct { + // The client will send the `textDocument/semanticTokens/full/delta` request if + // the server provides a corresponding handler. + Delta bool `json:"delta,omitempty"` } -/*DidChangeTextDocumentParams defined: - * The change text document notification's parameters. - */ -type DidChangeTextDocumentParams struct { - - /*TextDocument defined: - * The document that did change. The version number points - * to the version after all provided content changes have - * been applied. - */ - TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` - - /*ContentChanges defined: - * The actual content changes. The content changes describe single state changes - * to the document. So if there are two content changes c1 and c2 for a document - * in state S then c1 move the document to S' and c2 to S''. - */ - ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"` +// created for Literal (Lit_CompletionClientCapabilities_completionItem_insertTextModeSupport) +type FInsertTextModeSupportPCompletionItem struct { + ValueSet []InsertTextMode `json:"valueSet"` } -/*TextDocumentChangeRegistrationOptions defined: - * Describe options to be used when registered for text document change events. - */ -type TextDocumentChangeRegistrationOptions struct { - - /*SyncKind defined: - * How documents are synced to the server. - */ - SyncKind TextDocumentSyncKind `json:"syncKind"` - TextDocumentRegistrationOptions +// created for Literal (Lit_SignatureHelpClientCapabilities_signatureInformation_parameterInformation) +type FParameterInformationPSignatureInformation struct { + // The client supports processing label offsets instead of a + // simple label string. + // + // @since 3.14.0 + LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"` } -/*DidCloseTextDocumentParams defined: - * The parameters send in a close text document notification - */ -type DidCloseTextDocumentParams struct { - - /*TextDocument defined: - * The document that was closed. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` +// created for Literal (Lit_SemanticTokensClientCapabilities_requests_range_Item1) +type FRangePRequests struct { } -/*DidSaveTextDocumentParams defined: - * The parameters send in a save text document notification - */ -type DidSaveTextDocumentParams struct { - - /*TextDocument defined: - * The document that was closed. - */ - TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` - - /*Text defined: - * Optional the content when saved. Depends on the includeText value - * when the save notification was requested. - */ - Text string `json:"text,omitempty"` +// created for Literal (Lit_CompletionClientCapabilities_completionItem_resolveSupport) +type FResolveSupportPCompletionItem struct { + // The properties that a client can resolve lazily. + Properties []string `json:"properties"` } -/*TextDocumentSaveRegistrationOptions defined: - * Save registration options. - */ -type TextDocumentSaveRegistrationOptions struct { - TextDocumentRegistrationOptions - SaveOptions +// created for Literal (Lit_NotebookDocumentChangeEvent_cells_structure) +type FStructurePCells struct { + // The change to the cell array. + Array NotebookCellArrayChange `json:"array"` + // Additional opened cell text documents. + DidOpen []TextDocumentItem `json:"didOpen,omitempty"` + // Additional closed cell text documents. + DidClose []TextDocumentIdentifier `json:"didClose,omitempty"` } -/*WillSaveTextDocumentParams defined: - * The parameters send in a will save text document notification. - */ -type WillSaveTextDocumentParams struct { - - /*TextDocument defined: - * The document that will be saved. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` - - /*Reason defined: - * The 'TextDocumentSaveReason'. - */ - Reason TextDocumentSaveReason `json:"reason"` +// created for Literal (Lit_CompletionClientCapabilities_completionItem_tagSupport) +type FTagSupportPCompletionItem struct { + // The tags supported by the client. + ValueSet []CompletionItemTag `json:"valueSet"` } +type FailureHandlingKind string -// DidChangeWatchedFilesClientCapabilities is -type DidChangeWatchedFilesClientCapabilities struct { +// The file event type +type FileChangeType uint32 - /*DynamicRegistration defined: - * Did change watched files notification supports dynamic registration. Please note - * that the current protocol doesn't support static configuration for file changes - * from the server side. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// Represents information on a file/folder create. +// +// @since 3.16.0 +type FileCreate struct { + // A file:// URI for the location of the file/folder being created. + URI string `json:"uri"` } -/*DidChangeWatchedFilesParams defined: - * The watched files change notification's parameters. - */ -type DidChangeWatchedFilesParams struct { - - /*Changes defined: - * The actual file events. - */ - Changes []FileEvent `json:"changes"` +// Represents information on a file/folder delete. +// +// @since 3.16.0 +type FileDelete struct { + // A file:// URI for the location of the file/folder being deleted. + URI string `json:"uri"` } -/*FileEvent defined: - * An event describing a file change. - */ +// An event describing a file change. type FileEvent struct { - - /*URI defined: - * The file's uri. - */ + // The file's uri. URI DocumentURI `json:"uri"` - - /*Type defined: - * The change type. - */ + // The change type. Type FileChangeType `json:"type"` } -/*DidChangeWatchedFilesRegistrationOptions defined: - * Describe options to be used when registered for text document change events. - */ -type DidChangeWatchedFilesRegistrationOptions struct { - - /*Watchers defined: - * The watchers to register. - */ - Watchers []FileSystemWatcher `json:"watchers"` +// Capabilities relating to events from file operations by the user in the client. +// +// These events do not come from the file system, they come from user operations +// like renaming a file in the UI. +// +// @since 3.16.0 +type FileOperationClientCapabilities struct { + // Whether the client supports dynamic registration for file requests/notifications. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // The client has support for sending didCreateFiles notifications. + DidCreate bool `json:"didCreate,omitempty"` + // The client has support for sending willCreateFiles requests. + WillCreate bool `json:"willCreate,omitempty"` + // The client has support for sending didRenameFiles notifications. + DidRename bool `json:"didRename,omitempty"` + // The client has support for sending willRenameFiles requests. + WillRename bool `json:"willRename,omitempty"` + // The client has support for sending didDeleteFiles notifications. + DidDelete bool `json:"didDelete,omitempty"` + // The client has support for sending willDeleteFiles requests. + WillDelete bool `json:"willDelete,omitempty"` +} + +// A filter to describe in which file operation requests or notifications +// the server is interested in receiving. +// +// @since 3.16.0 +type FileOperationFilter struct { + // A Uri scheme like `file` or `untitled`. + Scheme string `json:"scheme,omitempty"` + // The actual file operation pattern. + Pattern FileOperationPattern `json:"pattern"` +} + +// Options for notifications/requests for user operations on files. +// +// @since 3.16.0 +type FileOperationOptions struct { + // The server is interested in receiving didCreateFiles notifications. + DidCreate *FileOperationRegistrationOptions `json:"didCreate,omitempty"` + // The server is interested in receiving willCreateFiles requests. + WillCreate *FileOperationRegistrationOptions `json:"willCreate,omitempty"` + // The server is interested in receiving didRenameFiles notifications. + DidRename *FileOperationRegistrationOptions `json:"didRename,omitempty"` + // The server is interested in receiving willRenameFiles requests. + WillRename *FileOperationRegistrationOptions `json:"willRename,omitempty"` + // The server is interested in receiving didDeleteFiles file notifications. + DidDelete *FileOperationRegistrationOptions `json:"didDelete,omitempty"` + // The server is interested in receiving willDeleteFiles file requests. + WillDelete *FileOperationRegistrationOptions `json:"willDelete,omitempty"` +} + +// A pattern to describe in which file operation requests or notifications +// the server is interested in receiving. +// +// @since 3.16.0 +type FileOperationPattern struct { + // The glob pattern to match. Glob patterns can have the following syntax: + // + // - `*` to match one or more characters in a path segment + // - `?` to match on one character in a path segment + // - `**` to match any number of path segments, including none + // - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) + // - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) + // - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) + Glob string `json:"glob"` + // Whether to match files or folders with this pattern. + // + // Matches both if undefined. + Matches *FileOperationPatternKind `json:"matches,omitempty"` + // Additional options used during matching. + Options *FileOperationPatternOptions `json:"options,omitempty"` +} + +// A pattern kind describing if a glob pattern matches a file a folder or +// both. +// +// @since 3.16.0 +type FileOperationPatternKind string + +// Matching options for the file operation pattern. +// +// @since 3.16.0 +type FileOperationPatternOptions struct { + // The pattern should be matched ignoring casing. + IgnoreCase bool `json:"ignoreCase,omitempty"` +} + +// The options to register for file operations. +// +// @since 3.16.0 +type FileOperationRegistrationOptions struct { + // The actual filters. + Filters []FileOperationFilter `json:"filters"` +} + +// Represents information on a file/folder rename. +// +// @since 3.16.0 +type FileRename struct { + // A file:// URI for the original location of the file/folder being renamed. + OldURI string `json:"oldUri"` + // A file:// URI for the new location of the file/folder being renamed. + NewURI string `json:"newUri"` } - -// FileSystemWatcher is type FileSystemWatcher struct { - - /*GlobPattern defined: - * The glob pattern to watch. Glob patterns can have the following syntax: - * - `*` to match one or more characters in a path segment - * - `?` to match on one character in a path segment - * - `**` to match any number of path segments, including none - * - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) - * - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) - * - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) - */ - GlobPattern string `json:"globPattern"` - - /*Kind defined: - * The kind of events of interest. If omitted it defaults - * to WatchKind.Create | WatchKind.Change | WatchKind.Delete - * which is 7. - */ - Kind float64 `json:"kind,omitempty"` -} - -/*PublishDiagnosticsClientCapabilities defined: - * The publish diagnostic client capabilities. - */ -type PublishDiagnosticsClientCapabilities struct { - - /*RelatedInformation defined: - * Whether the clients accepts diagnostics with related information. - */ - RelatedInformation bool `json:"relatedInformation,omitempty"` - - /*TagSupport defined: - * Client supports the tag property to provide meta data about a diagnostic. - * Clients supporting tags have to handle unknown tags gracefully. - * - * @since 3.15.0 - */ - TagSupport *struct { - - /*ValueSet defined: - * The tags supported by the client. - */ - ValueSet []DiagnosticTag `json:"valueSet"` - } `json:"tagSupport,omitempty"` -} - -/*PublishDiagnosticsParams defined: - * The publish diagnostic notification's parameters. - */ -type PublishDiagnosticsParams struct { - - /*URI defined: - * The URI for which diagnostic information is reported. - */ - URI DocumentURI `json:"uri"` - - /*Version defined: - * Optional the version number of the document the diagnostics are published for. - * - * @since 3.15.0 - */ - Version float64 `json:"version,omitempty"` - - /*Diagnostics defined: - * An array of diagnostic information items. - */ - Diagnostics []Diagnostic `json:"diagnostics"` + // The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail. + // + // @since 3.17.0 support for relative patterns. + GlobPattern GlobPattern `json:"globPattern"` + // The kind of events of interest. If omitted it defaults + // to WatchKind.Create | WatchKind.Change | WatchKind.Delete + // which is 7. + Kind *WatchKind `json:"kind,omitempty"` +} + +// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller +// than the number of lines in the document. Clients are free to ignore invalid ranges. +type FoldingRange struct { + // The zero-based start line of the range to fold. The folded area starts after the line's last character. + // To be valid, the end must be zero or larger and smaller than the number of lines in the document. + StartLine uint32 `json:"startLine"` + // The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. + StartCharacter uint32 `json:"startCharacter,omitempty"` + // The zero-based end line of the range to fold. The folded area ends with the line's last character. + // To be valid, the end must be zero or larger and smaller than the number of lines in the document. + EndLine uint32 `json:"endLine"` + // The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. + EndCharacter uint32 `json:"endCharacter,omitempty"` + // Describes the kind of the folding range such as `comment' or 'region'. The kind + // is used to categorize folding ranges and used by commands like 'Fold all comments'. + // See {@link FoldingRangeKind} for an enumeration of standardized kinds. + Kind string `json:"kind,omitempty"` + // The text that the client should show when the specified range is + // collapsed. If not defined or not supported by the client, a default + // will be chosen by the client. + // + // @since 3.17.0 + CollapsedText string `json:"collapsedText,omitempty"` } - -/*CompletionClientCapabilities defined: - * Completion client capabilities - */ -type CompletionClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether completion supports dynamic registration. - */ +type FoldingRangeClientCapabilities struct { + // Whether implementation supports dynamic registration for folding range + // providers. If this is set to `true` the client supports the new + // `FoldingRangeRegistrationOptions` return value for the corresponding + // server capability as well. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` - - /*CompletionItem defined: - * The client supports the following `CompletionItem` specific - * capabilities. - */ - CompletionItem *struct { - - /*SnippetSupport defined: - * Client supports snippets as insert text. - * - * A snippet can define tab stops and placeholders with `$1`, `$2` - * and `${3:foo}`. `$0` defines the final tab stop, it defaults to - * the end of the snippet. Placeholders with equal identifiers are linked, - * that is typing in one will update others too. - */ - SnippetSupport bool `json:"snippetSupport,omitempty"` - - /*CommitCharactersSupport defined: - * Client supports commit characters on a completion item. - */ - CommitCharactersSupport bool `json:"commitCharactersSupport,omitempty"` - - /*DocumentationFormat defined: - * Client supports the follow content formats for the documentation - * property. The order describes the preferred format of the client. - */ - DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"` - - /*DeprecatedSupport defined: - * Client supports the deprecated property on a completion item. - */ - DeprecatedSupport bool `json:"deprecatedSupport,omitempty"` - - /*PreselectSupport defined: - * Client supports the preselect property on a completion item. - */ - PreselectSupport bool `json:"preselectSupport,omitempty"` - - /*TagSupport defined: - * Client supports the tag property on a completion item. Clients supporting - * tags have to handle unknown tags gracefully. Clients especially need to - * preserve unknown tags when sending a completion item back to the server in - * a resolve call. - * - * @since 3.15.0 - */ - TagSupport *struct { - - /*ValueSet defined: - * The tags supported by the client. - */ - ValueSet []CompletionItemTag `json:"valueSet"` - } `json:"tagSupport,omitempty"` - } `json:"completionItem,omitempty"` - - // CompletionItemKind is - CompletionItemKind *struct { - - /*ValueSet defined: - * The completion item kind values the client supports. When this - * property exists the client also guarantees that it will - * handle values outside its set gracefully and falls back - * to a default value when unknown. - * - * If this property is not present the client only supports - * the completion items kinds from `Text` to `Reference` as defined in - * the initial version of the protocol. - */ - ValueSet []CompletionItemKind `json:"valueSet,omitempty"` - } `json:"completionItemKind,omitempty"` - - /*ContextSupport defined: - * The client supports to send additional context information for a - * `textDocument/completion` requestion. - */ - ContextSupport bool `json:"contextSupport,omitempty"` + // The maximum number of folding ranges that the client prefers to receive + // per document. The value serves as a hint, servers are free to follow the + // limit. + RangeLimit uint32 `json:"rangeLimit,omitempty"` + // If set, the client signals that it only supports folding complete lines. + // If set, client will ignore specified `startCharacter` and `endCharacter` + // properties in a FoldingRange. + LineFoldingOnly bool `json:"lineFoldingOnly,omitempty"` + // Specific options for the folding range kind. + // + // @since 3.17.0 + FoldingRangeKind *PFoldingRangeKindPFoldingRange `json:"foldingRangeKind,omitempty"` + // Specific options for the folding range. + // + // @since 3.17.0 + FoldingRange *PFoldingRangePFoldingRange `json:"foldingRange,omitempty"` } -/*CompletionContext defined: - * Contains additional information about the context in which a completion request is triggered. - */ -type CompletionContext struct { - - /*TriggerKind defined: - * How the completion was triggered. - */ - TriggerKind CompletionTriggerKind `json:"triggerKind"` - - /*TriggerCharacter defined: - * The trigger character (a single character) that has trigger code complete. - * Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` - */ - TriggerCharacter string `json:"triggerCharacter,omitempty"` +// A set of predefined range kinds. +type FoldingRangeKind string +type FoldingRangeOptions struct { + WorkDoneProgressOptions } -/*CompletionParams defined: - * Completion parameters - */ -type CompletionParams struct { - - /*Context defined: - * The completion context. This is only available it the client specifies - * to send this using the client capability `textDocument.completion.contextSupport === true` - */ - Context *CompletionContext `json:"context,omitempty"` - TextDocumentPositionParams +// Parameters for a {@link FoldingRangeRequest}. +type FoldingRangeParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` WorkDoneProgressParams PartialResultParams } - -/*CompletionOptions defined: - * Completion options. - */ -type CompletionOptions struct { - - /*TriggerCharacters defined: - * Most tools trigger completion request automatically without explicitly requesting - * it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user - * starts to type an identifier. For example if the user types `c` in a JavaScript file - * code complete will automatically pop up present `console` besides others as a - * completion item. Characters that make up identifiers don't need to be listed here. - * - * If code complete should automatically be trigger on characters not being valid inside - * an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. - */ - TriggerCharacters []string `json:"triggerCharacters,omitempty"` - - /*AllCommitCharacters defined: - * The list of all possible characters that commit a completion. This field can be used - * if clients don't support individual commmit characters per completion item. See - * `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` - * - * @since 3.2.0 - */ - AllCommitCharacters []string `json:"allCommitCharacters,omitempty"` - - /*ResolveProvider defined: - * The server provides support to resolve additional - * information for a completion item. - */ - ResolveProvider bool `json:"resolveProvider,omitempty"` - WorkDoneProgressOptions +type FoldingRangeRegistrationOptions struct { + TextDocumentRegistrationOptions + FoldingRangeOptions + StaticRegistrationOptions } -/*CompletionRegistrationOptions defined: - * Registration options for a [CompletionRequest](#CompletionRequest). - */ -type CompletionRegistrationOptions struct { - TextDocumentRegistrationOptions - CompletionOptions +// Value-object describing what options formatting should use. +type FormattingOptions struct { + // Size of a tab in spaces. + TabSize uint32 `json:"tabSize"` + // Prefer spaces over tabs. + InsertSpaces bool `json:"insertSpaces"` + // Trim trailing whitespace on a line. + // + // @since 3.15.0 + TrimTrailingWhitespace bool `json:"trimTrailingWhitespace,omitempty"` + // Insert a newline character at the end of the file if one does not exist. + // + // @since 3.15.0 + InsertFinalNewline bool `json:"insertFinalNewline,omitempty"` + // Trim all newlines after the final newline at the end of the file. + // + // @since 3.15.0 + TrimFinalNewlines bool `json:"trimFinalNewlines,omitempty"` } -// HoverClientCapabilities is +// A diagnostic report with a full set of problems. +// +// @since 3.17.0 +type FullDocumentDiagnosticReport struct { + // A full document diagnostic report. + Kind string `json:"kind"` + // An optional result id. If provided it will + // be sent on the next diagnostic request for the + // same document. + ResultID string `json:"resultId,omitempty"` + // The actual items. + Items []Diagnostic `json:"items"` +} + +// General client capabilities. +// +// @since 3.16.0 +type GeneralClientCapabilities struct { + // Client capability that signals how the client + // handles stale requests (e.g. a request + // for which the client will not process the response + // anymore since the information is outdated). + // + // @since 3.17.0 + StaleRequestSupport *PStaleRequestSupportPGeneral `json:"staleRequestSupport,omitempty"` + // Client capabilities specific to regular expressions. + // + // @since 3.16.0 + RegularExpressions *RegularExpressionsClientCapabilities `json:"regularExpressions,omitempty"` + // Client capabilities specific to the client's markdown parser. + // + // @since 3.16.0 + Markdown *MarkdownClientCapabilities `json:"markdown,omitempty"` + // The position encodings supported by the client. Client and server + // have to agree on the same position encoding to ensure that offsets + // (e.g. character position in a line) are interpreted the same on both + // sides. + // + // To keep the protocol backwards compatible the following applies: if + // the value 'utf-16' is missing from the array of position encodings + // servers can assume that the client supports UTF-16. UTF-16 is + // therefore a mandatory encoding. + // + // If omitted it defaults to ['utf-16']. + // + // Implementation considerations: since the conversion from one encoding + // into another requires the content of the file / line the conversion + // is best done where the file is read which is usually on the server + // side. + // + // @since 3.17.0 + PositionEncodings []PositionEncodingKind `json:"positionEncodings,omitempty"` +} + +// The glob pattern. Either a string pattern or a relative pattern. +// +// @since 3.17.0 +type GlobPattern = string // (alias) line 14548 +// The result of a hover request. +type Hover struct { + // The hover's content + Contents MarkupContent `json:"contents"` + // An optional range inside the text document that is used to + // visualize the hover, e.g. by changing the background color. + Range *Range `json:"range,omitempty"` +} type HoverClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether hover supports dynamic registration. - */ + // Whether hover supports dynamic registration. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` - - /*ContentFormat defined: - * Client supports the follow content formats for the content - * property. The order describes the preferred format of the client. - */ + // Client supports the following content formats for the content + // property. The order describes the preferred format of the client. ContentFormat []MarkupKind `json:"contentFormat,omitempty"` } -/*HoverOptions defined: - * Hover options. - */ +// Hover options. type HoverOptions struct { WorkDoneProgressOptions } -/*HoverParams defined: - * Parameters for a [HoverRequest](#HoverRequest). - */ +// Parameters for a {@link HoverRequest}. type HoverParams struct { TextDocumentPositionParams WorkDoneProgressParams } -/*HoverRegistrationOptions defined: - * Registration options for a [HoverRequest](#HoverRequest). - */ +// Registration options for a {@link HoverRequest}. type HoverRegistrationOptions struct { TextDocumentRegistrationOptions HoverOptions } -/*SignatureHelpClientCapabilities defined: - * Client Capabilities for a [SignatureHelpRequest](#SignatureHelpRequest). - */ -type SignatureHelpClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether signature help supports dynamic registration. - */ +// @since 3.6.0 +type ImplementationClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is set to `true` + // the client supports the new `ImplementationRegistrationOptions` return value + // for the corresponding server capability as well. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` - - /*SignatureInformation defined: - * The client supports the following `SignatureInformation` - * specific properties. - */ - SignatureInformation *struct { - - /*DocumentationFormat defined: - * Client supports the follow content formats for the documentation - * property. The order describes the preferred format of the client. - */ - DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"` - - /*ParameterInformation defined: - * Client capabilities specific to parameter information. - */ - ParameterInformation *struct { - - /*LabelOffsetSupport defined: - * The client supports processing label offsets instead of a - * simple label string. - * - * @since 3.14.0 - */ - LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"` - } `json:"parameterInformation,omitempty"` - } `json:"signatureInformation,omitempty"` - - /*ContextSupport defined: - * The client supports to send additional context information for a - * `textDocument/signatureHelp` request. A client that opts into - * contextSupport will also support the `retriggerCharacters` on - * `SignatureHelpOptions`. - * - * @since 3.15.0 - */ - ContextSupport bool `json:"contextSupport,omitempty"` + // The client supports additional metadata in the form of definition links. + // + // @since 3.14.0 + LinkSupport bool `json:"linkSupport,omitempty"` } - -/*SignatureHelpOptions defined: - * Server Capabilities for a [SignatureHelpRequest](#SignatureHelpRequest). - */ -type SignatureHelpOptions struct { - - /*TriggerCharacters defined: - * List of characters that trigger signature help. - */ - TriggerCharacters []string `json:"triggerCharacters,omitempty"` - - /*RetriggerCharacters defined: - * List of characters that re-trigger signature help. - * - * These trigger characters are only active when signature help is already showing. All trigger characters - * are also counted as re-trigger characters. - * - * @since 3.15.0 - */ - RetriggerCharacters []string `json:"retriggerCharacters,omitempty"` +type ImplementationOptions struct { WorkDoneProgressOptions } +type ImplementationParams struct { + TextDocumentPositionParams + WorkDoneProgressParams + PartialResultParams +} +type ImplementationRegistrationOptions struct { + TextDocumentRegistrationOptions + ImplementationOptions + StaticRegistrationOptions +} -/*SignatureHelpContext defined: - * Additional information about the context in which a signature help request was triggered. - * - * @since 3.15.0 - */ -type SignatureHelpContext struct { - - /*TriggerKind defined: - * Action that caused signature help to be triggered. - */ - TriggerKind SignatureHelpTriggerKind `json:"triggerKind"` +// The data type of the ResponseError if the +// initialize request fails. +type InitializeError struct { + // Indicates whether the client execute the following retry logic: + // (1) show the message provided by the ResponseError to the user + // (2) user selects retry or cancel + // (3) if user selected retry the initialize method is sent again. + Retry bool `json:"retry"` +} +type InitializeParams struct { + XInitializeParams + WorkspaceFoldersInitializeParams +} - /*TriggerCharacter defined: - * Character that caused signature help to be triggered. - * - * This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` - */ - TriggerCharacter string `json:"triggerCharacter,omitempty"` +// The result returned from an initialize request. +type InitializeResult struct { + // The capabilities the language server provides. + Capabilities ServerCapabilities `json:"capabilities"` + // Information about the server. + // + // @since 3.15.0 + ServerInfo *PServerInfoMsg_initialize `json:"serverInfo,omitempty"` +} +type InitializedParams struct { +} - /*IsRetrigger defined: - * `true` if signature help was already showing when it was triggered. - * - * Retriggers occur when the signature help is already active and can be caused by actions such as - * typing a trigger character, a cursor move, or document content changes. - */ - IsRetrigger bool `json:"isRetrigger"` +// Inlay hint information. +// +// @since 3.17.0 +type InlayHint struct { + // The position of this hint. + Position Position `json:"position"` + // The label of this hint. A human readable string or an array of + // InlayHintLabelPart label parts. + // + // *Note* that neither the string nor the label part can be empty. + Label []InlayHintLabelPart `json:"label"` + // The kind of this hint. Can be omitted in which case the client + // should fall back to a reasonable default. + Kind *InlayHintKind `json:"kind,omitempty"` + // Optional text edits that are performed when accepting this inlay hint. + // + // *Note* that edits are expected to change the document so that the inlay + // hint (or its nearest variant) is now part of the document and the inlay + // hint itself is now obsolete. + TextEdits []TextEdit `json:"textEdits,omitempty"` + // The tooltip text when you hover over this item. + Tooltip *OrPTooltip_textDocument_inlayHint `json:"tooltip,omitempty"` + // Render padding before the hint. + // + // Note: Padding should use the editor's background color, not the + // background color of the hint itself. That means padding can be used + // to visually align/separate an inlay hint. + PaddingLeft bool `json:"paddingLeft,omitempty"` + // Render padding after the hint. + // + // Note: Padding should use the editor's background color, not the + // background color of the hint itself. That means padding can be used + // to visually align/separate an inlay hint. + PaddingRight bool `json:"paddingRight,omitempty"` + // A data entry field that is preserved on an inlay hint between + // a `textDocument/inlayHint` and a `inlayHint/resolve` request. + Data interface{} `json:"data,omitempty"` +} - /*ActiveSignatureHelp defined: - * The currently active `SignatureHelp`. - * - * The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on - * the user navigating through available signatures. - */ - ActiveSignatureHelp *SignatureHelp `json:"activeSignatureHelp,omitempty"` +// Inlay hint client capabilities. +// +// @since 3.17.0 +type InlayHintClientCapabilities struct { + // Whether inlay hints support dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Indicates which properties a client can resolve lazily on an inlay + // hint. + ResolveSupport *PResolveSupportPInlayHint `json:"resolveSupport,omitempty"` +} + +// Inlay hint kinds. +// +// @since 3.17.0 +type InlayHintKind uint32 + +// An inlay hint label part allows for interactive and composite labels +// of inlay hints. +// +// @since 3.17.0 +type InlayHintLabelPart struct { + // The value of this label part. + Value string `json:"value"` + // The tooltip text when you hover over this label part. Depending on + // the client capability `inlayHint.resolveSupport` clients might resolve + // this property late using the resolve request. + Tooltip *OrPTooltipPLabel `json:"tooltip,omitempty"` + // An optional source code location that represents this + // label part. + // + // The editor will use this location for the hover and for code navigation + // features: This part will become a clickable link that resolves to the + // definition of the symbol at the given location (not necessarily the + // location itself), it shows the hover that shows at the given location, + // and it shows a context menu with further code navigation commands. + // + // Depending on the client capability `inlayHint.resolveSupport` clients + // might resolve this property late using the resolve request. + Location *Location `json:"location,omitempty"` + // An optional command for this label part. + // + // Depending on the client capability `inlayHint.resolveSupport` clients + // might resolve this property late using the resolve request. + Command *Command `json:"command,omitempty"` } -/*SignatureHelpParams defined: - * Parameters for a [SignatureHelpRequest](#SignatureHelpRequest). - */ -type SignatureHelpParams struct { +// Inlay hint options used during static registration. +// +// @since 3.17.0 +type InlayHintOptions struct { + // The server provides support to resolve additional + // information for an inlay hint item. + ResolveProvider bool `json:"resolveProvider,omitempty"` + WorkDoneProgressOptions +} - /*Context defined: - * The signature help context. This is only available if the client specifies - * to send this using the client capability `textDocument.signatureHelp.contextSupport === true` - * - * @since 3.15.0 - */ - Context *SignatureHelpContext `json:"context,omitempty"` - TextDocumentPositionParams +// A parameter literal used in inlay hint requests. +// +// @since 3.17.0 +type InlayHintParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The document range for which inlay hints should be computed. + Range Range `json:"range"` WorkDoneProgressParams } -/*SignatureHelpRegistrationOptions defined: - * Registration options for a [SignatureHelpRequest](#SignatureHelpRequest). - */ -type SignatureHelpRegistrationOptions struct { +// Inlay hint options used during static or dynamic registration. +// +// @since 3.17.0 +type InlayHintRegistrationOptions struct { + InlayHintOptions TextDocumentRegistrationOptions - SignatureHelpOptions + StaticRegistrationOptions } -/*DefinitionClientCapabilities defined: - * Client Capabilities for a [DefinitionRequest](#DefinitionRequest). - */ -type DefinitionClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether definition supports dynamic registration. - */ +// Client workspace capabilities specific to inlay hints. +// +// @since 3.17.0 +type InlayHintWorkspaceClientCapabilities struct { + // Whether the client implementation supports a refresh request sent from + // the server to the client. + // + // Note that this event is global and will force the client to refresh all + // inlay hints currently shown. It should be used with absolute care and + // is useful for situation where a server for example detects a project wide + // change that requires such a calculation. + RefreshSupport bool `json:"refreshSupport,omitempty"` +} + +// Client capabilities specific to inline completions. +// +// @since 3.18.0 +// @proposed +type InlineCompletionClientCapabilities struct { + // Whether implementation supports dynamic registration for inline completion providers. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +} - /*LinkSupport defined: - * The client supports additional metadata in the form of definition links. - * - * @since 3.14.0 - */ - LinkSupport bool `json:"linkSupport,omitempty"` +// Provides information about the context in which an inline completion was requested. +// +// @since 3.18.0 +// @proposed +type InlineCompletionContext struct { + // Describes how the inline completion was triggered. + TriggerKind InlineCompletionTriggerKind `json:"triggerKind"` + // Provides information about the currently selected item in the autocomplete widget if it is visible. + SelectedCompletionInfo *SelectedCompletionInfo `json:"selectedCompletionInfo,omitempty"` +} + +// An inline completion item represents a text snippet that is proposed inline to complete text that is being typed. +// +// @since 3.18.0 +// @proposed +type InlineCompletionItem struct { + // The text to replace the range with. Must be set. + InsertText Or_InlineCompletionItem_insertText `json:"insertText"` + // A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used. + FilterText string `json:"filterText,omitempty"` + // The range to replace. Must begin and end on the same line. + Range *Range `json:"range,omitempty"` + // An optional {@link Command} that is executed *after* inserting this completion. + Command *Command `json:"command,omitempty"` } -/*DefinitionOptions defined: - * Server Capabilities for a [DefinitionRequest](#DefinitionRequest). - */ -type DefinitionOptions struct { +// Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor. +// +// @since 3.18.0 +// @proposed +type InlineCompletionList struct { + // The inline completion items + Items []InlineCompletionItem `json:"items"` +} + +// Inline completion options used during static registration. +// +// @since 3.18.0 +// @proposed +type InlineCompletionOptions struct { WorkDoneProgressOptions } -/*DefinitionParams defined: - * Parameters for a [DefinitionRequest](#DefinitionRequest). - */ -type DefinitionParams struct { +// A parameter literal used in inline completion requests. +// +// @since 3.18.0 +// @proposed +type InlineCompletionParams struct { + // Additional information about the context in which inline completions were + // requested. + Context InlineCompletionContext `json:"context"` TextDocumentPositionParams WorkDoneProgressParams - PartialResultParams } -/*DefinitionRegistrationOptions defined: - * Registration options for a [DefinitionRequest](#DefinitionRequest). - */ -type DefinitionRegistrationOptions struct { +// Inline completion options used during static or dynamic registration. +// +// @since 3.18.0 +// @proposed +type InlineCompletionRegistrationOptions struct { + InlineCompletionOptions TextDocumentRegistrationOptions - DefinitionOptions + StaticRegistrationOptions } -/*ReferenceClientCapabilities defined: - * Client Capabilities for a [ReferencesRequest](#ReferencesRequest). - */ -type ReferenceClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether references supports dynamic registration. - */ +// Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered. +// +// @since 3.18.0 +// @proposed +type InlineCompletionTriggerKind uint32 + +// Inline value information can be provided by different means: +// +// - directly as a text value (class InlineValueText). +// - as a name to use for a variable lookup (class InlineValueVariableLookup) +// - as an evaluatable expression (class InlineValueEvaluatableExpression) +// +// The InlineValue types combines all inline value types into one type. +// +// @since 3.17.0 +type InlineValue = Or_InlineValue // (alias) line 14282 +// Client capabilities specific to inline values. +// +// @since 3.17.0 +type InlineValueClientCapabilities struct { + // Whether implementation supports dynamic registration for inline value providers. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } -/*ReferenceParams defined: - * Parameters for a [ReferencesRequest](#ReferencesRequest). - */ -type ReferenceParams struct { +// @since 3.17.0 +type InlineValueContext struct { + // The stack frame (as a DAP Id) where the execution has stopped. + FrameID int32 `json:"frameId"` + // The document range where execution has stopped. + // Typically the end position of the range denotes the line where the inline values are shown. + StoppedLocation Range `json:"stoppedLocation"` +} - // Context is - Context ReferenceContext `json:"context"` - TextDocumentPositionParams - WorkDoneProgressParams - PartialResultParams +// Provide an inline value through an expression evaluation. +// If only a range is specified, the expression will be extracted from the underlying document. +// An optional expression can be used to override the extracted expression. +// +// @since 3.17.0 +type InlineValueEvaluatableExpression struct { + // The document range for which the inline value applies. + // The range is used to extract the evaluatable expression from the underlying document. + Range Range `json:"range"` + // If specified the expression overrides the extracted expression. + Expression string `json:"expression,omitempty"` } -/*ReferenceOptions defined: - * Reference options. - */ -type ReferenceOptions struct { +// Inline value options used during static registration. +// +// @since 3.17.0 +type InlineValueOptions struct { WorkDoneProgressOptions } -/*ReferenceRegistrationOptions defined: - * Registration options for a [ReferencesRequest](#ReferencesRequest). - */ -type ReferenceRegistrationOptions struct { +// A parameter literal used in inline value requests. +// +// @since 3.17.0 +type InlineValueParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The document range for which inline values should be computed. + Range Range `json:"range"` + // Additional information about the context in which inline values were + // requested. + Context InlineValueContext `json:"context"` + WorkDoneProgressParams +} + +// Inline value options used during static or dynamic registration. +// +// @since 3.17.0 +type InlineValueRegistrationOptions struct { + InlineValueOptions TextDocumentRegistrationOptions - ReferenceOptions + StaticRegistrationOptions } -/*DocumentHighlightClientCapabilities defined: - * Client Capabilities for a [DocumentHighlightRequest](#DocumentHighlightRequest). - */ -type DocumentHighlightClientCapabilities struct { +// Provide inline value as text. +// +// @since 3.17.0 +type InlineValueText struct { + // The document range for which the inline value applies. + Range Range `json:"range"` + // The text of the inline value. + Text string `json:"text"` +} - /*DynamicRegistration defined: - * Whether document highlight supports dynamic registration. - */ +// Provide inline value through a variable lookup. +// If only a range is specified, the variable name will be extracted from the underlying document. +// An optional variable name can be used to override the extracted name. +// +// @since 3.17.0 +type InlineValueVariableLookup struct { + // The document range for which the inline value applies. + // The range is used to extract the variable name from the underlying document. + Range Range `json:"range"` + // If specified the name of the variable to look up. + VariableName string `json:"variableName,omitempty"` + // How to perform the lookup. + CaseSensitiveLookup bool `json:"caseSensitiveLookup"` +} + +// Client workspace capabilities specific to inline values. +// +// @since 3.17.0 +type InlineValueWorkspaceClientCapabilities struct { + // Whether the client implementation supports a refresh request sent from the + // server to the client. + // + // Note that this event is global and will force the client to refresh all + // inline values currently shown. It should be used with absolute care and is + // useful for situation where a server for example detects a project wide + // change that requires such a calculation. + RefreshSupport bool `json:"refreshSupport,omitempty"` +} + +// A special text edit to provide an insert and a replace operation. +// +// @since 3.16.0 +type InsertReplaceEdit struct { + // The string to be inserted. + NewText string `json:"newText"` + // The range if the insert is requested + Insert Range `json:"insert"` + // The range if the replace is requested. + Replace Range `json:"replace"` +} + +// Defines whether the insert text in a completion item should be interpreted as +// plain text or a snippet. +type InsertTextFormat uint32 + +// How whitespace and indentation is handled during completion +// item insertion. +// +// @since 3.16.0 +type InsertTextMode uint32 +type LSPAny = interface{} + +// LSP arrays. +// @since 3.17.0 +type LSPArray = []interface{} // (alias) line 14200 +type LSPErrorCodes int32 + +// LSP object definition. +// @since 3.17.0 +type LSPObject = map[string]LSPAny // (alias) line 14532 +// Client capabilities for the linked editing range request. +// +// @since 3.16.0 +type LinkedEditingRangeClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is set to `true` + // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + // return value for the corresponding server capability as well. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } - -/*DocumentHighlightParams defined: - * Parameters for a [DocumentHighlightRequest](#DocumentHighlightRequest). - */ -type DocumentHighlightParams struct { +type LinkedEditingRangeOptions struct { + WorkDoneProgressOptions +} +type LinkedEditingRangeParams struct { TextDocumentPositionParams WorkDoneProgressParams - PartialResultParams -} - -/*DocumentHighlightOptions defined: - * Provider options for a [DocumentHighlightRequest](#DocumentHighlightRequest). - */ -type DocumentHighlightOptions struct { - WorkDoneProgressOptions } - -/*DocumentHighlightRegistrationOptions defined: - * Registration options for a [DocumentHighlightRequest](#DocumentHighlightRequest). - */ -type DocumentHighlightRegistrationOptions struct { +type LinkedEditingRangeRegistrationOptions struct { TextDocumentRegistrationOptions - DocumentHighlightOptions + LinkedEditingRangeOptions + StaticRegistrationOptions } -/*DocumentSymbolClientCapabilities defined: - * Client Capabilities for a [DocumentSymbolRequest](#DocumentSymbolRequest). - */ -type DocumentSymbolClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether document symbol supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// The result of a linked editing range request. +// +// @since 3.16.0 +type LinkedEditingRanges struct { + // A list of ranges that can be edited together. The ranges must have + // identical length and contain identical text content. The ranges cannot overlap. + Ranges []Range `json:"ranges"` + // An optional word pattern (regular expression) that describes valid contents for + // the given ranges. If no pattern is provided, the client configuration's word + // pattern will be used. + WordPattern string `json:"wordPattern,omitempty"` +} + +// created for Literal (Lit_NotebookDocumentChangeEvent_cells_textContent_Elem) +type Lit_NotebookDocumentChangeEvent_cells_textContent_Elem struct { + Document VersionedTextDocumentIdentifier `json:"document"` + Changes []TextDocumentContentChangeEvent `json:"changes"` +} + +// created for Literal (Lit_NotebookDocumentFilter_Item1) +type Lit_NotebookDocumentFilter_Item1 struct { + // The type of the enclosing notebook. + NotebookType string `json:"notebookType,omitempty"` + // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. + Scheme string `json:"scheme"` + // A glob pattern. + Pattern string `json:"pattern,omitempty"` +} - /*SymbolKind defined: - * Specific capabilities for the `SymbolKind`. - */ - SymbolKind *struct { - - /*ValueSet defined: - * The symbol kind values the client supports. When this - * property exists the client also guarantees that it will - * handle values outside its set gracefully and falls back - * to a default value when unknown. - * - * If this property is not present the client only supports - * the symbol kinds from `File` to `Array` as defined in - * the initial version of the protocol. - */ - ValueSet []SymbolKind `json:"valueSet,omitempty"` - } `json:"symbolKind,omitempty"` - - /*HierarchicalDocumentSymbolSupport defined: - * The client support hierarchical document symbols. - */ - HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"` +// created for Literal (Lit_NotebookDocumentFilter_Item2) +type Lit_NotebookDocumentFilter_Item2 struct { + // The type of the enclosing notebook. + NotebookType string `json:"notebookType,omitempty"` + // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. + Scheme string `json:"scheme,omitempty"` + // A glob pattern. + Pattern string `json:"pattern"` } -/*DocumentSymbolParams defined: - * Parameters for a [DocumentSymbolRequest](#DocumentSymbolRequest). - */ -type DocumentSymbolParams struct { +// created for Literal (Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_cells_Elem) +type Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_cells_Elem struct { + Language string `json:"language"` +} - /*TextDocument defined: - * The text document. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` - WorkDoneProgressParams - PartialResultParams +// created for Literal (Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1) +type Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1 struct { + // The notebook to be synced If a string + // value is provided it matches against the + // notebook type. '*' matches every notebook. + Notebook *Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_notebook `json:"notebook,omitempty"` + // The cells of the matching notebook to be synced. + Cells []Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_cells_Elem `json:"cells"` } -/*DocumentSymbolOptions defined: - * Provider options for a [DocumentSymbolRequest](#DocumentSymbolRequest). - */ -type DocumentSymbolOptions struct { - WorkDoneProgressOptions +// created for Literal (Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_cells_Elem) +type Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_cells_Elem struct { + Language string `json:"language"` } -/*DocumentSymbolRegistrationOptions defined: - * Registration options for a [DocumentSymbolRequest](#DocumentSymbolRequest). - */ -type DocumentSymbolRegistrationOptions struct { - TextDocumentRegistrationOptions - DocumentSymbolOptions +// created for Literal (Lit_PrepareRenameResult_Item2) +type Lit_PrepareRenameResult_Item2 struct { + DefaultBehavior bool `json:"defaultBehavior"` } -/*CodeActionClientCapabilities defined: - * The Client Capabilities of a [CodeActionRequest](#CodeActionRequest). - */ -type CodeActionClientCapabilities struct { +// created for Literal (Lit_TextDocumentContentChangeEvent_Item1) +type Lit_TextDocumentContentChangeEvent_Item1 struct { + // The new text of the whole document. + Text string `json:"text"` +} - /*DynamicRegistration defined: - * Whether code action supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// created for Literal (Lit_TextDocumentFilter_Item2) +type Lit_TextDocumentFilter_Item2 struct { + // A language id, like `typescript`. + Language string `json:"language,omitempty"` + // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. + Scheme string `json:"scheme,omitempty"` + // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. + Pattern string `json:"pattern"` +} - /*CodeActionLiteralSupport defined: - * The client support code action literals as a valid - * response of the `textDocument/codeAction` request. - * - * @since 3.8.0 - */ - CodeActionLiteralSupport *struct { - - /*CodeActionKind defined: - * The code action kind is support with the following value - * set. - */ - CodeActionKind struct { - - /*ValueSet defined: - * The code action kind values the client supports. When this - * property exists the client also guarantees that it will - * handle values outside its set gracefully and falls back - * to a default value when unknown. - */ - ValueSet []CodeActionKind `json:"valueSet"` - } `json:"codeActionKind"` - } `json:"codeActionLiteralSupport,omitempty"` - - /*IsPreferredSupport defined: - * Whether code action supports the `isPreferred` property. - * @since 3.15.0 - */ - IsPreferredSupport bool `json:"isPreferredSupport,omitempty"` +// Represents a location inside a resource, such as a line +// inside a text file. +type Location struct { + URI DocumentURI `json:"uri"` + Range Range `json:"range"` } -/*CodeActionParams defined: - * The parameters of a [CodeActionRequest](#CodeActionRequest). - */ -type CodeActionParams struct { +// Represents the connection of two locations. Provides additional metadata over normal {@link Location locations}, +// including an origin range. +type LocationLink struct { + // Span of the origin of this link. + // + // Used as the underlined span for mouse interaction. Defaults to the word range at + // the definition position. + OriginSelectionRange *Range `json:"originSelectionRange,omitempty"` + // The target resource identifier of this link. + TargetURI DocumentURI `json:"targetUri"` + // The full target range of this link. If the target for example is a symbol then target range is the + // range enclosing this symbol not including leading/trailing whitespace but everything else + // like comments. This information is typically used to highlight the range in the editor. + TargetRange Range `json:"targetRange"` + // The range that should be selected and revealed when this link is being followed, e.g the name of a function. + // Must be contained by the `targetRange`. See also `DocumentSymbol#range` + TargetSelectionRange Range `json:"targetSelectionRange"` +} - /*TextDocument defined: - * The document in which the command was invoked. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` +// The log message parameters. +type LogMessageParams struct { + // The message type. See {@link MessageType} + Type MessageType `json:"type"` + // The actual message. + Message string `json:"message"` +} +type LogTraceParams struct { + Message string `json:"message"` + Verbose string `json:"verbose,omitempty"` +} - /*Range defined: - * The range for which the command was invoked. - */ - Range Range `json:"range"` +// Client capabilities specific to the used markdown parser. +// +// @since 3.16.0 +type MarkdownClientCapabilities struct { + // The name of the parser. + Parser string `json:"parser"` + // The version of the parser. + Version string `json:"version,omitempty"` + // A list of HTML tags that the client allows / supports in + // Markdown. + // + // @since 3.17.0 + AllowedTags []string `json:"allowedTags,omitempty"` +} + +// MarkedString can be used to render human readable text. It is either a markdown string +// or a code-block that provides a language and a code snippet. The language identifier +// is semantically equal to the optional language identifier in fenced code blocks in GitHub +// issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting +// +// The pair of a language and a value is an equivalent to markdown: +// ```${language} +// ${value} +// ``` +// +// Note that markdown strings will be sanitized - that means html will be escaped. +// @deprecated use MarkupContent instead. +type MarkedString = Or_MarkedString // (alias) line 14479 +// A `MarkupContent` literal represents a string value which content is interpreted base on its +// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. +// +// If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. +// See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting +// +// Here is an example how such a string can be constructed using JavaScript / TypeScript: +// ```ts +// +// let markdown: MarkdownContent = { +// kind: MarkupKind.Markdown, +// value: [ +// '# Header', +// 'Some text', +// '```typescript', +// 'someCode();', +// '```' +// ].join('\n') +// }; +// +// ``` +// +// *Please Note* that clients might sanitize the return markdown. A client could decide to +// remove HTML from the markdown to avoid script execution. +type MarkupContent struct { + // The type of the Markup + Kind MarkupKind `json:"kind"` + // The content itself + Value string `json:"value"` +} - /*Context defined: - * Context carrying additional information. - */ - Context CodeActionContext `json:"context"` - WorkDoneProgressParams - PartialResultParams +// Describes the content type that a client supports in various +// result literals like `Hover`, `ParameterInfo` or `CompletionItem`. +// +// Please note that `MarkupKinds` must not start with a `$`. This kinds +// are reserved for internal usage. +type MarkupKind string +type MessageActionItem struct { + // A short title like 'Retry', 'Open Log' etc. + Title string `json:"title"` } -/*CodeActionOptions defined: - * Provider options for a [CodeActionRequest](#CodeActionRequest). - */ -type CodeActionOptions struct { +// The message type +type MessageType uint32 + +// Moniker definition to match LSIF 0.5 moniker definition. +// +// @since 3.16.0 +type Moniker struct { + // The scheme of the moniker. For example tsc or .Net + Scheme string `json:"scheme"` + // The identifier of the moniker. The value is opaque in LSIF however + // schema owners are allowed to define the structure if they want. + Identifier string `json:"identifier"` + // The scope in which the moniker is unique + Unique UniquenessLevel `json:"unique"` + // The moniker kind if known. + Kind *MonikerKind `json:"kind,omitempty"` +} + +// Client capabilities specific to the moniker request. +// +// @since 3.16.0 +type MonikerClientCapabilities struct { + // Whether moniker supports dynamic registration. If this is set to `true` + // the client supports the new `MonikerRegistrationOptions` return value + // for the corresponding server capability as well. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +} - /*CodeActionKinds defined: - * CodeActionKinds that this server may return. - * - * The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server - * may list out every specific kind they provide. - */ - CodeActionKinds []CodeActionKind `json:"codeActionKinds,omitempty"` +// The moniker kind. +// +// @since 3.16.0 +type MonikerKind string +type MonikerOptions struct { WorkDoneProgressOptions } - -/*CodeActionRegistrationOptions defined: - * Registration options for a [CodeActionRequest](#CodeActionRequest). - */ -type CodeActionRegistrationOptions struct { +type MonikerParams struct { + TextDocumentPositionParams + WorkDoneProgressParams + PartialResultParams +} +type MonikerRegistrationOptions struct { TextDocumentRegistrationOptions - CodeActionOptions + MonikerOptions } -/*WorkspaceSymbolClientCapabilities defined: - * Client capabilities for a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest). - */ -type WorkspaceSymbolClientCapabilities struct { - - /*DynamicRegistration defined: - * Symbol request supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// created for Literal (Lit_MarkedString_Item1) +type Msg_MarkedString struct { + Language string `json:"language"` + Value string `json:"value"` +} - /*SymbolKind defined: - * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. - */ - SymbolKind *struct { - - /*ValueSet defined: - * The symbol kind values the client supports. When this - * property exists the client also guarantees that it will - * handle values outside its set gracefully and falls back - * to a default value when unknown. - * - * If this property is not present the client only supports - * the symbol kinds from `File` to `Array` as defined in - * the initial version of the protocol. - */ - ValueSet []SymbolKind `json:"valueSet,omitempty"` - } `json:"symbolKind,omitempty"` -} - -/*WorkspaceSymbolParams defined: - * The parameters of a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest). - */ -type WorkspaceSymbolParams struct { +// created for Literal (Lit_NotebookDocumentFilter_Item0) +type Msg_NotebookDocumentFilter struct { + // The type of the enclosing notebook. + NotebookType string `json:"notebookType"` + // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. + Scheme string `json:"scheme,omitempty"` + // A glob pattern. + Pattern string `json:"pattern,omitempty"` +} - /*Query defined: - * A query string to filter symbols by. Clients may send an empty - * string here to request all symbols. - */ - Query string `json:"query"` - WorkDoneProgressParams - PartialResultParams +// created for Literal (Lit_PrepareRenameResult_Item1) +type Msg_PrepareRename2Gn struct { + Range Range `json:"range"` + Placeholder string `json:"placeholder"` } -/*WorkspaceSymbolOptions defined: - * Server capabilities for a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest). - */ -type WorkspaceSymbolOptions struct { - WorkDoneProgressOptions +// created for Literal (Lit_TextDocumentContentChangeEvent_Item0) +type Msg_TextDocumentContentChangeEvent struct { + // The range of the document that changed. + Range Range `json:"range"` + // The optional length of the range that got replaced. + // + // @deprecated use range instead. + RangeLength uint32 `json:"rangeLength,omitempty"` + // The new text for the provided range. + Text string `json:"text"` } -/*WorkspaceSymbolRegistrationOptions defined: - * Registration options for a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest). - */ -type WorkspaceSymbolRegistrationOptions struct { - WorkspaceSymbolOptions +// created for Literal (Lit_TextDocumentFilter_Item1) +type Msg_TextDocumentFilter struct { + // A language id, like `typescript`. + Language string `json:"language,omitempty"` + // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. + Scheme string `json:"scheme"` + // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. + Pattern string `json:"pattern,omitempty"` } -/*CodeLensClientCapabilities defined: - * The client capabilities of a [CodeLensRequest](#CodeLensRequest). - */ -type CodeLensClientCapabilities struct { +// created for Literal (Lit__InitializeParams_clientInfo) +type Msg_XInitializeParams_clientInfo struct { + // The name of the client as defined by the client. + Name string `json:"name"` + // The client's version as defined by the client. + Version string `json:"version,omitempty"` +} + +// A notebook cell. +// +// A cell's document URI must be unique across ALL notebook +// cells and can therefore be used to uniquely identify a +// notebook cell or the cell's text document. +// +// @since 3.17.0 +type NotebookCell struct { + // The cell's kind + Kind NotebookCellKind `json:"kind"` + // The URI of the cell's text document + // content. + Document DocumentURI `json:"document"` + // Additional metadata stored with the cell. + // + // Note: should always be an object literal (e.g. LSPObject) + Metadata *LSPObject `json:"metadata,omitempty"` + // Additional execution summary information + // if supported by the client. + ExecutionSummary *ExecutionSummary `json:"executionSummary,omitempty"` +} + +// A change describing how to move a `NotebookCell` +// array from state S to S'. +// +// @since 3.17.0 +type NotebookCellArrayChange struct { + // The start oftest of the cell that changed. + Start uint32 `json:"start"` + // The deleted cells + DeleteCount uint32 `json:"deleteCount"` + // The new cells, if any + Cells []NotebookCell `json:"cells,omitempty"` +} + +// A notebook cell kind. +// +// @since 3.17.0 +type NotebookCellKind uint32 + +// A notebook cell text document filter denotes a cell text +// document by different properties. +// +// @since 3.17.0 +type NotebookCellTextDocumentFilter struct { + // A filter that matches against the notebook + // containing the notebook cell. If a string + // value is provided it matches against the + // notebook type. '*' matches every notebook. + Notebook Or_NotebookCellTextDocumentFilter_notebook `json:"notebook"` + // A language id like `python`. + // + // Will be matched against the language id of the + // notebook cell document. '*' matches every language. + Language string `json:"language,omitempty"` +} - /*DynamicRegistration defined: - * Whether code lens supports dynamic registration. - */ +// A notebook document. +// +// @since 3.17.0 +type NotebookDocument struct { + // The notebook document's uri. + URI URI `json:"uri"` + // The type of the notebook. + NotebookType string `json:"notebookType"` + // The version number of this document (it will increase after each + // change, including undo/redo). + Version int32 `json:"version"` + // Additional metadata stored with the notebook + // document. + // + // Note: should always be an object literal (e.g. LSPObject) + Metadata *LSPObject `json:"metadata,omitempty"` + // The cells of a notebook. + Cells []NotebookCell `json:"cells"` +} + +// A change event for a notebook document. +// +// @since 3.17.0 +type NotebookDocumentChangeEvent struct { + // The changed meta data if any. + // + // Note: should always be an object literal (e.g. LSPObject) + Metadata *LSPObject `json:"metadata,omitempty"` + // Changes to cells + Cells *PCellsPChange `json:"cells,omitempty"` +} + +// Capabilities specific to the notebook document support. +// +// @since 3.17.0 +type NotebookDocumentClientCapabilities struct { + // Capabilities specific to notebook document synchronization + // + // @since 3.17.0 + Synchronization NotebookDocumentSyncClientCapabilities `json:"synchronization"` +} + +// A notebook document filter denotes a notebook document by +// different properties. The properties will be match +// against the notebook's URI (same as with documents) +// +// @since 3.17.0 +type NotebookDocumentFilter = Msg_NotebookDocumentFilter // (alias) line 14675 +// A literal to identify a notebook document in the client. +// +// @since 3.17.0 +type NotebookDocumentIdentifier struct { + // The notebook document's uri. + URI URI `json:"uri"` +} + +// Notebook specific client capabilities. +// +// @since 3.17.0 +type NotebookDocumentSyncClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is + // set to `true` the client supports the new + // `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + // return value for the corresponding server capability as well. DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // The client supports sending execution summary data per cell. + ExecutionSummarySupport bool `json:"executionSummarySupport,omitempty"` +} + +// Options specific to a notebook plus its cells +// to be synced to the server. +// +// If a selector provides a notebook document +// filter but no cell selector all cells of a +// matching notebook document will be synced. +// +// If a selector provides no notebook document +// filter but only a cell selector all notebook +// document that contain at least one matching +// cell will be synced. +// +// @since 3.17.0 +type NotebookDocumentSyncOptions struct { + // The notebooks to be synced + NotebookSelector []Or_NotebookDocumentSyncOptions_notebookSelector_Elem `json:"notebookSelector"` + // Whether save notification should be forwarded to + // the server. Will only be honored if mode === `notebook`. + Save bool `json:"save,omitempty"` +} + +// Registration options specific to a notebook. +// +// @since 3.17.0 +type NotebookDocumentSyncRegistrationOptions struct { + NotebookDocumentSyncOptions + StaticRegistrationOptions } -/*CodeLensParams defined: - * The parameters of a [CodeLensRequest](#CodeLensRequest). - */ -type CodeLensParams struct { +// A text document identifier to optionally denote a specific version of a text document. +type OptionalVersionedTextDocumentIdentifier struct { + // The version number of this document. If a versioned text document identifier + // is sent from the server to the client and the file is not open in the editor + // (the server has not received an open notification before) the server can send + // `null` to indicate that the version is unknown and the content on disk is the + // truth (as specified with document content ownership). + Version int32 `json:"version"` + TextDocumentIdentifier +} - /*TextDocument defined: - * The document to request code lens for. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` - WorkDoneProgressParams - PartialResultParams +// created for Or [FEditRangePItemDefaults Range] +type OrFEditRangePItemDefaults struct { + Value interface{} `json:"value"` } -/*CodeLensOptions defined: - * Code Lens provider options of a [CodeLensRequest](#CodeLensRequest). - */ -type CodeLensOptions struct { +// created for Or [Location PLocationMsg_workspace_symbol] +type OrPLocation_workspace_symbol struct { + Value interface{} `json:"value"` +} - /*ResolveProvider defined: - * Code lens has a resolve provider as well. - */ - ResolveProvider bool `json:"resolveProvider,omitempty"` - WorkDoneProgressOptions +// created for Or [[]string string] +type OrPSection_workspace_didChangeConfiguration struct { + Value interface{} `json:"value"` } -/*CodeLensRegistrationOptions defined: - * Registration options for a [CodeLensRequest](#CodeLensRequest). - */ -type CodeLensRegistrationOptions struct { - TextDocumentRegistrationOptions - CodeLensOptions +// created for Or [MarkupContent string] +type OrPTooltipPLabel struct { + Value interface{} `json:"value"` } -/*DocumentLinkClientCapabilities defined: - * The client capabilities of a [DocumentLinkRequest](#DocumentLinkRequest). - */ -type DocumentLinkClientCapabilities struct { +// created for Or [MarkupContent string] +type OrPTooltip_textDocument_inlayHint struct { + Value interface{} `json:"value"` +} - /*DynamicRegistration defined: - * Whether document link supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// created for Or [int32 string] +type Or_CancelParams_id struct { + Value interface{} `json:"value"` +} - /*TooltipSupport defined: - * Whether the client support the `tooltip` property on `DocumentLink`. - * - * @since 3.15.0 - */ - TooltipSupport bool `json:"tooltipSupport,omitempty"` +// created for Or [MarkupContent string] +type Or_CompletionItem_documentation struct { + Value interface{} `json:"value"` } -/*DocumentLinkParams defined: - * The parameters of a [DocumentLinkRequest](#DocumentLinkRequest). - */ -type DocumentLinkParams struct { +// created for Or [InsertReplaceEdit TextEdit] +type Or_CompletionItem_textEdit struct { + Value interface{} `json:"value"` +} - /*TextDocument defined: - * The document to provide document links for. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` - WorkDoneProgressParams - PartialResultParams +// created for Or [Location []Location] +type Or_Definition struct { + Value interface{} `json:"value"` } -/*DocumentLinkOptions defined: - * Provider options for a [DocumentLinkRequest](#DocumentLinkRequest). - */ -type DocumentLinkOptions struct { +// created for Or [int32 string] +type Or_Diagnostic_code struct { + Value interface{} `json:"value"` +} - /*ResolveProvider defined: - * Document links have a resolve provider as well. - */ - ResolveProvider bool `json:"resolveProvider,omitempty"` - WorkDoneProgressOptions +// created for Or [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport] +type Or_DocumentDiagnosticReport struct { + Value interface{} `json:"value"` } -/*DocumentLinkRegistrationOptions defined: - * Registration options for a [DocumentLinkRequest](#DocumentLinkRequest). - */ -type DocumentLinkRegistrationOptions struct { - TextDocumentRegistrationOptions - DocumentLinkOptions +// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport] +type Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value struct { + Value interface{} `json:"value"` } -/*DocumentFormattingClientCapabilities defined: - * Client capabilities of a [DocumentFormattingRequest](#DocumentFormattingRequest). - */ -type DocumentFormattingClientCapabilities struct { +// created for Or [NotebookCellTextDocumentFilter TextDocumentFilter] +type Or_DocumentFilter struct { + Value interface{} `json:"value"` +} - /*DynamicRegistration defined: - * Whether formatting supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// created for Or [MarkedString MarkupContent []MarkedString] +type Or_Hover_contents struct { + Value interface{} `json:"value"` } -/*DocumentFormattingParams defined: - * The parameters of a [DocumentFormattingRequest](#DocumentFormattingRequest). - */ -type DocumentFormattingParams struct { +// created for Or [[]InlayHintLabelPart string] +type Or_InlayHint_label struct { + Value interface{} `json:"value"` +} - /*TextDocument defined: - * The document to format. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` +// created for Or [StringValue string] +type Or_InlineCompletionItem_insertText struct { + Value interface{} `json:"value"` +} - /*Options defined: - * The format options - */ - Options FormattingOptions `json:"options"` - WorkDoneProgressParams +// created for Or [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup] +type Or_InlineValue struct { + Value interface{} `json:"value"` } -/*DocumentFormattingOptions defined: - * Provider options for a [DocumentFormattingRequest](#DocumentFormattingRequest). - */ -type DocumentFormattingOptions struct { - WorkDoneProgressOptions +// created for Or [Msg_MarkedString string] +type Or_MarkedString struct { + Value interface{} `json:"value"` } -/*DocumentFormattingRegistrationOptions defined: - * Registration options for a [DocumentFormattingRequest](#DocumentFormattingRequest). - */ -type DocumentFormattingRegistrationOptions struct { - TextDocumentRegistrationOptions - DocumentFormattingOptions +// created for Or [NotebookDocumentFilter string] +type Or_NotebookCellTextDocumentFilter_notebook struct { + Value interface{} `json:"value"` } -/*DocumentRangeFormattingClientCapabilities defined: - * Client capabilities of a [DocumentRangeFormattingRequest](#DocumentRangeFormattingRequest). - */ -type DocumentRangeFormattingClientCapabilities struct { +// created for Or [Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1 PNotebookSelectorPNotebookDocumentSync] +type Or_NotebookDocumentSyncOptions_notebookSelector_Elem struct { + Value interface{} `json:"value"` +} - /*DynamicRegistration defined: - * Whether range formatting supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// created for Or [NotebookDocumentFilter string] +type Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_notebook struct { + Value interface{} `json:"value"` } -/*DocumentRangeFormattingParams defined: - * The parameters of a [DocumentRangeFormattingRequest](#DocumentRangeFormattingRequest). - */ -type DocumentRangeFormattingParams struct { - - /*TextDocument defined: - * The document to format. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` - - /*Range defined: - * The range to format - */ - Range Range `json:"range"` - - /*Options defined: - * The format options - */ - Options FormattingOptions `json:"options"` - WorkDoneProgressParams +// created for Or [NotebookDocumentFilter string] +type Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_notebook struct { + Value interface{} `json:"value"` } -/*DocumentRangeFormattingOptions defined: - * Provider options for a [DocumentRangeFormattingRequest](#DocumentRangeFormattingRequest). - */ -type DocumentRangeFormattingOptions struct { - WorkDoneProgressOptions +// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport] +type Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value struct { + Value interface{} `json:"value"` } -/*DocumentRangeFormattingRegistrationOptions defined: - * Registration options for a [DocumentRangeFormattingRequest](#DocumentRangeFormattingRequest). - */ -type DocumentRangeFormattingRegistrationOptions struct { - TextDocumentRegistrationOptions - DocumentRangeFormattingOptions +// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport] +type Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value struct { + Value interface{} `json:"value"` } -/*DocumentOnTypeFormattingClientCapabilities defined: - * Client capabilities of a [DocumentOnTypeFormattingRequest](#DocumentOnTypeFormattingRequest). - */ -type DocumentOnTypeFormattingClientCapabilities struct { - - /*DynamicRegistration defined: - * Whether on type formatting supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// created for Or [URI WorkspaceFolder] +type Or_RelativePattern_baseUri struct { + Value interface{} `json:"value"` } -/*DocumentOnTypeFormattingParams defined: - * The parameters of a [DocumentOnTypeFormattingRequest](#DocumentOnTypeFormattingRequest). - */ -type DocumentOnTypeFormattingParams struct { - - /*TextDocument defined: - * The document to format. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` - - /*Position defined: - * The position at which this request was send. - */ - Position Position `json:"position"` +// created for Or [CodeAction Command] +type Or_Result_textDocument_codeAction_Item0_Elem struct { + Value interface{} `json:"value"` +} - /*Ch defined: - * The character that has been typed. - */ - Ch string `json:"ch"` +// created for Or [InlineCompletionList []InlineCompletionItem] +type Or_Result_textDocument_inlineCompletion struct { + Value interface{} `json:"value"` +} - /*Options defined: - * The format options. - */ - Options FormattingOptions `json:"options"` +// created for Or [FFullPRequests bool] +type Or_SemanticTokensClientCapabilities_requests_full struct { + Value interface{} `json:"value"` } -/*DocumentOnTypeFormattingOptions defined: - * Provider options for a [DocumentOnTypeFormattingRequest](#DocumentOnTypeFormattingRequest). - */ -type DocumentOnTypeFormattingOptions struct { +// created for Or [FRangePRequests bool] +type Or_SemanticTokensClientCapabilities_requests_range struct { + Value interface{} `json:"value"` +} - /*FirstTriggerCharacter defined: - * A character on which formatting should be triggered, like `}`. - */ - FirstTriggerCharacter string `json:"firstTriggerCharacter"` +// created for Or [PFullESemanticTokensOptions bool] +type Or_SemanticTokensOptions_full struct { + Value interface{} `json:"value"` +} - /*MoreTriggerCharacter defined: - * More trigger characters. - */ - MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"` +// created for Or [PRangeESemanticTokensOptions bool] +type Or_SemanticTokensOptions_range struct { + Value interface{} `json:"value"` } -/*DocumentOnTypeFormattingRegistrationOptions defined: - * Registration options for a [DocumentOnTypeFormattingRequest](#DocumentOnTypeFormattingRequest). - */ -type DocumentOnTypeFormattingRegistrationOptions struct { - TextDocumentRegistrationOptions - DocumentOnTypeFormattingOptions +// created for Or [CallHierarchyOptions CallHierarchyRegistrationOptions bool] +type Or_ServerCapabilities_callHierarchyProvider struct { + Value interface{} `json:"value"` } -// RenameClientCapabilities is -type RenameClientCapabilities struct { +// created for Or [CodeActionOptions bool] +type Or_ServerCapabilities_codeActionProvider struct { + Value interface{} `json:"value"` +} - /*DynamicRegistration defined: - * Whether rename supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// created for Or [DocumentColorOptions DocumentColorRegistrationOptions bool] +type Or_ServerCapabilities_colorProvider struct { + Value interface{} `json:"value"` +} - /*PrepareSupport defined: - * Client supports testing for validity of rename operations - * before execution. - * - * @since version 3.12.0 - */ - PrepareSupport bool `json:"prepareSupport,omitempty"` +// created for Or [DeclarationOptions DeclarationRegistrationOptions bool] +type Or_ServerCapabilities_declarationProvider struct { + Value interface{} `json:"value"` } -/*RenameParams defined: - * The parameters of a [RenameRequest](#RenameRequest). - */ -type RenameParams struct { +// created for Or [DefinitionOptions bool] +type Or_ServerCapabilities_definitionProvider struct { + Value interface{} `json:"value"` +} - /*TextDocument defined: - * The document to rename. - */ - TextDocument TextDocumentIdentifier `json:"textDocument"` +// created for Or [DiagnosticOptions DiagnosticRegistrationOptions] +type Or_ServerCapabilities_diagnosticProvider struct { + Value interface{} `json:"value"` +} - /*Position defined: - * The position at which this request was sent. - */ - Position Position `json:"position"` +// created for Or [DocumentFormattingOptions bool] +type Or_ServerCapabilities_documentFormattingProvider struct { + Value interface{} `json:"value"` +} - /*NewName defined: - * The new name of the symbol. If the given name is not valid the - * request must return a [ResponseError](#ResponseError) with an - * appropriate message set. - */ - NewName string `json:"newName"` - WorkDoneProgressParams +// created for Or [DocumentHighlightOptions bool] +type Or_ServerCapabilities_documentHighlightProvider struct { + Value interface{} `json:"value"` } -/*RenameOptions defined: - * Provider options for a [RenameRequest](#RenameRequest). - */ -type RenameOptions struct { +// created for Or [DocumentRangeFormattingOptions bool] +type Or_ServerCapabilities_documentRangeFormattingProvider struct { + Value interface{} `json:"value"` +} - /*PrepareProvider defined: - * Renames should be checked and tested before being executed. - * - * @since version 3.12.0 - */ - PrepareProvider bool `json:"prepareProvider,omitempty"` - WorkDoneProgressOptions +// created for Or [DocumentSymbolOptions bool] +type Or_ServerCapabilities_documentSymbolProvider struct { + Value interface{} `json:"value"` } -/*RenameRegistrationOptions defined: - * Registration options for a [RenameRequest](#RenameRequest). - */ -type RenameRegistrationOptions struct { - TextDocumentRegistrationOptions - RenameOptions +// created for Or [FoldingRangeOptions FoldingRangeRegistrationOptions bool] +type Or_ServerCapabilities_foldingRangeProvider struct { + Value interface{} `json:"value"` } -// PrepareRenameParams is -type PrepareRenameParams struct { - TextDocumentPositionParams - WorkDoneProgressParams +// created for Or [HoverOptions bool] +type Or_ServerCapabilities_hoverProvider struct { + Value interface{} `json:"value"` } -/*ExecuteCommandClientCapabilities defined: - * The client capabilities of a [ExecuteCommandRequest](#ExecuteCommandRequest). - */ -type ExecuteCommandClientCapabilities struct { +// created for Or [ImplementationOptions ImplementationRegistrationOptions bool] +type Or_ServerCapabilities_implementationProvider struct { + Value interface{} `json:"value"` +} - /*DynamicRegistration defined: - * Execute command supports dynamic registration. - */ - DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +// created for Or [InlayHintOptions InlayHintRegistrationOptions bool] +type Or_ServerCapabilities_inlayHintProvider struct { + Value interface{} `json:"value"` } -/*ExecuteCommandParams defined: - * The parameters of a [ExecuteCommandRequest](#ExecuteCommandRequest). - */ -type ExecuteCommandParams struct { +// created for Or [InlineCompletionOptions bool] +type Or_ServerCapabilities_inlineCompletionProvider struct { + Value interface{} `json:"value"` +} - /*Command defined: - * The identifier of the actual command handler. - */ - Command string `json:"command"` +// created for Or [InlineValueOptions InlineValueRegistrationOptions bool] +type Or_ServerCapabilities_inlineValueProvider struct { + Value interface{} `json:"value"` +} - /*Arguments defined: - * Arguments that the command should be invoked with. - */ - Arguments []interface{} `json:"arguments,omitempty"` - WorkDoneProgressParams +// created for Or [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool] +type Or_ServerCapabilities_linkedEditingRangeProvider struct { + Value interface{} `json:"value"` } -/*ExecuteCommandOptions defined: - * The server capabilities of a [ExecuteCommandRequest](#ExecuteCommandRequest). - */ -type ExecuteCommandOptions struct { +// created for Or [MonikerOptions MonikerRegistrationOptions bool] +type Or_ServerCapabilities_monikerProvider struct { + Value interface{} `json:"value"` +} - /*Commands defined: - * The commands to be executed on the server - */ - Commands []string `json:"commands"` - WorkDoneProgressOptions +// created for Or [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions] +type Or_ServerCapabilities_notebookDocumentSync struct { + Value interface{} `json:"value"` } -/*ExecuteCommandRegistrationOptions defined: - * Registration options for a [ExecuteCommandRequest](#ExecuteCommandRequest). - */ -type ExecuteCommandRegistrationOptions struct { - ExecuteCommandOptions +// created for Or [ReferenceOptions bool] +type Or_ServerCapabilities_referencesProvider struct { + Value interface{} `json:"value"` } -// WorkspaceEditClientCapabilities is -type WorkspaceEditClientCapabilities struct { +// created for Or [RenameOptions bool] +type Or_ServerCapabilities_renameProvider struct { + Value interface{} `json:"value"` +} - /*DocumentChanges defined: - * The client supports versioned document changes in `WorkspaceEdit`s - */ - DocumentChanges bool `json:"documentChanges,omitempty"` +// created for Or [SelectionRangeOptions SelectionRangeRegistrationOptions bool] +type Or_ServerCapabilities_selectionRangeProvider struct { + Value interface{} `json:"value"` +} - /*ResourceOperations defined: - * The resource operations the client supports. Clients should at least - * support 'create', 'rename' and 'delete' files and folders. - * - * @since 3.13.0 - */ - ResourceOperations []ResourceOperationKind `json:"resourceOperations,omitempty"` +// created for Or [SemanticTokensOptions SemanticTokensRegistrationOptions] +type Or_ServerCapabilities_semanticTokensProvider struct { + Value interface{} `json:"value"` +} - /*FailureHandling defined: - * The failure handling strategy of a client if applying the workspace edit - * fails. - * - * @since 3.13.0 - */ - FailureHandling FailureHandlingKind `json:"failureHandling,omitempty"` +// created for Or [TextDocumentSyncKind TextDocumentSyncOptions] +type Or_ServerCapabilities_textDocumentSync struct { + Value interface{} `json:"value"` } -/*ApplyWorkspaceEditParams defined: - * The parameters passed via a apply workspace edit request. - */ -type ApplyWorkspaceEditParams struct { +// created for Or [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool] +type Or_ServerCapabilities_typeDefinitionProvider struct { + Value interface{} `json:"value"` +} - /*Label defined: - * An optional label of the workspace edit. This label is - * presented in the user interface for example on an undo - * stack to undo the workspace edit. - */ - Label string `json:"label,omitempty"` +// created for Or [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool] +type Or_ServerCapabilities_typeHierarchyProvider struct { + Value interface{} `json:"value"` +} - /*Edit defined: - * The edits to apply. - */ - Edit WorkspaceEdit `json:"edit"` +// created for Or [WorkspaceSymbolOptions bool] +type Or_ServerCapabilities_workspaceSymbolProvider struct { + Value interface{} `json:"value"` } -/*ApplyWorkspaceEditResponse defined: - * A response returned from the apply workspace edit request. - */ -type ApplyWorkspaceEditResponse struct { +// created for Or [MarkupContent string] +type Or_SignatureInformation_documentation struct { + Value interface{} `json:"value"` +} - /*Applied defined: - * Indicates whether the edit was applied or not. - */ - Applied bool `json:"applied"` +// created for Or [AnnotatedTextEdit TextEdit] +type Or_TextDocumentEdit_edits_Elem struct { + Value interface{} `json:"value"` +} - /*FailureReason defined: - * An optional textual description for why the edit was not applied. - * This may be used by the server for diagnostic logging or to provide - * a suitable error for a request that triggered the edit. - */ - FailureReason string `json:"failureReason,omitempty"` +// created for Or [SaveOptions bool] +type Or_TextDocumentSyncOptions_save struct { + Value interface{} `json:"value"` +} - /*FailedChange defined: - * Depending on the client's failure handling strategy `failedChange` might - * contain the index of the change that failed. This property is only available - * if the client signals a `failureHandlingStrategy` in its client capabilities. - */ - FailedChange float64 `json:"failedChange,omitempty"` -} - -/*Position defined: - * Position in a text document expressed as zero-based line and character offset. - * The offsets are based on a UTF-16 string representation. So a string of the form - * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀` - * is 1 and the character offset of b is 3 since `𐐀` is represented using two code - * units in UTF-16. - * - * Positions are line end character agnostic. So you can not specify a position that - * denotes `\r|\n` or `\n|` where `|` represents the character offset. - */ -type Position struct { +// created for Or [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport] +type Or_WorkspaceDocumentDiagnosticReport struct { + Value interface{} `json:"value"` +} - /*Line defined: - * Line position in a document (zero-based). - * If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. - * If a line number is negative, it defaults to 0. - */ - Line float64 `json:"line"` - - /*Character defined: - * Character offset on a line in a document (zero-based). Assuming that the line is - * represented as a string, the `character` value represents the gap between the - * `character` and `character + 1`. - * - * If the character value is greater than the line length it defaults back to the - * line length. - * If a line number is negative, it defaults to 0. - */ - Character float64 `json:"character"` -} - -/*Range defined: - * A range in a text document expressed as (zero-based) start and end positions. - * - * If you want to specify a range that contains a line including the line ending - * character(s) then use an end position denoting the start of the next line. - * For example: - * ```ts - * { - * start: { line: 5, character: 23 } - * end : { line 6, character : 0 } - * } - * ``` - */ -type Range struct { +// created for Or [CreateFile DeleteFile RenameFile TextDocumentEdit] +type Or_WorkspaceEdit_documentChanges_Elem struct { + Value interface{} `json:"value"` +} - /*Start defined: - * The range's start position - */ - Start Position `json:"start"` +// created for Or [bool string] +type Or_WorkspaceFoldersServerCapabilities_changeNotifications struct { + Value interface{} `json:"value"` +} - /*End defined: - * The range's end position. - */ - End Position `json:"end"` +// created for Or [Declaration []DeclarationLink] +type Or_textDocument_declaration struct { + Value interface{} `json:"value"` } -/*Location defined: - * Represents a location inside a resource, such as a line - * inside a text file. - */ -type Location struct { +// created for Literal (Lit_NotebookDocumentChangeEvent_cells) +type PCellsPChange struct { + // Changes to the cell structure to add or + // remove cells. + Structure *FStructurePCells `json:"structure,omitempty"` + // Changes to notebook cells properties like its + // kind, execution summary or metadata. + Data []NotebookCell `json:"data,omitempty"` + // Changes to the text content of notebook cells. + TextContent []Lit_NotebookDocumentChangeEvent_cells_textContent_Elem `json:"textContent,omitempty"` +} + +// created for Literal (Lit_WorkspaceEditClientCapabilities_changeAnnotationSupport) +type PChangeAnnotationSupportPWorkspaceEdit struct { + // Whether the client groups edits with equal labels into tree nodes, + // for instance all edits labelled with "Changes in Strings" would + // be a tree node. + GroupsOnLabel bool `json:"groupsOnLabel,omitempty"` +} + +// created for Literal (Lit_CodeActionClientCapabilities_codeActionLiteralSupport) +type PCodeActionLiteralSupportPCodeAction struct { + // The code action kind is support with the following value + // set. + CodeActionKind FCodeActionKindPCodeActionLiteralSupport `json:"codeActionKind"` +} + +// created for Literal (Lit_CompletionClientCapabilities_completionItemKind) +type PCompletionItemKindPCompletion struct { + // The completion item kind values the client supports. When this + // property exists the client also guarantees that it will + // handle values outside its set gracefully and falls back + // to a default value when unknown. + // + // If this property is not present the client only supports + // the completion items kinds from `Text` to `Reference` as defined in + // the initial version of the protocol. + ValueSet []CompletionItemKind `json:"valueSet,omitempty"` +} + +// created for Literal (Lit_CompletionClientCapabilities_completionItem) +type PCompletionItemPCompletion struct { + // Client supports snippets as insert text. + // + // A snippet can define tab stops and placeholders with `$1`, `$2` + // and `${3:foo}`. `$0` defines the final tab stop, it defaults to + // the end of the snippet. Placeholders with equal identifiers are linked, + // that is typing in one will update others too. + SnippetSupport bool `json:"snippetSupport,omitempty"` + // Client supports commit characters on a completion item. + CommitCharactersSupport bool `json:"commitCharactersSupport,omitempty"` + // Client supports the following content formats for the documentation + // property. The order describes the preferred format of the client. + DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"` + // Client supports the deprecated property on a completion item. + DeprecatedSupport bool `json:"deprecatedSupport,omitempty"` + // Client supports the preselect property on a completion item. + PreselectSupport bool `json:"preselectSupport,omitempty"` + // Client supports the tag property on a completion item. Clients supporting + // tags have to handle unknown tags gracefully. Clients especially need to + // preserve unknown tags when sending a completion item back to the server in + // a resolve call. + // + // @since 3.15.0 + TagSupport *FTagSupportPCompletionItem `json:"tagSupport,omitempty"` + // Client support insert replace edit to control different behavior if a + // completion item is inserted in the text or should replace text. + // + // @since 3.16.0 + InsertReplaceSupport bool `json:"insertReplaceSupport,omitempty"` + // Indicates which properties a client can resolve lazily on a completion + // item. Before version 3.16.0 only the predefined properties `documentation` + // and `details` could be resolved lazily. + // + // @since 3.16.0 + ResolveSupport *FResolveSupportPCompletionItem `json:"resolveSupport,omitempty"` + // The client supports the `insertTextMode` property on + // a completion item to override the whitespace handling mode + // as defined by the client (see `insertTextMode`). + // + // @since 3.16.0 + InsertTextModeSupport *FInsertTextModeSupportPCompletionItem `json:"insertTextModeSupport,omitempty"` + // The client has support for completion item label + // details (see also `CompletionItemLabelDetails`). + // + // @since 3.17.0 + LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"` +} + +// created for Literal (Lit_CompletionOptions_completionItem) +type PCompletionItemPCompletionProvider struct { + // The server has support for completion item label + // details (see also `CompletionItemLabelDetails`) when + // receiving a completion item in a resolve call. + // + // @since 3.17.0 + LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"` +} + +// created for Literal (Lit_CompletionClientCapabilities_completionList) +type PCompletionListPCompletion struct { + // The client supports the following itemDefaults on + // a completion list. + // + // The value lists the supported property names of the + // `CompletionList.itemDefaults` object. If omitted + // no properties are supported. + // + // @since 3.17.0 + ItemDefaults []string `json:"itemDefaults,omitempty"` +} + +// created for Literal (Lit_CodeAction_disabled) +type PDisabledMsg_textDocument_codeAction struct { + // Human readable description of why the code action is currently disabled. + // + // This is displayed in the code actions UI. + Reason string `json:"reason"` +} + +// created for Literal (Lit_FoldingRangeClientCapabilities_foldingRangeKind) +type PFoldingRangeKindPFoldingRange struct { + // The folding range kind values the client supports. When this + // property exists the client also guarantees that it will + // handle values outside its set gracefully and falls back + // to a default value when unknown. + ValueSet []FoldingRangeKind `json:"valueSet,omitempty"` +} + +// created for Literal (Lit_FoldingRangeClientCapabilities_foldingRange) +type PFoldingRangePFoldingRange struct { + // If set, the client signals that it supports setting collapsedText on + // folding ranges to display custom labels instead of the default text. + // + // @since 3.17.0 + CollapsedText bool `json:"collapsedText,omitempty"` +} + +// created for Literal (Lit_SemanticTokensOptions_full_Item1) +type PFullESemanticTokensOptions struct { + // The server supports deltas for full documents. + Delta bool `json:"delta,omitempty"` +} + +// created for Literal (Lit_CompletionList_itemDefaults) +type PItemDefaultsMsg_textDocument_completion struct { + // A default commit character set. + // + // @since 3.17.0 + CommitCharacters []string `json:"commitCharacters,omitempty"` + // A default edit range. + // + // @since 3.17.0 + EditRange *OrFEditRangePItemDefaults `json:"editRange,omitempty"` + // A default insert text format. + // + // @since 3.17.0 + InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"` + // A default insert text mode. + // + // @since 3.17.0 + InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"` + // A default data value. + // + // @since 3.17.0 + Data interface{} `json:"data,omitempty"` +} - // URI is +// created for Literal (Lit_WorkspaceSymbol_location_Item1) +type PLocationMsg_workspace_symbol struct { URI DocumentURI `json:"uri"` - - // Range is - Range Range `json:"range"` } -/*LocationLink defined: - * Represents the connection of two locations. Provides additional metadata over normal [locations](#Location), - * including an origin range. - */ -type LocationLink struct { - - /*OriginSelectionRange defined: - * Span of the origin of this link. - * - * Used as the underlined span for mouse definition hover. Defaults to the word range at - * the definition position. - */ - OriginSelectionRange *Range `json:"originSelectionRange,omitempty"` - - /*TargetURI defined: - * The target resource identifier of this link. - */ - TargetURI DocumentURI `json:"targetUri"` - - /*TargetRange defined: - * The full target range of this link. If the target for example is a symbol then target range is the - * range enclosing this symbol not including leading/trailing whitespace but everything else - * like comments. This information is typically used to highlight the range in the editor. - */ - TargetRange Range `json:"targetRange"` - - /*TargetSelectionRange defined: - * The range that should be selected and revealed when this link is being followed, e.g the name of a function. - * Must be contained by the the `targetRange`. See also `DocumentSymbol#range` - */ - TargetSelectionRange Range `json:"targetSelectionRange"` +// created for Literal (Lit_ShowMessageRequestClientCapabilities_messageActionItem) +type PMessageActionItemPShowMessage struct { + // Whether the client supports additional attributes which + // are preserved and send back to the server in the + // request's response. + AdditionalPropertiesSupport bool `json:"additionalPropertiesSupport,omitempty"` } -/*Color defined: - * Represents a color in RGBA space. - */ -type Color struct { - - /*Red defined: - * The red component of this color in the range [0-1]. - */ - Red float64 `json:"red"` - - /*Green defined: - * The green component of this color in the range [0-1]. - */ - Green float64 `json:"green"` +// created for Literal (Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0) +type PNotebookSelectorPNotebookDocumentSync struct { + // The notebook to be synced If a string + // value is provided it matches against the + // notebook type. '*' matches every notebook. + Notebook Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_notebook `json:"notebook"` + // The cells of the matching notebook to be synced. + Cells []Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_cells_Elem `json:"cells,omitempty"` +} - /*Blue defined: - * The blue component of this color in the range [0-1]. - */ - Blue float64 `json:"blue"` +// created for Literal (Lit_SemanticTokensOptions_range_Item1) +type PRangeESemanticTokensOptions struct { +} - /*Alpha defined: - * The alpha component of this color in the range [0-1]. - */ - Alpha float64 `json:"alpha"` +// created for Literal (Lit_SemanticTokensClientCapabilities_requests) +type PRequestsPSemanticTokens struct { + // The client will send the `textDocument/semanticTokens/range` request if + // the server provides a corresponding handler. + Range *Or_SemanticTokensClientCapabilities_requests_range `json:"range,omitempty"` + // The client will send the `textDocument/semanticTokens/full` request if + // the server provides a corresponding handler. + Full *Or_SemanticTokensClientCapabilities_requests_full `json:"full,omitempty"` } -/*ColorInformation defined: - * Represents a color range from a document. - */ -type ColorInformation struct { +// created for Literal (Lit_CodeActionClientCapabilities_resolveSupport) +type PResolveSupportPCodeAction struct { + // The properties that a client can resolve lazily. + Properties []string `json:"properties"` +} - /*Range defined: - * The range in the document where this color appers. - */ - Range Range `json:"range"` +// created for Literal (Lit_InlayHintClientCapabilities_resolveSupport) +type PResolveSupportPInlayHint struct { + // The properties that a client can resolve lazily. + Properties []string `json:"properties"` +} - /*Color defined: - * The actual color value for this color range. - */ - Color Color `json:"color"` +// created for Literal (Lit_WorkspaceSymbolClientCapabilities_resolveSupport) +type PResolveSupportPSymbol struct { + // The properties that a client can resolve lazily. Usually + // `location.range` + Properties []string `json:"properties"` } -// ColorPresentation is -type ColorPresentation struct { +// created for Literal (Lit_InitializeResult_serverInfo) +type PServerInfoMsg_initialize struct { + // The name of the server as defined by the server. + Name string `json:"name"` + // The server's version as defined by the server. + Version string `json:"version,omitempty"` +} + +// created for Literal (Lit_SignatureHelpClientCapabilities_signatureInformation) +type PSignatureInformationPSignatureHelp struct { + // Client supports the following content formats for the documentation + // property. The order describes the preferred format of the client. + DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"` + // Client capabilities specific to parameter information. + ParameterInformation *FParameterInformationPSignatureInformation `json:"parameterInformation,omitempty"` + // The client supports the `activeParameter` property on `SignatureInformation` + // literal. + // + // @since 3.16.0 + ActiveParameterSupport bool `json:"activeParameterSupport,omitempty"` +} + +// created for Literal (Lit_GeneralClientCapabilities_staleRequestSupport) +type PStaleRequestSupportPGeneral struct { + // The client will actively cancel the request. + Cancel bool `json:"cancel"` + // The list of requests for which the client + // will retry the request if it receives a + // response with error code `ContentModified` + RetryOnContentModified []string `json:"retryOnContentModified"` +} + +// created for Literal (Lit_DocumentSymbolClientCapabilities_symbolKind) +type PSymbolKindPDocumentSymbol struct { + // The symbol kind values the client supports. When this + // property exists the client also guarantees that it will + // handle values outside its set gracefully and falls back + // to a default value when unknown. + // + // If this property is not present the client only supports + // the symbol kinds from `File` to `Array` as defined in + // the initial version of the protocol. + ValueSet []SymbolKind `json:"valueSet,omitempty"` +} + +// created for Literal (Lit_WorkspaceSymbolClientCapabilities_symbolKind) +type PSymbolKindPSymbol struct { + // The symbol kind values the client supports. When this + // property exists the client also guarantees that it will + // handle values outside its set gracefully and falls back + // to a default value when unknown. + // + // If this property is not present the client only supports + // the symbol kinds from `File` to `Array` as defined in + // the initial version of the protocol. + ValueSet []SymbolKind `json:"valueSet,omitempty"` +} + +// created for Literal (Lit_DocumentSymbolClientCapabilities_tagSupport) +type PTagSupportPDocumentSymbol struct { + // The tags supported by the client. + ValueSet []SymbolTag `json:"valueSet"` +} + +// created for Literal (Lit_PublishDiagnosticsClientCapabilities_tagSupport) +type PTagSupportPPublishDiagnostics struct { + // The tags supported by the client. + ValueSet []DiagnosticTag `json:"valueSet"` +} + +// created for Literal (Lit_WorkspaceSymbolClientCapabilities_tagSupport) +type PTagSupportPSymbol struct { + // The tags supported by the client. + ValueSet []SymbolTag `json:"valueSet"` +} + +// The parameters of a configuration request. +type ParamConfiguration struct { + Items []ConfigurationItem `json:"items"` +} +type ParamInitialize struct { + XInitializeParams + WorkspaceFoldersInitializeParams +} - /*Label defined: - * The label of this color presentation. It will be shown on the color - * picker header. By default this is also the text that is inserted when selecting - * this color presentation. - */ +// Represents a parameter of a callable-signature. A parameter can +// have a label and a doc-comment. +type ParameterInformation struct { + // The label of this parameter information. + // + // Either a string or an inclusive start and exclusive end offsets within its containing + // signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 + // string representation as `Position` and `Range` does. + // + // *Note*: a label of type string should be a substring of its containing signature label. + // Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. Label string `json:"label"` - - /*TextEdit defined: - * An [edit](#TextEdit) which is applied to a document when selecting - * this presentation for the color. When `falsy` the [label](#ColorPresentation.label) - * is used. - */ - TextEdit *TextEdit `json:"textEdit,omitempty"` - - /*AdditionalTextEdits defined: - * An optional array of additional [text edits](#TextEdit) that are applied when - * selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves. - */ - AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` + // The human-readable doc-comment of this parameter. Will be shown + // in the UI but can be omitted. + Documentation string `json:"documentation,omitempty"` } - -/*DiagnosticRelatedInformation defined: - * Represents a related message and source code location for a diagnostic. This should be - * used to point to code locations that cause or related to a diagnostics, e.g when duplicating - * a symbol in a scope. - */ -type DiagnosticRelatedInformation struct { - - /*Location defined: - * The location of this related diagnostic information. - */ - Location Location `json:"location"` - - /*Message defined: - * The message of this related diagnostic information. - */ - Message string `json:"message"` +type PartialResultParams struct { + // An optional token that a server can use to report partial results (e.g. streaming) to + // the client. + PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"` } -/*Diagnostic defined: - * Represents a diagnostic, such as a compiler error or warning. Diagnostic objects - * are only valid in the scope of a resource. - */ -type Diagnostic struct { - - /*Range defined: - * The range at which the message applies - */ - Range Range `json:"range"` - - /*Severity defined: - * The diagnostic's severity. Can be omitted. If omitted it is up to the - * client to interpret diagnostics as error, warning, info or hint. - */ - Severity DiagnosticSeverity `json:"severity,omitempty"` - - /*Code defined: - * The diagnostic's code, which usually appear in the user interface. - */ - Code interface{} `json:"code,omitempty"` // number | string - - /*Source defined: - * A human-readable string describing the source of this - * diagnostic, e.g. 'typescript' or 'super lint'. It usually - * appears in the user interface. - */ - Source string `json:"source,omitempty"` - - /*Message defined: - * The diagnostic's message. It usually appears in the user interface - */ - Message string `json:"message"` - - /*Tags defined: - * Additional metadata about the diagnostic. - */ - Tags []DiagnosticTag `json:"tags,omitempty"` - - /*RelatedInformation defined: - * An array of related diagnostic information, e.g. when symbol-names within - * a scope collide all definitions can be marked via this property. - */ - RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"` +// The glob pattern to watch relative to the base path. Glob patterns can have the following syntax: +// +// - `*` to match one or more characters in a path segment +// - `?` to match on one character in a path segment +// - `**` to match any number of path segments, including none +// - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) +// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) +// +// @since 3.17.0 +type Pattern = string // (alias) line 14784 +// Position in a text document expressed as zero-based line and character +// offset. Prior to 3.17 the offsets were always based on a UTF-16 string +// representation. So a string of the form `a𐐀b` the character offset of the +// character `a` is 0, the character offset of `𐐀` is 1 and the character +// offset of b is 3 since `𐐀` is represented using two code units in UTF-16. +// Since 3.17 clients and servers can agree on a different string encoding +// representation (e.g. UTF-8). The client announces it's supported encoding +// via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities). +// The value is an array of position encodings the client supports, with +// decreasing preference (e.g. the encoding at index `0` is the most preferred +// one). To stay backwards compatible the only mandatory encoding is UTF-16 +// represented via the string `utf-16`. The server can pick one of the +// encodings offered by the client and signals that encoding back to the +// client via the initialize result's property +// [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value +// `utf-16` is missing from the client's capability `general.positionEncodings` +// servers can safely assume that the client supports UTF-16. If the server +// omits the position encoding in its initialize result the encoding defaults +// to the string value `utf-16`. Implementation considerations: since the +// conversion from one encoding into another requires the content of the +// file / line the conversion is best done where the file is read which is +// usually on the server side. +// +// Positions are line end character agnostic. So you can not specify a position +// that denotes `\r|\n` or `\n|` where `|` represents the character offset. +// +// @since 3.17.0 - support for negotiated position encoding. +type Position struct { + // Line position in a document (zero-based). + // + // If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. + // If a line number is negative, it defaults to 0. + Line uint32 `json:"line"` + // Character offset on a line in a document (zero-based). + // + // The meaning of this offset is determined by the negotiated + // `PositionEncodingKind`. + // + // If the character value is greater than the line length it defaults back to the + // line length. + Character uint32 `json:"character"` +} + +// A set of predefined position encoding kinds. +// +// @since 3.17.0 +type PositionEncodingKind string +type PrepareRename2Gn = Msg_PrepareRename2Gn // (alias) line 13927 +type PrepareRenameParams struct { + TextDocumentPositionParams + WorkDoneProgressParams } +type PrepareRenameResult = Msg_PrepareRename2Gn // (alias) line 13927 +type PrepareSupportDefaultBehavior uint32 -/*Command defined: - * Represents a reference to a command. Provides a title which - * will be used to represent a command in the UI and, optionally, - * an array of arguments which will be passed to the command handler - * function when invoked. - */ -type Command struct { - - /*Title defined: - * Title of the command, like `save`. - */ - Title string `json:"title"` - - /*Command defined: - * The identifier of the actual command handler. - */ - Command string `json:"command"` - - /*Arguments defined: - * Arguments that the command handler should be - * invoked with. - */ - Arguments []interface{} `json:"arguments,omitempty"` +// A previous result id in a workspace pull request. +// +// @since 3.17.0 +type PreviousResultID struct { + // The URI for which the client knowns a + // result id. + URI DocumentURI `json:"uri"` + // The value of the previous result id. + Value string `json:"value"` } -/*TextEdit defined: - * A text edit applicable to a text document. - */ -type TextEdit struct { - - /*Range defined: - * The range of the text document to be manipulated. To insert - * text into a document create a range where start === end. - */ - Range Range `json:"range"` - - /*NewText defined: - * The string to be inserted. For delete operations use an - * empty string. - */ - NewText string `json:"newText"` +// A previous result id in a workspace pull request. +// +// @since 3.17.0 +type PreviousResultId struct { + // The URI for which the client knowns a + // result id. + URI DocumentURI `json:"uri"` + // The value of the previous result id. + Value string `json:"value"` } - -/*TextDocumentEdit defined: - * Describes textual changes on a text document. - */ -type TextDocumentEdit struct { - - /*TextDocument defined: - * The text document to change. - */ - TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` - - /*Edits defined: - * The edits to be applied. - */ - Edits []TextEdit `json:"edits"` +type ProgressParams struct { + // The progress token provided by the client or server. + Token ProgressToken `json:"token"` + // The progress data. + Value interface{} `json:"value"` +} +type ProgressToken = interface{} // (alias) line 14381 +// The publish diagnostic client capabilities. +type PublishDiagnosticsClientCapabilities struct { + // Whether the clients accepts diagnostics with related information. + RelatedInformation bool `json:"relatedInformation,omitempty"` + // Client supports the tag property to provide meta data about a diagnostic. + // Clients supporting tags have to handle unknown tags gracefully. + // + // @since 3.15.0 + TagSupport *PTagSupportPPublishDiagnostics `json:"tagSupport,omitempty"` + // Whether the client interprets the version property of the + // `textDocument/publishDiagnostics` notification's parameter. + // + // @since 3.15.0 + VersionSupport bool `json:"versionSupport,omitempty"` + // Client supports a codeDescription property + // + // @since 3.16.0 + CodeDescriptionSupport bool `json:"codeDescriptionSupport,omitempty"` + // Whether code action supports the `data` property which is + // preserved between a `textDocument/publishDiagnostics` and + // `textDocument/codeAction` request. + // + // @since 3.16.0 + DataSupport bool `json:"dataSupport,omitempty"` +} + +// The publish diagnostic notification's parameters. +type PublishDiagnosticsParams struct { + // The URI for which diagnostic information is reported. + URI DocumentURI `json:"uri"` + // Optional the version number of the document the diagnostics are published for. + // + // @since 3.15.0 + Version int32 `json:"version,omitempty"` + // An array of diagnostic information items. + Diagnostics []Diagnostic `json:"diagnostics"` } -// ResourceOperation is -type ResourceOperation struct { +// A range in a text document expressed as (zero-based) start and end positions. +// +// If you want to specify a range that contains a line including the line ending +// character(s) then use an end position denoting the start of the next line. +// For example: +// ```ts +// +// { +// start: { line: 5, character: 23 } +// end : { line 6, character : 0 } +// } +// +// ``` +type Range struct { + // The range's start position. + Start Position `json:"start"` + // The range's end position. + End Position `json:"end"` +} - // Kind is - Kind string `json:"kind"` +// Client Capabilities for a {@link ReferencesRequest}. +type ReferenceClientCapabilities struct { + // Whether references supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } -/*CreateFileOptions defined: - * Options to create a file. - */ -type CreateFileOptions struct { +// Value-object that contains additional information when +// requesting references. +type ReferenceContext struct { + // Include the declaration of the current symbol. + IncludeDeclaration bool `json:"includeDeclaration"` +} - /*Overwrite defined: - * Overwrite existing file. Overwrite wins over `ignoreIfExists` - */ - Overwrite bool `json:"overwrite,omitempty"` +// Reference options. +type ReferenceOptions struct { + WorkDoneProgressOptions +} - /*IgnoreIfExists defined: - * Ignore if exists. - */ - IgnoreIfExists bool `json:"ignoreIfExists,omitempty"` +// Parameters for a {@link ReferencesRequest}. +type ReferenceParams struct { + Context ReferenceContext `json:"context"` + TextDocumentPositionParams + WorkDoneProgressParams + PartialResultParams } -/*CreateFile defined: - * Create file operation. - */ -type CreateFile struct { +// Registration options for a {@link ReferencesRequest}. +type ReferenceRegistrationOptions struct { + TextDocumentRegistrationOptions + ReferenceOptions +} - /*Kind defined: - * A create - */ - Kind string `json:"kind"` // 'create' - - /*URI defined: - * The resource to create. - */ - URI DocumentURI `json:"uri"` - - /*Options defined: - * Additional options - */ - Options *CreateFileOptions `json:"options,omitempty"` +// General parameters to register for a notification or to register a provider. +type Registration struct { + // The id used to register the request. The id can be used to deregister + // the request again. + ID string `json:"id"` + // The method / capability to register for. + Method string `json:"method"` + // Options necessary for the registration. + RegisterOptions interface{} `json:"registerOptions,omitempty"` } - -/*RenameFileOptions defined: - * Rename file options - */ -type RenameFileOptions struct { - - /*Overwrite defined: - * Overwrite target if existing. Overwrite wins over `ignoreIfExists` - */ - Overwrite bool `json:"overwrite,omitempty"` - - /*IgnoreIfExists defined: - * Ignores if target exists. - */ - IgnoreIfExists bool `json:"ignoreIfExists,omitempty"` +type RegistrationParams struct { + Registrations []Registration `json:"registrations"` } -/*RenameFile defined: - * Rename file operation - */ +// Client capabilities specific to regular expressions. +// +// @since 3.16.0 +type RegularExpressionsClientCapabilities struct { + // The engine's name. + Engine string `json:"engine"` + // The engine's version. + Version string `json:"version,omitempty"` +} + +// A full diagnostic report with a set of related documents. +// +// @since 3.17.0 +type RelatedFullDocumentDiagnosticReport struct { + // Diagnostics of related documents. This information is useful + // in programming languages where code in a file A can generate + // diagnostics in a file B which A depends on. An example of + // such a language is C/C++ where marco definitions in a file + // a.cpp and result in errors in a header file b.hpp. + // + // @since 3.17.0 + RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments,omitempty"` + FullDocumentDiagnosticReport +} + +// An unchanged diagnostic report with a set of related documents. +// +// @since 3.17.0 +type RelatedUnchangedDocumentDiagnosticReport struct { + // Diagnostics of related documents. This information is useful + // in programming languages where code in a file A can generate + // diagnostics in a file B which A depends on. An example of + // such a language is C/C++ where marco definitions in a file + // a.cpp and result in errors in a header file b.hpp. + // + // @since 3.17.0 + RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments,omitempty"` + UnchangedDocumentDiagnosticReport +} + +// A relative pattern is a helper to construct glob patterns that are matched +// relatively to a base URI. The common value for a `baseUri` is a workspace +// folder root, but it can be another absolute URI as well. +// +// @since 3.17.0 +type RelativePattern struct { + // A workspace folder or a base URI to which this pattern will be matched + // against relatively. + BaseURI Or_RelativePattern_baseUri `json:"baseUri"` + // The actual glob pattern; + Pattern Pattern `json:"pattern"` +} +type RenameClientCapabilities struct { + // Whether rename supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Client supports testing for validity of rename operations + // before execution. + // + // @since 3.12.0 + PrepareSupport bool `json:"prepareSupport,omitempty"` + // Client supports the default behavior result. + // + // The value indicates the default behavior used by the + // client. + // + // @since 3.16.0 + PrepareSupportDefaultBehavior *PrepareSupportDefaultBehavior `json:"prepareSupportDefaultBehavior,omitempty"` + // Whether the client honors the change annotations in + // text edits and resource operations returned via the + // rename request's workspace edit by for example presenting + // the workspace edit in the user interface and asking + // for confirmation. + // + // @since 3.16.0 + HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"` +} + +// Rename file operation type RenameFile struct { - - /*Kind defined: - * A rename - */ - Kind string `json:"kind"` // 'rename' - - /*OldURI defined: - * The old (existing) location. - */ + // A rename + Kind string `json:"kind"` + // The old (existing) location. OldURI DocumentURI `json:"oldUri"` - - /*NewURI defined: - * The new location. - */ + // The new location. NewURI DocumentURI `json:"newUri"` - - /*Options defined: - * Rename options. - */ + // Rename options. Options *RenameFileOptions `json:"options,omitempty"` + ResourceOperation } -/*DeleteFileOptions defined: - * Delete file options - */ -type DeleteFileOptions struct { - - /*Recursive defined: - * Delete the content recursively if a folder is denoted. - */ - Recursive bool `json:"recursive,omitempty"` - - /*IgnoreIfNotExists defined: - * Ignore the operation if the file doesn't exist. - */ - IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"` +// Rename file options +type RenameFileOptions struct { + // Overwrite target if existing. Overwrite wins over `ignoreIfExists` + Overwrite bool `json:"overwrite,omitempty"` + // Ignores if target exists. + IgnoreIfExists bool `json:"ignoreIfExists,omitempty"` } -/*DeleteFile defined: - * Delete file operation - */ -type DeleteFile struct { - - /*Kind defined: - * A delete - */ - Kind string `json:"kind"` // 'delete' - - /*URI defined: - * The file to delete. - */ - URI DocumentURI `json:"uri"` - - /*Options defined: - * Delete options. - */ - Options *DeleteFileOptions `json:"options,omitempty"` +// The parameters sent in notifications/requests for user-initiated renames of +// files. +// +// @since 3.16.0 +type RenameFilesParams struct { + // An array of all files/folders renamed in this operation. When a folder is renamed, only + // the folder will be included, and not its children. + Files []FileRename `json:"files"` } -/*WorkspaceEdit defined: - * A workspace edit represents changes to many resources managed in the workspace. The edit - * should either provide `changes` or `documentChanges`. If documentChanges are present - * they are preferred over `changes` if the client can handle versioned document edits. - */ -type WorkspaceEdit struct { - - /*Changes defined: - * Holds changes to existing resources. - */ - Changes *map[string][]TextEdit `json:"changes,omitempty"` // [uri: string]: TextEdit[]; - - /*DocumentChanges defined: - * Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes - * are either an array of `TextDocumentEdit`s to express changes to n different text documents - * where each text document edit addresses a specific version of a text document. Or it can contain - * above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. - * - * Whether a client supports versioned document edits is expressed via - * `workspace.workspaceEdit.documentChanges` client capability. - * - * If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then - * only plain `TextEdit`s using the `changes` property are supported. - */ - DocumentChanges []TextDocumentEdit `json:"documentChanges,omitempty"` // (TextDocumentEdit | CreateFile | RenameFile | DeleteFile) -} - -/*TextEditChange defined: - * A change to capture text edits for existing resources. - */ -type TextEditChange struct { -} - -/*TextDocumentIdentifier defined: - * A literal to identify a text document in the client. - */ -type TextDocumentIdentifier struct { - - /*URI defined: - * The text document's uri. - */ - URI DocumentURI `json:"uri"` +// Provider options for a {@link RenameRequest}. +type RenameOptions struct { + // Renames should be checked and tested before being executed. + // + // @since version 3.12.0 + PrepareProvider bool `json:"prepareProvider,omitempty"` + WorkDoneProgressOptions } -/*VersionedTextDocumentIdentifier defined: - * An identifier to denote a specific version of a text document. - */ -type VersionedTextDocumentIdentifier struct { - - /*Version defined: - * The version number of this document. If a versioned text document identifier - * is sent from the server to the client and the file is not open in the editor - * (the server has not received an open notification before) the server can send - * `null` to indicate that the version is unknown and the content on disk is the - * truth (as speced with document content ownership). - */ - Version float64 `json:"version"` - TextDocumentIdentifier +// The parameters of a {@link RenameRequest}. +type RenameParams struct { + // The document to rename. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The position at which this request was sent. + Position Position `json:"position"` + // The new name of the symbol. If the given name is not valid the + // request must return a {@link ResponseError} with an + // appropriate message set. + NewName string `json:"newName"` + WorkDoneProgressParams } -/*TextDocumentItem defined: - * An item to transfer a text document from the client to the - * server. - */ -type TextDocumentItem struct { - - /*URI defined: - * The text document's uri. - */ - URI DocumentURI `json:"uri"` +// Registration options for a {@link RenameRequest}. +type RenameRegistrationOptions struct { + TextDocumentRegistrationOptions + RenameOptions +} - /*LanguageID defined: - * The text document's language identifier - */ - LanguageID string `json:"languageId"` +// A generic resource operation. +type ResourceOperation struct { + // The resource operation kind. + Kind string `json:"kind"` + // An optional annotation identifier describing the operation. + // + // @since 3.16.0 + AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"` +} +type ResourceOperationKind string - /*Version defined: - * The version number of this document (it will increase after each - * change, including undo/redo). - */ - Version float64 `json:"version"` +// Save options. +type SaveOptions struct { + // The client is supposed to include the content on save. + IncludeText bool `json:"includeText,omitempty"` +} - /*Text defined: - * The content of the opened text document. - */ +// Describes the currently selected completion item. +// +// @since 3.18.0 +// @proposed +type SelectedCompletionInfo struct { + // The range that will be replaced if this completion item is accepted. + Range Range `json:"range"` + // The text the range will be replaced with if this completion is accepted. Text string `json:"text"` } -/*MarkupContent defined: - * A `MarkupContent` literal represents a string value which content is interpreted base on its - * kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. - * - * If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. - * See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting - * - * Here is an example how such a string can be constructed using JavaScript / TypeScript: - * ```ts - * let markdown: MarkdownContent = { - * kind: MarkupKind.Markdown, - * value: [ - * '# Header', - * 'Some text', - * '```typescript', - * 'someCode();', - * '```' - * ].join('\n') - * }; - * ``` - * - * *Please Note* that clients might sanitize the return markdown. A client could decide to - * remove HTML from the markdown to avoid script execution. - */ -type MarkupContent struct { - - /*Kind defined: - * The type of the Markup - */ - Kind MarkupKind `json:"kind"` - - /*Value defined: - * The content itself - */ - Value string `json:"value"` +// A selection range represents a part of a selection hierarchy. A selection range +// may have a parent selection range that contains it. +type SelectionRange struct { + // The {@link Range range} of this selection range. + Range Range `json:"range"` + // The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. + Parent *SelectionRange `json:"parent,omitempty"` +} +type SelectionRangeClientCapabilities struct { + // Whether implementation supports dynamic registration for selection range providers. If this is set to `true` + // the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server + // capability as well. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +} +type SelectionRangeOptions struct { + WorkDoneProgressOptions } -/*CompletionItem defined: - * A completion item represents a text snippet that is - * proposed to complete text that is being typed. - */ -type CompletionItem struct { - - /*Label defined: - * The label of this completion item. By default - * also the text that is inserted when selecting - * this completion. - */ - Label string `json:"label"` - - /*Kind defined: - * The kind of this completion item. Based of the kind - * an icon is chosen by the editor. - */ - Kind CompletionItemKind `json:"kind,omitempty"` - - /*Tags defined: - * Tags for this completion item. - * - * @since 3.15.0 - */ - Tags []CompletionItemTag `json:"tags,omitempty"` +// A parameter literal used in selection range requests. +type SelectionRangeParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The positions inside the text document. + Positions []Position `json:"positions"` + WorkDoneProgressParams + PartialResultParams +} +type SelectionRangeRegistrationOptions struct { + SelectionRangeOptions + TextDocumentRegistrationOptions + StaticRegistrationOptions +} - /*Detail defined: - * A human-readable string with additional information - * about this item, like type or symbol information. - */ - Detail string `json:"detail,omitempty"` +// A set of predefined token modifiers. This set is not fixed +// an clients can specify additional token types via the +// corresponding client capabilities. +// +// @since 3.16.0 +type SemanticTokenModifiers string + +// A set of predefined token types. This set is not fixed +// an clients can specify additional token types via the +// corresponding client capabilities. +// +// @since 3.16.0 +type SemanticTokenTypes string + +// @since 3.16.0 +type SemanticTokens struct { + // An optional result id. If provided and clients support delta updating + // the client will include the result id in the next semantic token request. + // A server can then instead of computing all semantic tokens again simply + // send a delta. + ResultID string `json:"resultId,omitempty"` + // The actual tokens. + Data []uint32 `json:"data"` +} + +// @since 3.16.0 +type SemanticTokensClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is set to `true` + // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + // return value for the corresponding server capability as well. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Which requests the client supports and might send to the server + // depending on the server's capability. Please note that clients might not + // show semantic tokens or degrade some of the user experience if a range + // or full request is advertised by the client but not provided by the + // server. If for example the client capability `requests.full` and + // `request.range` are both set to true but the server only provides a + // range provider the client might not render a minimap correctly or might + // even decide to not show any semantic tokens at all. + Requests PRequestsPSemanticTokens `json:"requests"` + // The token types that the client supports. + TokenTypes []string `json:"tokenTypes"` + // The token modifiers that the client supports. + TokenModifiers []string `json:"tokenModifiers"` + // The token formats the clients supports. + Formats []TokenFormat `json:"formats"` + // Whether the client supports tokens that can overlap each other. + OverlappingTokenSupport bool `json:"overlappingTokenSupport,omitempty"` + // Whether the client supports tokens that can span multiple lines. + MultilineTokenSupport bool `json:"multilineTokenSupport,omitempty"` + // Whether the client allows the server to actively cancel a + // semantic token request, e.g. supports returning + // LSPErrorCodes.ServerCancelled. If a server does the client + // needs to retrigger the request. + // + // @since 3.17.0 + ServerCancelSupport bool `json:"serverCancelSupport,omitempty"` + // Whether the client uses semantic tokens to augment existing + // syntax tokens. If set to `true` client side created syntax + // tokens and semantic tokens are both used for colorization. If + // set to `false` the client only uses the returned semantic tokens + // for colorization. + // + // If the value is `undefined` then the client behavior is not + // specified. + // + // @since 3.17.0 + AugmentsSyntaxTokens bool `json:"augmentsSyntaxTokens,omitempty"` +} + +// @since 3.16.0 +type SemanticTokensDelta struct { + ResultID string `json:"resultId,omitempty"` + // The semantic token edits to transform a previous result into a new result. + Edits []SemanticTokensEdit `json:"edits"` +} + +// @since 3.16.0 +type SemanticTokensDeltaParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The result id of a previous response. The result Id can either point to a full response + // or a delta response depending on what was received last. + PreviousResultID string `json:"previousResultId"` + WorkDoneProgressParams + PartialResultParams +} - /*Documentation defined: - * A human-readable string that represents a doc-comment. - */ - Documentation MarkupContent `json:"documentation,omitempty"` // string | MarkupContent +// @since 3.16.0 +type SemanticTokensDeltaPartialResult struct { + Edits []SemanticTokensEdit `json:"edits"` +} - /*Deprecated defined: - * Indicates if this item is deprecated. - * @deprecated Use `tags` instead. - */ - Deprecated bool `json:"deprecated,omitempty"` +// @since 3.16.0 +type SemanticTokensEdit struct { + // The start offset of the edit. + Start uint32 `json:"start"` + // The count of elements to remove. + DeleteCount uint32 `json:"deleteCount"` + // The elements to insert. + Data []uint32 `json:"data,omitempty"` +} - /*Preselect defined: - * Select this item when showing. - * - * *Note* that only one completion item can be selected and that the - * tool / client decides which item that is. The rule is that the *first* - * item of those that match best is selected. - */ - Preselect bool `json:"preselect,omitempty"` +// @since 3.16.0 +type SemanticTokensLegend struct { + // The token types a server uses. + TokenTypes []string `json:"tokenTypes"` + // The token modifiers a server uses. + TokenModifiers []string `json:"tokenModifiers"` +} - /*SortText defined: - * A string that should be used when comparing this item - * with other items. When `falsy` the [label](#CompletionItem.label) - * is used. - */ - SortText string `json:"sortText,omitempty"` +// @since 3.16.0 +type SemanticTokensOptions struct { + // The legend used by the server + Legend SemanticTokensLegend `json:"legend"` + // Server supports providing semantic tokens for a specific range + // of a document. + Range *Or_SemanticTokensOptions_range `json:"range,omitempty"` + // Server supports providing semantic tokens for a full document. + Full *Or_SemanticTokensOptions_full `json:"full,omitempty"` + WorkDoneProgressOptions +} - /*FilterText defined: - * A string that should be used when filtering a set of - * completion items. When `falsy` the [label](#CompletionItem.label) - * is used. - */ - FilterText string `json:"filterText,omitempty"` +// @since 3.16.0 +type SemanticTokensParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + WorkDoneProgressParams + PartialResultParams +} - /*InsertText defined: - * A string that should be inserted into a document when selecting - * this completion. When `falsy` the [label](#CompletionItem.label) - * is used. - * - * The `insertText` is subject to interpretation by the client side. - * Some tools might not take the string literally. For example - * VS Code when code complete is requested in this example `con` - * and a completion item with an `insertText` of `console` is provided it - * will only insert `sole`. Therefore it is recommended to use `textEdit` instead - * since it avoids additional client side interpretation. - */ - InsertText string `json:"insertText,omitempty"` +// @since 3.16.0 +type SemanticTokensPartialResult struct { + Data []uint32 `json:"data"` +} - /*InsertTextFormat defined: - * The format of the insert text. The format applies to both the `insertText` property - * and the `newText` property of a provided `textEdit`. - */ - InsertTextFormat InsertTextFormat `json:"insertTextFormat,omitempty"` - - /*TextEdit defined: - * An [edit](#TextEdit) which is applied to a document when selecting - * this completion. When an edit is provided the value of - * [insertText](#CompletionItem.insertText) is ignored. - * - * *Note:* The text edit's range must be a [single line] and it must contain the position - * at which completion has been requested. - */ - TextEdit *TextEdit `json:"textEdit,omitempty"` +// @since 3.16.0 +type SemanticTokensRangeParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The range the semantic tokens are requested for. + Range Range `json:"range"` + WorkDoneProgressParams + PartialResultParams +} - /*AdditionalTextEdits defined: - * An optional array of additional [text edits](#TextEdit) that are applied when - * selecting this completion. Edits must not overlap (including the same insert position) - * with the main [edit](#CompletionItem.textEdit) nor with themselves. - * - * Additional text edits should be used to change text unrelated to the current cursor position - * (for example adding an import statement at the top of the file if the completion item will - * insert an unqualified type). - */ - AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` +// @since 3.16.0 +type SemanticTokensRegistrationOptions struct { + TextDocumentRegistrationOptions + SemanticTokensOptions + StaticRegistrationOptions +} - /*CommitCharacters defined: - * An optional set of characters that when pressed while this completion is active will accept it first and - * then type that character. *Note* that all commit characters should have `length=1` and that superfluous - * characters will be ignored. - */ - CommitCharacters []string `json:"commitCharacters,omitempty"` +// @since 3.16.0 +type SemanticTokensWorkspaceClientCapabilities struct { + // Whether the client implementation supports a refresh request sent from + // the server to the client. + // + // Note that this event is global and will force the client to refresh all + // semantic tokens currently shown. It should be used with absolute care + // and is useful for situation where a server for example detects a project + // wide change that requires such a calculation. + RefreshSupport bool `json:"refreshSupport,omitempty"` +} - /*Command defined: - * An optional [command](#Command) that is executed *after* inserting this completion. *Note* that - * additional modifications to the current document should be described with the - * [additionalTextEdits](#CompletionItem.additionalTextEdits)-property. - */ - Command *Command `json:"command,omitempty"` +// Defines the capabilities provided by a language +// server. +type ServerCapabilities struct { + // The position encoding the server picked from the encodings offered + // by the client via the client capability `general.positionEncodings`. + // + // If the client didn't provide any position encodings the only valid + // value that a server can return is 'utf-16'. + // + // If omitted it defaults to 'utf-16'. + // + // @since 3.17.0 + PositionEncoding *PositionEncodingKind `json:"positionEncoding,omitempty"` + // Defines how text documents are synced. Is either a detailed structure + // defining each notification or for backwards compatibility the + // TextDocumentSyncKind number. + TextDocumentSync interface{} `json:"textDocumentSync,omitempty"` + // Defines how notebook documents are synced. + // + // @since 3.17.0 + NotebookDocumentSync *Or_ServerCapabilities_notebookDocumentSync `json:"notebookDocumentSync,omitempty"` + // The server provides completion support. + CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"` + // The server provides hover support. + HoverProvider *Or_ServerCapabilities_hoverProvider `json:"hoverProvider,omitempty"` + // The server provides signature help support. + SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"` + // The server provides Goto Declaration support. + DeclarationProvider *Or_ServerCapabilities_declarationProvider `json:"declarationProvider,omitempty"` + // The server provides goto definition support. + DefinitionProvider *Or_ServerCapabilities_definitionProvider `json:"definitionProvider,omitempty"` + // The server provides Goto Type Definition support. + TypeDefinitionProvider *Or_ServerCapabilities_typeDefinitionProvider `json:"typeDefinitionProvider,omitempty"` + // The server provides Goto Implementation support. + ImplementationProvider *Or_ServerCapabilities_implementationProvider `json:"implementationProvider,omitempty"` + // The server provides find references support. + ReferencesProvider *Or_ServerCapabilities_referencesProvider `json:"referencesProvider,omitempty"` + // The server provides document highlight support. + DocumentHighlightProvider *Or_ServerCapabilities_documentHighlightProvider `json:"documentHighlightProvider,omitempty"` + // The server provides document symbol support. + DocumentSymbolProvider *Or_ServerCapabilities_documentSymbolProvider `json:"documentSymbolProvider,omitempty"` + // The server provides code actions. CodeActionOptions may only be + // specified if the client states that it supports + // `codeActionLiteralSupport` in its initial `initialize` request. + CodeActionProvider interface{} `json:"codeActionProvider,omitempty"` + // The server provides code lens. + CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"` + // The server provides document link support. + DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitempty"` + // The server provides color provider support. + ColorProvider *Or_ServerCapabilities_colorProvider `json:"colorProvider,omitempty"` + // The server provides workspace symbol support. + WorkspaceSymbolProvider *Or_ServerCapabilities_workspaceSymbolProvider `json:"workspaceSymbolProvider,omitempty"` + // The server provides document formatting. + DocumentFormattingProvider *Or_ServerCapabilities_documentFormattingProvider `json:"documentFormattingProvider,omitempty"` + // The server provides document range formatting. + DocumentRangeFormattingProvider *Or_ServerCapabilities_documentRangeFormattingProvider `json:"documentRangeFormattingProvider,omitempty"` + // The server provides document formatting on typing. + DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"` + // The server provides rename support. RenameOptions may only be + // specified if the client states that it supports + // `prepareSupport` in its initial `initialize` request. + RenameProvider interface{} `json:"renameProvider,omitempty"` + // The server provides folding provider support. + FoldingRangeProvider *Or_ServerCapabilities_foldingRangeProvider `json:"foldingRangeProvider,omitempty"` + // The server provides selection range support. + SelectionRangeProvider *Or_ServerCapabilities_selectionRangeProvider `json:"selectionRangeProvider,omitempty"` + // The server provides execute command support. + ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"` + // The server provides call hierarchy support. + // + // @since 3.16.0 + CallHierarchyProvider *Or_ServerCapabilities_callHierarchyProvider `json:"callHierarchyProvider,omitempty"` + // The server provides linked editing range support. + // + // @since 3.16.0 + LinkedEditingRangeProvider *Or_ServerCapabilities_linkedEditingRangeProvider `json:"linkedEditingRangeProvider,omitempty"` + // The server provides semantic tokens support. + // + // @since 3.16.0 + SemanticTokensProvider interface{} `json:"semanticTokensProvider,omitempty"` + // The server provides moniker support. + // + // @since 3.16.0 + MonikerProvider *Or_ServerCapabilities_monikerProvider `json:"monikerProvider,omitempty"` + // The server provides type hierarchy support. + // + // @since 3.17.0 + TypeHierarchyProvider *Or_ServerCapabilities_typeHierarchyProvider `json:"typeHierarchyProvider,omitempty"` + // The server provides inline values. + // + // @since 3.17.0 + InlineValueProvider *Or_ServerCapabilities_inlineValueProvider `json:"inlineValueProvider,omitempty"` + // The server provides inlay hints. + // + // @since 3.17.0 + InlayHintProvider interface{} `json:"inlayHintProvider,omitempty"` + // The server has support for pull model diagnostics. + // + // @since 3.17.0 + DiagnosticProvider *Or_ServerCapabilities_diagnosticProvider `json:"diagnosticProvider,omitempty"` + // Inline completion options used during static registration. + // + // @since 3.18.0 + // @proposed + InlineCompletionProvider *Or_ServerCapabilities_inlineCompletionProvider `json:"inlineCompletionProvider,omitempty"` + // Workspace specific server capabilities. + Workspace *Workspace6Gn `json:"workspace,omitempty"` + // Experimental server capabilities. + Experimental interface{} `json:"experimental,omitempty"` +} +type SetTraceParams struct { + Value TraceValues `json:"value"` +} - /*Data defined: - * An data entry field that is preserved on a completion item between - * a [CompletionRequest](#CompletionRequest) and a [CompletionResolveRequest] - * (#CompletionResolveRequest) - */ - Data interface{} `json:"data,omitempty"` +// Client capabilities for the showDocument request. +// +// @since 3.16.0 +type ShowDocumentClientCapabilities struct { + // The client has support for the showDocument + // request. + Support bool `json:"support"` +} + +// Params to show a resource in the UI. +// +// @since 3.16.0 +type ShowDocumentParams struct { + // The uri to show. + URI URI `json:"uri"` + // Indicates to show the resource in an external program. + // To show, for example, `https://code.visualstudio.com/` + // in the default WEB browser set `external` to `true`. + External bool `json:"external,omitempty"` + // An optional property to indicate whether the editor + // showing the document should take focus or not. + // Clients might ignore this property if an external + // program is started. + TakeFocus bool `json:"takeFocus,omitempty"` + // An optional selection range if the document is a text + // document. Clients might ignore the property if an + // external program is started or the file is not a text + // file. + Selection *Range `json:"selection,omitempty"` +} + +// The result of a showDocument request. +// +// @since 3.16.0 +type ShowDocumentResult struct { + // A boolean indicating if the show was successful. + Success bool `json:"success"` +} + +// The parameters of a notification message. +type ShowMessageParams struct { + // The message type. See {@link MessageType} + Type MessageType `json:"type"` + // The actual message. + Message string `json:"message"` } -/*CompletionList defined: - * Represents a collection of [completion items](#CompletionItem) to be presented - * in the editor. - */ -type CompletionList struct { +// Show message request client capabilities +type ShowMessageRequestClientCapabilities struct { + // Capabilities specific to the `MessageActionItem` type. + MessageActionItem *PMessageActionItemPShowMessage `json:"messageActionItem,omitempty"` +} +type ShowMessageRequestParams struct { + // The message type. See {@link MessageType} + Type MessageType `json:"type"` + // The actual message. + Message string `json:"message"` + // The message action items to present. + Actions []MessageActionItem `json:"actions,omitempty"` +} - /*IsIncomplete defined: - * This list it not complete. Further typing results in recomputing this list. - */ - IsIncomplete bool `json:"isIncomplete"` +// Signature help represents the signature of something +// callable. There can be multiple signature but only one +// active and only one active parameter. +type SignatureHelp struct { + // One or more signatures. + Signatures []SignatureInformation `json:"signatures"` + // The active signature. If omitted or the value lies outside the + // range of `signatures` the value defaults to zero or is ignored if + // the `SignatureHelp` has no signatures. + // + // Whenever possible implementors should make an active decision about + // the active signature and shouldn't rely on a default value. + // + // In future version of the protocol this property might become + // mandatory to better express this. + ActiveSignature uint32 `json:"activeSignature,omitempty"` + // The active parameter of the active signature. If omitted or the value + // lies outside the range of `signatures[activeSignature].parameters` + // defaults to 0 if the active signature has parameters. If + // the active signature has no parameters it is ignored. + // In future version of the protocol this property might become + // mandatory to better express the active parameter if the + // active signature does have any. + ActiveParameter uint32 `json:"activeParameter,omitempty"` +} + +// Client Capabilities for a {@link SignatureHelpRequest}. +type SignatureHelpClientCapabilities struct { + // Whether signature help supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // The client supports the following `SignatureInformation` + // specific properties. + SignatureInformation *PSignatureInformationPSignatureHelp `json:"signatureInformation,omitempty"` + // The client supports to send additional context information for a + // `textDocument/signatureHelp` request. A client that opts into + // contextSupport will also support the `retriggerCharacters` on + // `SignatureHelpOptions`. + // + // @since 3.15.0 + ContextSupport bool `json:"contextSupport,omitempty"` +} - /*Items defined: - * The completion items. - */ - Items []CompletionItem `json:"items"` +// Additional information about the context in which a signature help request was triggered. +// +// @since 3.15.0 +type SignatureHelpContext struct { + // Action that caused signature help to be triggered. + TriggerKind SignatureHelpTriggerKind `json:"triggerKind"` + // Character that caused signature help to be triggered. + // + // This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` + TriggerCharacter string `json:"triggerCharacter,omitempty"` + // `true` if signature help was already showing when it was triggered. + // + // Retriggers occurs when the signature help is already active and can be caused by actions such as + // typing a trigger character, a cursor move, or document content changes. + IsRetrigger bool `json:"isRetrigger"` + // The currently active `SignatureHelp`. + // + // The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on + // the user navigating through available signatures. + ActiveSignatureHelp *SignatureHelp `json:"activeSignatureHelp,omitempty"` } -/*Hover defined: - * The result of a hover request. - */ -type Hover struct { +// Server Capabilities for a {@link SignatureHelpRequest}. +type SignatureHelpOptions struct { + // List of characters that trigger signature help automatically. + TriggerCharacters []string `json:"triggerCharacters,omitempty"` + // List of characters that re-trigger signature help. + // + // These trigger characters are only active when signature help is already showing. All trigger characters + // are also counted as re-trigger characters. + // + // @since 3.15.0 + RetriggerCharacters []string `json:"retriggerCharacters,omitempty"` + WorkDoneProgressOptions +} - /*Contents defined: - * The hover's content - */ - Contents MarkupContent `json:"contents"` // MarkupContent | MarkedString | MarkedString[] +// Parameters for a {@link SignatureHelpRequest}. +type SignatureHelpParams struct { + // The signature help context. This is only available if the client specifies + // to send this using the client capability `textDocument.signatureHelp.contextSupport === true` + // + // @since 3.15.0 + Context *SignatureHelpContext `json:"context,omitempty"` + TextDocumentPositionParams + WorkDoneProgressParams +} - /*Range defined: - * An optional range - */ - Range *Range `json:"range,omitempty"` +// Registration options for a {@link SignatureHelpRequest}. +type SignatureHelpRegistrationOptions struct { + TextDocumentRegistrationOptions + SignatureHelpOptions } -/*ParameterInformation defined: - * Represents a parameter of a callable-signature. A parameter can - * have a label and a doc-comment. - */ -type ParameterInformation struct { +// How a signature help was triggered. +// +// @since 3.15.0 +type SignatureHelpTriggerKind uint32 - /*Label defined: - * The label of this parameter information. - * - * Either a string or an inclusive start and exclusive end offsets within its containing - * signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 - * string representation as `Position` and `Range` does. - * - * *Note*: a label of type string should be a substring of its containing signature label. - * Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. - */ - Label string `json:"label"` // string | [number, number] - - /*Documentation defined: - * The human-readable doc-comment of this signature. Will be shown - * in the UI but can be omitted. - */ - Documentation string `json:"documentation,omitempty"` // string | MarkupContent -} - -/*SignatureInformation defined: - * Represents the signature of something callable. A signature - * can have a label, like a function-name, a doc-comment, and - * a set of parameters. - */ +// Represents the signature of something callable. A signature +// can have a label, like a function-name, a doc-comment, and +// a set of parameters. type SignatureInformation struct { - - /*Label defined: - * The label of this signature. Will be shown in - * the UI. - */ + // The label of this signature. Will be shown in + // the UI. Label string `json:"label"` - - /*Documentation defined: - * The human-readable doc-comment of this signature. Will be shown - * in the UI but can be omitted. - */ - Documentation string `json:"documentation,omitempty"` // string | MarkupContent - - /*Parameters defined: - * The parameters of this signature. - */ + // The human-readable doc-comment of this signature. Will be shown + // in the UI but can be omitted. + Documentation *Or_SignatureInformation_documentation `json:"documentation,omitempty"` + // The parameters of this signature. Parameters []ParameterInformation `json:"parameters,omitempty"` + // The index of the active parameter. + // + // If provided, this is used in place of `SignatureHelp.activeParameter`. + // + // @since 3.16.0 + ActiveParameter uint32 `json:"activeParameter,omitempty"` } -/*SignatureHelp defined: - * Signature help represents the signature of something - * callable. There can be multiple signature but only one - * active and only one active parameter. - */ -type SignatureHelp struct { - - /*Signatures defined: - * One or more signatures. - */ - Signatures []SignatureInformation `json:"signatures"` - - /*ActiveSignature defined: - * The active signature. Set to `null` if no - * signatures exist. - */ - ActiveSignature float64 `json:"activeSignature"` - - /*ActiveParameter defined: - * The active parameter of the active signature. Set to `null` - * if the active signature has no parameters. - */ - ActiveParameter float64 `json:"activeParameter"` -} - -/*ReferenceContext defined: - * Value-object that contains additional information when - * requesting references. - */ -type ReferenceContext struct { - - /*IncludeDeclaration defined: - * Include the declaration of the current symbol. - */ - IncludeDeclaration bool `json:"includeDeclaration"` +// Static registration options to be returned in the initialize +// request. +type StaticRegistrationOptions struct { + // The id used to register the request. The id can be used to deregister + // the request again. See also Registration#id. + ID string `json:"id,omitempty"` } -/*DocumentHighlight defined: - * A document highlight is a range inside a text document which deserves - * special attention. Usually a document highlight is visualized by changing - * the background color of its range. - */ -type DocumentHighlight struct { - - /*Range defined: - * The range this highlight applies to. - */ - Range Range `json:"range"` - - /*Kind defined: - * The highlight kind, default is [text](#DocumentHighlightKind.Text). - */ - Kind *DocumentHighlightKind `json:"kind,omitempty"` +// A string value used as a snippet is a template which allows to insert text +// and to control the editor cursor when insertion happens. +// +// A snippet can define tab stops and placeholders with `$1`, `$2` +// and `${3:foo}`. `$0` defines the final tab stop, it defaults to +// the end of the snippet. Variables are defined with `$name` and +// `${name:default value}`. +// +// @since 3.18.0 +// @proposed +type StringValue struct { + // The kind of string value. + Kind string `json:"kind"` + // The snippet string. + Value string `json:"value"` } -/*SymbolInformation defined: - * Represents information about programming constructs like variables, classes, - * interfaces etc. - */ +// Represents information about programming constructs like variables, classes, +// interfaces etc. type SymbolInformation struct { - - /*Name defined: - * The name of this symbol. - */ - Name string `json:"name"` - - /*Kind defined: - * The kind of this symbol. - */ - Kind SymbolKind `json:"kind"` - - /*Deprecated defined: - * Indicates if this symbol is deprecated. - */ + // extends BaseSymbolInformation + // Indicates if this symbol is deprecated. + // + // @deprecated Use tags instead Deprecated bool `json:"deprecated,omitempty"` - - /*Location defined: - * The location of this symbol. The location's range is used by a tool - * to reveal the location in the editor. If the symbol is selected in the - * tool the range's start information is used to position the cursor. So - * the range usually spans more than the actual symbol's name and does - * normally include thinks like visibility modifiers. - * - * The range doesn't have to denote a node range in the sense of a abstract - * syntax tree. It can therefore not be used to re-construct a hierarchy of - * the symbols. - */ + // The location of this symbol. The location's range is used by a tool + // to reveal the location in the editor. If the symbol is selected in the + // tool the range's start information is used to position the cursor. So + // the range usually spans more than the actual symbol's name and does + // normally include things like visibility modifiers. + // + // The range doesn't have to denote a node range in the sense of an abstract + // syntax tree. It can therefore not be used to re-construct a hierarchy of + // the symbols. Location Location `json:"location"` - - /*ContainerName defined: - * The name of the symbol containing this symbol. This information is for - * user interface purposes (e.g. to render a qualifier in the user interface - * if necessary). It can't be used to re-infer a hierarchy for the document - * symbols. - */ - ContainerName string `json:"containerName,omitempty"` -} - -/*DocumentSymbol defined: - * Represents programming constructs like variables, classes, interfaces etc. - * that appear in a document. Document symbols can be hierarchical and they - * have two ranges: one that encloses its definition and one that points to - * its most interesting range, e.g. the range of an identifier. - */ -type DocumentSymbol struct { - - /*Name defined: - * The name of this symbol. Will be displayed in the user interface and therefore must not be - * an empty string or a string only consisting of white spaces. - */ + // The name of this symbol. Name string `json:"name"` - - /*Detail defined: - * More detail for this symbol, e.g the signature of a function. - */ - Detail string `json:"detail,omitempty"` - - /*Kind defined: - * The kind of this symbol. - */ + // The kind of this symbol. Kind SymbolKind `json:"kind"` - - /*Deprecated defined: - * Indicates if this symbol is deprecated. - */ - Deprecated bool `json:"deprecated,omitempty"` - - /*Range defined: - * The range enclosing this symbol not including leading/trailing whitespace but everything else - * like comments. This information is typically used to determine if the the clients cursor is - * inside the symbol to reveal in the symbol in the UI. - */ - Range Range `json:"range"` - - /*SelectionRange defined: - * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. - * Must be contained by the the `range`. - */ - SelectionRange Range `json:"selectionRange"` - - /*Children defined: - * Children of this symbol, e.g. properties of a class. - */ - Children []DocumentSymbol `json:"children,omitempty"` -} - -/*CodeActionContext defined: - * Contains additional diagnostic information about the context in which - * a [code action](#CodeActionProvider.provideCodeActions) is run. - */ -type CodeActionContext struct { - - /*Diagnostics defined: - * An array of diagnostics known on the client side overlapping the range provided to the - * `textDocument/codeAction` request. They are provied so that the server knows which - * errors are currently presented to the user for the given range. There is no guarantee - * that these accurately reflect the error state of the resource. The primary parameter - * to compute code actions is the provided range. - */ - Diagnostics []Diagnostic `json:"diagnostics"` - - /*Only defined: - * Requested kind of actions to return. - * - * Actions not of this kind are filtered out by the client before being shown. So servers - * can omit computing them. - */ - Only []CodeActionKind `json:"only,omitempty"` + // Tags for this symbol. + // + // @since 3.16.0 + Tags []SymbolTag `json:"tags,omitempty"` + // The name of the symbol containing this symbol. This information is for + // user interface purposes (e.g. to render a qualifier in the user interface + // if necessary). It can't be used to re-infer a hierarchy for the document + // symbols. + ContainerName string `json:"containerName,omitempty"` } -/*CodeAction defined: - * A code action represents a change that can be performed in code, e.g. to fix a problem or - * to refactor code. - * - * A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. - */ -type CodeAction struct { - - /*Title defined: - * A short, human-readable, title for this code action. - */ - Title string `json:"title"` - - /*Kind defined: - * The kind of the code action. - * - * Used to filter code actions. - */ - Kind CodeActionKind `json:"kind,omitempty"` - - /*Diagnostics defined: - * The diagnostics that this code action resolves. - */ - Diagnostics []Diagnostic `json:"diagnostics,omitempty"` - - /*IsPreferred defined: - * Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted - * by keybindings. - * - * A quick fix should be marked preferred if it properly addresses the underlying error. - * A refactoring should be marked preferred if it is the most reasonable choice of actions to take. - * - * @since 3.15.0 - */ - IsPreferred bool `json:"isPreferred,omitempty"` +// A symbol kind. +type SymbolKind uint32 - /*Edit defined: - * The workspace edit this code action performs. - */ - Edit *WorkspaceEdit `json:"edit,omitempty"` +// Symbol tags are extra annotations that tweak the rendering of a symbol. +// +// @since 3.16 +type SymbolTag uint32 - /*Command defined: - * A command this code action executes. If a code action - * provides a edit and a command, first the edit is - * executed and then the command. - */ - Command *Command `json:"command,omitempty"` +// Describe options to be used when registered for text document change events. +type TextDocumentChangeRegistrationOptions struct { + // How documents are synced to the server. + SyncKind TextDocumentSyncKind `json:"syncKind"` + TextDocumentRegistrationOptions } -/*CodeLens defined: - * A code lens represents a [command](#Command) that should be shown along with - * source text, like the number of references, a way to run tests, etc. - * - * A code lens is _unresolved_ when no command is associated to it. For performance - * reasons the creation of a code lens and resolving should be done to two stages. - */ -type CodeLens struct { - - /*Range defined: - * The range in which this code lens is valid. Should only span a single line. - */ - Range Range `json:"range"` - - /*Command defined: - * The command this code lens represents. - */ - Command *Command `json:"command,omitempty"` - - /*Data defined: - * An data entry field that is preserved on a code lens item between - * a [CodeLensRequest](#CodeLensRequest) and a [CodeLensResolveRequest] - * (#CodeLensResolveRequest) - */ - Data interface{} `json:"data,omitempty"` +// Text document specific client capabilities. +type TextDocumentClientCapabilities struct { + // Defines which synchronization capabilities the client supports. + Synchronization *TextDocumentSyncClientCapabilities `json:"synchronization,omitempty"` + // Capabilities specific to the `textDocument/completion` request. + Completion *CompletionClientCapabilities `json:"completion,omitempty"` + // Capabilities specific to the `textDocument/hover` request. + Hover *HoverClientCapabilities `json:"hover,omitempty"` + // Capabilities specific to the `textDocument/signatureHelp` request. + SignatureHelp *SignatureHelpClientCapabilities `json:"signatureHelp,omitempty"` + // Capabilities specific to the `textDocument/declaration` request. + // + // @since 3.14.0 + Declaration *DeclarationClientCapabilities `json:"declaration,omitempty"` + // Capabilities specific to the `textDocument/definition` request. + Definition *DefinitionClientCapabilities `json:"definition,omitempty"` + // Capabilities specific to the `textDocument/typeDefinition` request. + // + // @since 3.6.0 + TypeDefinition *TypeDefinitionClientCapabilities `json:"typeDefinition,omitempty"` + // Capabilities specific to the `textDocument/implementation` request. + // + // @since 3.6.0 + Implementation *ImplementationClientCapabilities `json:"implementation,omitempty"` + // Capabilities specific to the `textDocument/references` request. + References *ReferenceClientCapabilities `json:"references,omitempty"` + // Capabilities specific to the `textDocument/documentHighlight` request. + DocumentHighlight *DocumentHighlightClientCapabilities `json:"documentHighlight,omitempty"` + // Capabilities specific to the `textDocument/documentSymbol` request. + DocumentSymbol *DocumentSymbolClientCapabilities `json:"documentSymbol,omitempty"` + // Capabilities specific to the `textDocument/codeAction` request. + CodeAction *CodeActionClientCapabilities `json:"codeAction,omitempty"` + // Capabilities specific to the `textDocument/codeLens` request. + CodeLens *CodeLensClientCapabilities `json:"codeLens,omitempty"` + // Capabilities specific to the `textDocument/documentLink` request. + DocumentLink *DocumentLinkClientCapabilities `json:"documentLink,omitempty"` + // Capabilities specific to the `textDocument/documentColor` and the + // `textDocument/colorPresentation` request. + // + // @since 3.6.0 + ColorProvider *DocumentColorClientCapabilities `json:"colorProvider,omitempty"` + // Capabilities specific to the `textDocument/formatting` request. + Formatting *DocumentFormattingClientCapabilities `json:"formatting,omitempty"` + // Capabilities specific to the `textDocument/rangeFormatting` request. + RangeFormatting *DocumentRangeFormattingClientCapabilities `json:"rangeFormatting,omitempty"` + // Capabilities specific to the `textDocument/onTypeFormatting` request. + OnTypeFormatting *DocumentOnTypeFormattingClientCapabilities `json:"onTypeFormatting,omitempty"` + // Capabilities specific to the `textDocument/rename` request. + Rename *RenameClientCapabilities `json:"rename,omitempty"` + // Capabilities specific to the `textDocument/foldingRange` request. + // + // @since 3.10.0 + FoldingRange *FoldingRangeClientCapabilities `json:"foldingRange,omitempty"` + // Capabilities specific to the `textDocument/selectionRange` request. + // + // @since 3.15.0 + SelectionRange *SelectionRangeClientCapabilities `json:"selectionRange,omitempty"` + // Capabilities specific to the `textDocument/publishDiagnostics` notification. + PublishDiagnostics *PublishDiagnosticsClientCapabilities `json:"publishDiagnostics,omitempty"` + // Capabilities specific to the various call hierarchy requests. + // + // @since 3.16.0 + CallHierarchy *CallHierarchyClientCapabilities `json:"callHierarchy,omitempty"` + // Capabilities specific to the various semantic token request. + // + // @since 3.16.0 + SemanticTokens *SemanticTokensClientCapabilities `json:"semanticTokens,omitempty"` + // Capabilities specific to the `textDocument/linkedEditingRange` request. + // + // @since 3.16.0 + LinkedEditingRange *LinkedEditingRangeClientCapabilities `json:"linkedEditingRange,omitempty"` + // Client capabilities specific to the `textDocument/moniker` request. + // + // @since 3.16.0 + Moniker *MonikerClientCapabilities `json:"moniker,omitempty"` + // Capabilities specific to the various type hierarchy requests. + // + // @since 3.17.0 + TypeHierarchy *TypeHierarchyClientCapabilities `json:"typeHierarchy,omitempty"` + // Capabilities specific to the `textDocument/inlineValue` request. + // + // @since 3.17.0 + InlineValue *InlineValueClientCapabilities `json:"inlineValue,omitempty"` + // Capabilities specific to the `textDocument/inlayHint` request. + // + // @since 3.17.0 + InlayHint *InlayHintClientCapabilities `json:"inlayHint,omitempty"` + // Capabilities specific to the diagnostic pull model. + // + // @since 3.17.0 + Diagnostic *DiagnosticClientCapabilities `json:"diagnostic,omitempty"` + // Client capabilities specific to inline completions. + // + // @since 3.18.0 + // @proposed + InlineCompletion *InlineCompletionClientCapabilities `json:"inlineCompletion,omitempty"` +} + +// An event describing a change to a text document. If only a text is provided +// it is considered to be the full content of the document. +type TextDocumentContentChangeEvent = Msg_TextDocumentContentChangeEvent // (alias) line 14423 +// Describes textual changes on a text document. A TextDocumentEdit describes all changes +// on a document version Si and after they are applied move the document to version Si+1. +// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any +// kind of ordering. However the edits must be non overlapping. +type TextDocumentEdit struct { + // The text document to change. + TextDocument OptionalVersionedTextDocumentIdentifier `json:"textDocument"` + // The edits to be applied. + // + // @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a + // client capability. + Edits []TextEdit `json:"edits"` } -/*FormattingOptions defined: - * Value-object describing what options formatting should use. - */ -type FormattingOptions struct { - - /*TabSize defined: - * Size of a tab in spaces. - */ - TabSize float64 `json:"tabSize"` - - /*InsertSpaces defined: - * Prefer spaces over tabs. - */ - InsertSpaces bool `json:"insertSpaces"` - - /*TrimTrailingWhitespace defined: - * Trim trailing whitespaces on a line. - * - * @since 3.15.0 - */ - TrimTrailingWhitespace bool `json:"trimTrailingWhitespace,omitempty"` - - /*InsertFinalNewline defined: - * Insert a newline character at the end of the file if one does not exist. - * - * @since 3.15.0 - */ - InsertFinalNewline bool `json:"insertFinalNewline,omitempty"` +// A document filter denotes a document by different properties like +// the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of +// its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}. +// +// Glob patterns can have the following syntax: +// +// - `*` to match one or more characters in a path segment +// - `?` to match on one character in a path segment +// - `**` to match any number of path segments, including none +// - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) +// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) +// +// @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }` +// @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }` +// +// @since 3.17.0 +type TextDocumentFilter = Msg_TextDocumentFilter // (alias) line 14566 +// A literal to identify a text document in the client. +type TextDocumentIdentifier struct { + // The text document's uri. + URI DocumentURI `json:"uri"` +} - /*TrimFinalNewlines defined: - * Trim all newlines after the final newline at the end of the file. - * - * @since 3.15.0 - */ - TrimFinalNewlines bool `json:"trimFinalNewlines,omitempty"` +// An item to transfer a text document from the client to the +// server. +type TextDocumentItem struct { + // The text document's uri. + URI DocumentURI `json:"uri"` + // The text document's language identifier. + LanguageID string `json:"languageId"` + // The version number of this document (it will increase after each + // change, including undo/redo). + Version int32 `json:"version"` + // The content of the opened text document. + Text string `json:"text"` } -/*DocumentLink defined: - * A document link is a range in a text document that links to an internal or external resource, like another - * text document or a web site. - */ -type DocumentLink struct { +// A parameter literal used in requests to pass a text document and a position inside that +// document. +type TextDocumentPositionParams struct { + // The text document. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The position inside the text document. + Position Position `json:"position"` +} - /*Range defined: - * The range this link applies to. - */ - Range Range `json:"range"` +// General text document registration options. +type TextDocumentRegistrationOptions struct { + // A document selector to identify the scope of the registration. If set to null + // the document selector provided on the client side will be used. + DocumentSelector DocumentSelector `json:"documentSelector"` +} - /*Target defined: - * The uri this link points to. - */ - Target string `json:"target,omitempty"` - - /*Tooltip defined: - * The tooltip text when you hover over this link. - * - * If a tooltip is provided, is will be displayed in a string that includes instructions on how to - * trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, - * user settings, and localization. - * - * @since 3.15.0 - */ - Tooltip string `json:"tooltip,omitempty"` +// Represents reasons why a text document is saved. +type TextDocumentSaveReason uint32 - /*Data defined: - * A data entry field that is preserved on a document link between a - * DocumentLinkRequest and a DocumentLinkResolveRequest. - */ - Data interface{} `json:"data,omitempty"` +// Save registration options. +type TextDocumentSaveRegistrationOptions struct { + TextDocumentRegistrationOptions + SaveOptions +} +type TextDocumentSyncClientCapabilities struct { + // Whether text document synchronization supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // The client supports sending will save notifications. + WillSave bool `json:"willSave,omitempty"` + // The client supports sending a will save request and + // waits for a response providing text edits which will + // be applied to the document before it is saved. + WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"` + // The client supports did save notifications. + DidSave bool `json:"didSave,omitempty"` } -/*SelectionRange defined: - * A selection range represents a part of a selection hierarchy. A selection range - * may have a parent selection range that contains it. - */ -type SelectionRange struct { +// Defines how the host (editor) should sync +// document changes to the language server. +type TextDocumentSyncKind uint32 +type TextDocumentSyncOptions struct { + // Open and close notifications are sent to the server. If omitted open close notification should not + // be sent. + OpenClose bool `json:"openClose,omitempty"` + // Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full + // and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. + Change *TextDocumentSyncKind `json:"change,omitempty"` + // If present will save notifications are sent to the server. If omitted the notification should not be + // sent. + WillSave bool `json:"willSave,omitempty"` + // If present will save wait until requests are sent to the server. If omitted the request should not be + // sent. + WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"` + // If present save notifications are sent to the server. If omitted the notification should not be + // sent. + Save *SaveOptions `json:"save,omitempty"` +} - /*Range defined: - * The [range](#Range) of this selection range. - */ +// A text edit applicable to a text document. +type TextEdit struct { + // The range of the text document to be manipulated. To insert + // text into a document create a range where start === end. Range Range `json:"range"` + // The string to be inserted. For delete operations use an + // empty string. + NewText string `json:"newText"` +} +type TokenFormat string +type TraceValues string - /*Parent defined: - * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. - */ - Parent *SelectionRange `json:"parent,omitempty"` +// Since 3.6.0 +type TypeDefinitionClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is set to `true` + // the client supports the new `TypeDefinitionRegistrationOptions` return value + // for the corresponding server capability as well. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // The client supports additional metadata in the form of definition links. + // + // Since 3.14.0 + LinkSupport bool `json:"linkSupport,omitempty"` +} +type TypeDefinitionOptions struct { + WorkDoneProgressOptions +} +type TypeDefinitionParams struct { + TextDocumentPositionParams + WorkDoneProgressParams + PartialResultParams +} +type TypeDefinitionRegistrationOptions struct { + TextDocumentRegistrationOptions + TypeDefinitionOptions + StaticRegistrationOptions } -/*TextDocument defined: - * A simple text document. Not to be implemented. - */ -type TextDocument struct { +// @since 3.17.0 +type TypeHierarchyClientCapabilities struct { + // Whether implementation supports dynamic registration. If this is set to `true` + // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + // return value for the corresponding server capability as well. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` +} - /*URI defined: - * The associated URI for this document. Most documents have the __file__-scheme, indicating that they - * represent files on disk. However, some documents may have other schemes indicating that they are not - * available on disk. - * - * @readonly - */ +// @since 3.17.0 +type TypeHierarchyItem struct { + // The name of this item. + Name string `json:"name"` + // The kind of this item. + Kind SymbolKind `json:"kind"` + // Tags for this item. + Tags []SymbolTag `json:"tags,omitempty"` + // More detail for this item, e.g. the signature of a function. + Detail string `json:"detail,omitempty"` + // The resource identifier of this item. URI DocumentURI `json:"uri"` - - /*LanguageID defined: - * The identifier of the language associated with this document. - * - * @readonly - */ - LanguageID string `json:"languageId"` - - /*Version defined: - * The version number of this document (it will increase after each - * change, including undo/redo). - * - * @readonly - */ - Version float64 `json:"version"` - - /*LineCount defined: - * The number of lines in this document. - * - * @readonly - */ - LineCount float64 `json:"lineCount"` + // The range enclosing this symbol not including leading/trailing whitespace + // but everything else, e.g. comments and code. + Range Range `json:"range"` + // The range that should be selected and revealed when this symbol is being + // picked, e.g. the name of a function. Must be contained by the + // {@link TypeHierarchyItem.range `range`}. + SelectionRange Range `json:"selectionRange"` + // A data entry field that is preserved between a type hierarchy prepare and + // supertypes or subtypes requests. It could also be used to identify the + // type hierarchy in the server, helping improve the performance on + // resolving supertypes and subtypes. + Data interface{} `json:"data,omitempty"` } -/*TextDocumentChangeEvent defined: - * Event to signal changes to a simple text document. - */ -type TextDocumentChangeEvent struct { +// Type hierarchy options used during static registration. +// +// @since 3.17.0 +type TypeHierarchyOptions struct { + WorkDoneProgressOptions +} - /*Document defined: - * The document that has changed. - */ - Document TextDocument `json:"document"` +// The parameter of a `textDocument/prepareTypeHierarchy` request. +// +// @since 3.17.0 +type TypeHierarchyPrepareParams struct { + TextDocumentPositionParams + WorkDoneProgressParams } -// TextDocumentWillSaveEvent is -type TextDocumentWillSaveEvent struct { +// Type hierarchy options used during static or dynamic registration. +// +// @since 3.17.0 +type TypeHierarchyRegistrationOptions struct { + TextDocumentRegistrationOptions + TypeHierarchyOptions + StaticRegistrationOptions +} - /*Document defined: - * The document that will be saved - */ - Document TextDocument `json:"document"` +// The parameter of a `typeHierarchy/subtypes` request. +// +// @since 3.17.0 +type TypeHierarchySubtypesParams struct { + Item TypeHierarchyItem `json:"item"` + WorkDoneProgressParams + PartialResultParams +} - /*Reason defined: - * The reason why save was triggered. - */ - Reason TextDocumentSaveReason `json:"reason"` +// The parameter of a `typeHierarchy/supertypes` request. +// +// @since 3.17.0 +type TypeHierarchySupertypesParams struct { + Item TypeHierarchyItem `json:"item"` + WorkDoneProgressParams + PartialResultParams } -/*TextDocumentContentChangeEvent defined: - * An event describing a change to a text document. If range and rangeLength are omitted - * the new text is considered to be the full content of the document. - */ -type TextDocumentContentChangeEvent struct { +// created for Tuple +type UIntCommaUInt struct { + Fld0 uint32 `json:"fld0"` + Fld1 uint32 `json:"fld1"` +} +type URI = string - /*Range defined: - * The range of the document that changed. - */ - Range *Range `json:"range,omitempty"` +// A diagnostic report indicating that the last returned +// report is still accurate. +// +// @since 3.17.0 +type UnchangedDocumentDiagnosticReport struct { + // A document diagnostic report indicating + // no changes to the last result. A server can + // only return `unchanged` if result ids are + // provided. + Kind string `json:"kind"` + // A result id which will be sent on the next + // diagnostic request for the same document. + ResultID string `json:"resultId"` +} - /*RangeLength defined: - * The length of the range that got replaced. - */ - RangeLength float64 `json:"rangeLength,omitempty"` +// Moniker uniqueness level to define scope of the moniker. +// +// @since 3.16.0 +type UniquenessLevel string - /*Text defined: - * The new text of the document. - */ - Text string `json:"text"` +// General parameters to unregister a request or notification. +type Unregistration struct { + // The id used to unregister the request or notification. Usually an id + // provided during the register request. + ID string `json:"id"` + // The method to unregister for. + Method string `json:"method"` +} +type UnregistrationParams struct { + Unregisterations []Unregistration `json:"unregisterations"` } -// ProgressParams is -type ProgressParams struct { +// A versioned notebook document identifier. +// +// @since 3.17.0 +type VersionedNotebookDocumentIdentifier struct { + // The version number of this notebook document. + Version int32 `json:"version"` + // The notebook document's uri. + URI URI `json:"uri"` +} - /*Token defined: - * The progress token provided by the client or server. - */ +// A text document identifier to denote a specific version of a text document. +type VersionedTextDocumentIdentifier struct { + // The version number of this document. + Version int32 `json:"version"` + TextDocumentIdentifier +} +type WatchKind = uint32 // line 13505// The parameters sent in a will save text document notification. +type WillSaveTextDocumentParams struct { + // The document that will be saved. + TextDocument TextDocumentIdentifier `json:"textDocument"` + // The 'TextDocumentSaveReason'. + Reason TextDocumentSaveReason `json:"reason"` +} +type WindowClientCapabilities struct { + // It indicates whether the client supports server initiated + // progress using the `window/workDoneProgress/create` request. + // + // The capability also controls Whether client supports handling + // of progress notifications. If set servers are allowed to report a + // `workDoneProgress` property in the request specific server + // capabilities. + // + // @since 3.15.0 + WorkDoneProgress bool `json:"workDoneProgress,omitempty"` + // Capabilities specific to the showMessage request. + // + // @since 3.16.0 + ShowMessage *ShowMessageRequestClientCapabilities `json:"showMessage,omitempty"` + // Capabilities specific to the showDocument request. + // + // @since 3.16.0 + ShowDocument *ShowDocumentClientCapabilities `json:"showDocument,omitempty"` +} +type WorkDoneProgressBegin struct { + Kind string `json:"kind"` + // Mandatory title of the progress operation. Used to briefly inform about + // the kind of operation being performed. + // + // Examples: "Indexing" or "Linking dependencies". + Title string `json:"title"` + // Controls if a cancel button should show to allow the user to cancel the + // long running operation. Clients that don't support cancellation are allowed + // to ignore the setting. + Cancellable bool `json:"cancellable,omitempty"` + // Optional, more detailed associated progress message. Contains + // complementary information to the `title`. + // + // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + // If unset, the previous progress message (if any) is still valid. + Message string `json:"message,omitempty"` + // Optional progress percentage to display (value 100 is considered 100%). + // If not provided infinite progress is assumed and clients are allowed + // to ignore the `percentage` value in subsequent in report notifications. + // + // The value should be steadily rising. Clients are free to ignore values + // that are not following this rule. The value range is [0, 100]. + Percentage uint32 `json:"percentage,omitempty"` +} +type WorkDoneProgressCancelParams struct { + // The token to be used to report progress. Token ProgressToken `json:"token"` - - /*Value defined: - * The progress data. - */ - Value interface{} `json:"value"` } - -// SetTraceParams is -type SetTraceParams struct { - - // Value is - Value TraceValues `json:"value"` +type WorkDoneProgressCreateParams struct { + // The token to be used to report progress. + Token ProgressToken `json:"token"` } - -// LogTraceParams is -type LogTraceParams struct { - - // Message is - Message string `json:"message"` - - // Verbose is - Verbose string `json:"verbose,omitempty"` +type WorkDoneProgressEnd struct { + Kind string `json:"kind"` + // Optional, a final message indicating to for example indicate the outcome + // of the operation. + Message string `json:"message,omitempty"` } - -// Tracer is -type Tracer struct { +type WorkDoneProgressOptions struct { + WorkDoneProgress bool `json:"workDoneProgress,omitempty"` } -// FoldingRangeKind defines constants -type FoldingRangeKind string - -// ResourceOperationKind defines constants -type ResourceOperationKind string - -// FailureHandlingKind defines constants -type FailureHandlingKind string - -// InitializeError defines constants -type InitializeError float64 - -// MessageType defines constants -type MessageType float64 - -// TextDocumentSyncKind defines constants -type TextDocumentSyncKind float64 - -// FileChangeType defines constants -type FileChangeType float64 - -// WatchKind defines constants -type WatchKind float64 - -// CompletionTriggerKind defines constants -type CompletionTriggerKind float64 - -// SignatureHelpTriggerKind defines constants -type SignatureHelpTriggerKind float64 - -// DiagnosticSeverity defines constants -type DiagnosticSeverity float64 - -// DiagnosticTag defines constants -type DiagnosticTag float64 - -// MarkupKind defines constants -type MarkupKind string - -// CompletionItemKind defines constants -type CompletionItemKind float64 - -// InsertTextFormat defines constants -type InsertTextFormat float64 - -// CompletionItemTag defines constants -type CompletionItemTag float64 - -// DocumentHighlightKind defines constants -type DocumentHighlightKind float64 - -// SymbolKind defines constants -type SymbolKind float64 +// created for And +type WorkDoneProgressOptionsAndTextDocumentRegistrationOptions struct { + WorkDoneProgressOptions + TextDocumentRegistrationOptions +} +type WorkDoneProgressParams struct { + // An optional token that a server can use to report work done progress. + WorkDoneToken *ProgressToken `json:"workDoneToken,omitempty"` +} +type WorkDoneProgressReport struct { + Kind string `json:"kind"` + // Controls enablement state of a cancel button. + // + // Clients that don't support cancellation or don't support controlling the button's + // enablement state are allowed to ignore the property. + Cancellable bool `json:"cancellable,omitempty"` + // Optional, more detailed associated progress message. Contains + // complementary information to the `title`. + // + // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". + // If unset, the previous progress message (if any) is still valid. + Message string `json:"message,omitempty"` + // Optional progress percentage to display (value 100 is considered 100%). + // If not provided infinite progress is assumed and clients are allowed + // to ignore the `percentage` value in subsequent in report notifications. + // + // The value should be steadily rising. Clients are free to ignore values + // that are not following this rule. The value range is [0, 100] + Percentage uint32 `json:"percentage,omitempty"` +} + +// created for Literal (Lit_ServerCapabilities_workspace) +type Workspace6Gn struct { + // The server supports workspace folder. + // + // @since 3.6.0 + WorkspaceFolders *WorkspaceFolders5Gn `json:"workspaceFolders,omitempty"` + // The server is interested in notifications/requests for operations on files. + // + // @since 3.16.0 + FileOperations *FileOperationOptions `json:"fileOperations,omitempty"` +} + +// Workspace specific client capabilities. +type WorkspaceClientCapabilities struct { + // The client supports applying batch edits + // to the workspace by supporting the request + // 'workspace/applyEdit' + ApplyEdit bool `json:"applyEdit,omitempty"` + // Capabilities specific to `WorkspaceEdit`s. + WorkspaceEdit *WorkspaceEditClientCapabilities `json:"workspaceEdit,omitempty"` + // Capabilities specific to the `workspace/didChangeConfiguration` notification. + DidChangeConfiguration *DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitempty"` + // Capabilities specific to the `workspace/didChangeWatchedFiles` notification. + DidChangeWatchedFiles *DidChangeWatchedFilesClientCapabilities `json:"didChangeWatchedFiles,omitempty"` + // Capabilities specific to the `workspace/symbol` request. + Symbol *WorkspaceSymbolClientCapabilities `json:"symbol,omitempty"` + // Capabilities specific to the `workspace/executeCommand` request. + ExecuteCommand *ExecuteCommandClientCapabilities `json:"executeCommand,omitempty"` + // The client has support for workspace folders. + // + // @since 3.6.0 + WorkspaceFolders bool `json:"workspaceFolders,omitempty"` + // The client supports `workspace/configuration` requests. + // + // @since 3.6.0 + Configuration bool `json:"configuration,omitempty"` + // Capabilities specific to the semantic token requests scoped to the + // workspace. + // + // @since 3.16.0. + SemanticTokens *SemanticTokensWorkspaceClientCapabilities `json:"semanticTokens,omitempty"` + // Capabilities specific to the code lens requests scoped to the + // workspace. + // + // @since 3.16.0. + CodeLens *CodeLensWorkspaceClientCapabilities `json:"codeLens,omitempty"` + // The client has support for file notifications/requests for user operations on files. + // + // Since 3.16.0 + FileOperations *FileOperationClientCapabilities `json:"fileOperations,omitempty"` + // Capabilities specific to the inline values requests scoped to the + // workspace. + // + // @since 3.17.0. + InlineValue *InlineValueWorkspaceClientCapabilities `json:"inlineValue,omitempty"` + // Capabilities specific to the inlay hint requests scoped to the + // workspace. + // + // @since 3.17.0. + InlayHint *InlayHintWorkspaceClientCapabilities `json:"inlayHint,omitempty"` + // Capabilities specific to the diagnostic requests scoped to the + // workspace. + // + // @since 3.17.0. + Diagnostics *DiagnosticWorkspaceClientCapabilities `json:"diagnostics,omitempty"` +} + +// Parameters of the workspace diagnostic request. +// +// @since 3.17.0 +type WorkspaceDiagnosticParams struct { + // The additional identifier provided during registration. + Identifier string `json:"identifier,omitempty"` + // The currently known diagnostic reports with their + // previous result ids. + PreviousResultIds []PreviousResultID `json:"previousResultIds"` + WorkDoneProgressParams + PartialResultParams +} -// CodeActionKind defines constants -type CodeActionKind string +// A workspace diagnostic report. +// +// @since 3.17.0 +type WorkspaceDiagnosticReport struct { + Items []WorkspaceDocumentDiagnosticReport `json:"items"` +} + +// A partial result for a workspace diagnostic report. +// +// @since 3.17.0 +type WorkspaceDiagnosticReportPartialResult struct { + Items []WorkspaceDocumentDiagnosticReport `json:"items"` +} + +// A workspace diagnostic document report. +// +// @since 3.17.0 +type WorkspaceDocumentDiagnosticReport = Or_WorkspaceDocumentDiagnosticReport // (alias) line 14405 +// A workspace edit represents changes to many resources managed in the workspace. The edit +// should either provide `changes` or `documentChanges`. If documentChanges are present +// they are preferred over `changes` if the client can handle versioned document edits. +// +// Since version 3.13.0 a workspace edit can contain resource operations as well. If resource +// operations are present clients need to execute the operations in the order in which they +// are provided. So a workspace edit for example can consist of the following two changes: +// (1) a create file a.txt and (2) a text document edit which insert text into file a.txt. +// +// An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will +// cause failure of the operation. How the client recovers from the failure is described by +// the client capability: `workspace.workspaceEdit.failureHandling` +type WorkspaceEdit struct { + // Holds changes to existing resources. + Changes map[DocumentURI][]TextEdit `json:"changes,omitempty"` + // Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes + // are either an array of `TextDocumentEdit`s to express changes to n different text documents + // where each text document edit addresses a specific version of a text document. Or it can contain + // above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. + // + // Whether a client supports versioned document edits is expressed via + // `workspace.workspaceEdit.documentChanges` client capability. + // + // If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then + // only plain `TextEdit`s using the `changes` property are supported. + DocumentChanges []DocumentChanges `json:"documentChanges,omitempty"` + // A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and + // delete file / folder operations. + // + // Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`. + // + // @since 3.16.0 + ChangeAnnotations map[ChangeAnnotationIdentifier]ChangeAnnotation `json:"changeAnnotations,omitempty"` +} +type WorkspaceEditClientCapabilities struct { + // The client supports versioned document changes in `WorkspaceEdit`s + DocumentChanges bool `json:"documentChanges,omitempty"` + // The resource operations the client supports. Clients should at least + // support 'create', 'rename' and 'delete' files and folders. + // + // @since 3.13.0 + ResourceOperations []ResourceOperationKind `json:"resourceOperations,omitempty"` + // The failure handling strategy of a client if applying the workspace edit + // fails. + // + // @since 3.13.0 + FailureHandling *FailureHandlingKind `json:"failureHandling,omitempty"` + // Whether the client normalizes line endings to the client specific + // setting. + // If set to `true` the client will normalize line ending characters + // in a workspace edit to the client-specified new line + // character. + // + // @since 3.16.0 + NormalizesLineEndings bool `json:"normalizesLineEndings,omitempty"` + // Whether the client in general supports change annotations on text edits, + // create file, rename file and delete file changes. + // + // @since 3.16.0 + ChangeAnnotationSupport *PChangeAnnotationSupportPWorkspaceEdit `json:"changeAnnotationSupport,omitempty"` +} + +// A workspace folder inside a client. +type WorkspaceFolder struct { + // The associated URI for this workspace folder. + URI URI `json:"uri"` + // The name of the workspace folder. Used to refer to this + // workspace folder in the user interface. + Name string `json:"name"` +} +type WorkspaceFolders5Gn struct { + // The server has support for workspace folders + Supported bool `json:"supported,omitempty"` + // Whether the server wants to receive workspace folder + // change notifications. + // + // If a string is provided the string is treated as an ID + // under which the notification is registered on the client + // side. The ID can be used to unregister for these events + // using the `client/unregisterCapability` request. + ChangeNotifications *Or_WorkspaceFoldersServerCapabilities_changeNotifications `json:"changeNotifications,omitempty"` +} -// TextDocumentSaveReason defines constants -type TextDocumentSaveReason float64 +// The workspace folder change event. +type WorkspaceFoldersChangeEvent struct { + // The array of added workspace folders + Added []WorkspaceFolder `json:"added"` + // The array of the removed workspace folders + Removed []WorkspaceFolder `json:"removed"` +} +type WorkspaceFoldersInitializeParams struct { + // The workspace folders configured in the client when the server starts. + // + // This property is only available if the client supports workspace folders. + // It can be `null` if the client supports workspace folders but none are + // configured. + // + // @since 3.6.0 + WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders,omitempty"` +} +type WorkspaceFoldersServerCapabilities struct { + // The server has support for workspace folders + Supported bool `json:"supported,omitempty"` + // Whether the server wants to receive workspace folder + // change notifications. + // + // If a string is provided the string is treated as an ID + // under which the notification is registered on the client + // side. The ID can be used to unregister for these events + // using the `client/unregisterCapability` request. + ChangeNotifications *Or_WorkspaceFoldersServerCapabilities_changeNotifications `json:"changeNotifications,omitempty"` +} + +// A full document diagnostic report for a workspace diagnostic result. +// +// @since 3.17.0 +type WorkspaceFullDocumentDiagnosticReport struct { + // The URI for which diagnostic information is reported. + URI DocumentURI `json:"uri"` + // The version number for which the diagnostics are reported. + // If the document is not marked as open `null` can be provided. + Version int32 `json:"version"` + FullDocumentDiagnosticReport +} -// ErrorCodes defines constants -type ErrorCodes float64 +// A special workspace symbol that supports locations without a range. +// +// See also SymbolInformation. +// +// @since 3.17.0 +type WorkspaceSymbol struct { + // The location of the symbol. Whether a server is allowed to + // return a location without a range depends on the client + // capability `workspace.symbol.resolveSupport`. + // + // See SymbolInformation#location for more details. + Location OrPLocation_workspace_symbol `json:"location"` + // A data entry field that is preserved on a workspace symbol between a + // workspace symbol request and a workspace symbol resolve request. + Data interface{} `json:"data,omitempty"` + BaseSymbolInformation +} -// Touch defines constants -type Touch float64 +// Client capabilities for a {@link WorkspaceSymbolRequest}. +type WorkspaceSymbolClientCapabilities struct { + // Symbol request supports dynamic registration. + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + // Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. + SymbolKind *PSymbolKindPSymbol `json:"symbolKind,omitempty"` + // The client supports tags on `SymbolInformation`. + // Clients supporting tags have to handle unknown tags gracefully. + // + // @since 3.16.0 + TagSupport *PTagSupportPSymbol `json:"tagSupport,omitempty"` + // The client support partial workspace symbols. The client will send the + // request `workspaceSymbol/resolve` to the server to resolve additional + // properties. + // + // @since 3.17.0 + ResolveSupport *PResolveSupportPSymbol `json:"resolveSupport,omitempty"` +} + +// Server capabilities for a {@link WorkspaceSymbolRequest}. +type WorkspaceSymbolOptions struct { + // The server provides support to resolve additional + // information for a workspace symbol. + // + // @since 3.17.0 + ResolveProvider bool `json:"resolveProvider,omitempty"` + WorkDoneProgressOptions +} -// Trace defines constants -type Trace string +// The parameters of a {@link WorkspaceSymbolRequest}. +type WorkspaceSymbolParams struct { + // A query string to filter symbols by. Clients may send an empty + // string here to request all symbols. + Query string `json:"query"` + WorkDoneProgressParams + PartialResultParams +} -// TraceFormat defines constants -type TraceFormat string +// Registration options for a {@link WorkspaceSymbolRequest}. +type WorkspaceSymbolRegistrationOptions struct { + WorkspaceSymbolOptions +} -// ConnectionErrors defines constants -type ConnectionErrors float64 +// An unchanged document diagnostic report for a workspace diagnostic result. +// +// @since 3.17.0 +type WorkspaceUnchangedDocumentDiagnosticReport struct { + // The URI for which diagnostic information is reported. + URI DocumentURI `json:"uri"` + // The version number for which the diagnostics are reported. + // If the document is not marked as open `null` can be provided. + Version int32 `json:"version"` + UnchangedDocumentDiagnosticReport +} + +// The initialize parameters +type XInitializeParams struct { + // The process Id of the parent process that started + // the server. + // + // Is `null` if the process has not been started by another process. + // If the parent process is not alive then the server should exit. + ProcessID int32 `json:"processId"` + // Information about the client + // + // @since 3.15.0 + ClientInfo *Msg_XInitializeParams_clientInfo `json:"clientInfo,omitempty"` + // The locale the client is currently showing the user interface + // in. This must not necessarily be the locale of the operating + // system. + // + // Uses IETF language tags as the value's syntax + // (See https://en.wikipedia.org/wiki/IETF_language_tag) + // + // @since 3.16.0 + Locale string `json:"locale,omitempty"` + // The rootPath of the workspace. Is null + // if no folder is open. + // + // @deprecated in favour of rootUri. + RootPath string `json:"rootPath,omitempty"` + // The rootUri of the workspace. Is null if no + // folder is open. If both `rootPath` and `rootUri` are set + // `rootUri` wins. + // + // @deprecated in favour of workspaceFolders. + RootURI DocumentURI `json:"rootUri"` + // The capabilities provided by the client (editor or tool) + Capabilities ClientCapabilities `json:"capabilities"` + // User provided initialization options. + InitializationOptions interface{} `json:"initializationOptions,omitempty"` + // The initial trace setting. If omitted trace is disabled ('off'). + Trace *TraceValues `json:"trace,omitempty"` + WorkDoneProgressParams + // added by konveyor/analyzer-lsp. Why is this needed? - Jonah + ExtendedClientCapilities map[string]interface{} `json:"extendedClientCapabilities"` +} -// ConnectionState defines constants -type ConnectionState float64 +// The initialize parameters +type _InitializeParams struct { + // The process Id of the parent process that started + // the server. + // + // Is `null` if the process has not been started by another process. + // If the parent process is not alive then the server should exit. + ProcessID int32 `json:"processId"` + // Information about the client + // + // @since 3.15.0 + ClientInfo *Msg_XInitializeParams_clientInfo `json:"clientInfo,omitempty"` + // The locale the client is currently showing the user interface + // in. This must not necessarily be the locale of the operating + // system. + // + // Uses IETF language tags as the value's syntax + // (See https://en.wikipedia.org/wiki/IETF_language_tag) + // + // @since 3.16.0 + Locale string `json:"locale,omitempty"` + // The rootPath of the workspace. Is null + // if no folder is open. + // + // @deprecated in favour of rootUri. + RootPath string `json:"rootPath,omitempty"` + // The rootUri of the workspace. Is null if no + // folder is open. If both `rootPath` and `rootUri` are set + // `rootUri` wins. + // + // @deprecated in favour of workspaceFolders. + RootURI DocumentURI `json:"rootUri"` + // The capabilities provided by the client (editor or tool) + Capabilities ClientCapabilities `json:"capabilities"` + // User provided initialization options. + InitializationOptions interface{} `json:"initializationOptions,omitempty"` + // The initial trace setting. If omitted trace is disabled ('off'). + Trace *TraceValues `json:"trace,omitempty"` + WorkDoneProgressParams +} const ( - - /*Comment defined: - * Folding range for a comment - */ - Comment FoldingRangeKind = "comment" - - /*Imports defined: - * Folding range for a imports or includes - */ - Imports FoldingRangeKind = "imports" - - /*Region defined: - * Folding range for a region (e.g. `#region`) - */ - Region FoldingRangeKind = "region" - - /*Create defined: - * Supports creating new files and folders. - */ - Create ResourceOperationKind = "create" - - /*Rename defined: - * Supports renaming existing files and folders. - */ - Rename ResourceOperationKind = "rename" - - /*Delete defined: - * Supports deleting existing files and folders. - */ - Delete ResourceOperationKind = "delete" - - /*Abort defined: - * Applying the workspace change is simply aborted if one of the changes provided - * fails. All operations executed before the failing operation stay executed. - */ - Abort FailureHandlingKind = "abort" - - /*Transactional defined: - * All operations are executed transactional. That means they either all - * succeed or no changes at all are applied to the workspace. - */ - Transactional FailureHandlingKind = "transactional" - - /*TextOnlyTransactional defined: - * If the workspace edit contains only textual file changes they are executed transactional. - * If resource changes (create, rename or delete file) are part of the change the failure - * handling startegy is abort. - */ - TextOnlyTransactional FailureHandlingKind = "textOnlyTransactional" - - /*Undo defined: - * The client tries to undo the operations already executed. But there is no - * guaruntee that this is succeeding. - */ - Undo FailureHandlingKind = "undo" - - /*UnknownProtocolVersion defined: - * If the protocol version provided by the client can't be handled by the server. - * @deprecated This initialize error got replaced by client capabilities. There is - * no version handshake in version 3.0x - */ - UnknownProtocolVersion InitializeError = 1 - - /*Error defined: - * An error message. - */ - Error MessageType = 1 - - /*Warning defined: - * A warning message. - */ - Warning MessageType = 2 - - /*Info defined: - * An information message. - */ - Info MessageType = 3 - - /*Log defined: - * A log message. - */ - Log MessageType = 4 - - /*None defined: - * Documents should not be synced at all. - */ - None TextDocumentSyncKind = 0 - - /*Full defined: - * Documents are synced by always sending the full content - * of the document. - */ - Full TextDocumentSyncKind = 1 - - /*Incremental defined: - * Documents are synced by sending the full content on open. - * After that only incremental updates to the document are - * send. - */ - Incremental TextDocumentSyncKind = 2 - - /*Created defined: - * The file got created. - */ - Created FileChangeType = 1 - - /*Changed defined: - * The file got changed. - */ - Changed FileChangeType = 2 - - /*Deleted defined: - * The file got deleted. - */ - Deleted FileChangeType = 3 - - /*WatchCreate defined: - * Interested in create events. - */ - WatchCreate WatchKind = 1 - - /*WatchChange defined: - * Interested in change events - */ - WatchChange WatchKind = 2 - - /*WatchDelete defined: - * Interested in delete events - */ - WatchDelete WatchKind = 4 - - /*Invoked defined: - * Completion was triggered by typing an identifier (24x7 code - * complete), manual invocation (e.g Ctrl+Space) or via API. - */ + // A set of predefined code action kinds + // Empty kind. + Empty CodeActionKind = "" + // Base kind for quickfix actions: 'quickfix' + QuickFix CodeActionKind = "quickfix" + // Base kind for refactoring actions: 'refactor' + Refactor CodeActionKind = "refactor" + // Base kind for refactoring extraction actions: 'refactor.extract' + // + // Example extract actions: + // + // + // - Extract method + // - Extract function + // - Extract variable + // - Extract interface from class + // - ... + RefactorExtract CodeActionKind = "refactor.extract" + // Base kind for refactoring inline actions: 'refactor.inline' + // + // Example inline actions: + // + // + // - Inline function + // - Inline variable + // - Inline constant + // - ... + RefactorInline CodeActionKind = "refactor.inline" + // Base kind for refactoring rewrite actions: 'refactor.rewrite' + // + // Example rewrite actions: + // + // + // - Convert JavaScript function to class + // - Add or remove parameter + // - Encapsulate field + // - Make method static + // - Move method to base class + // - ... + RefactorRewrite CodeActionKind = "refactor.rewrite" + // Base kind for source actions: `source` + // + // Source code actions apply to the entire file. + Source CodeActionKind = "source" + // Base kind for an organize imports source action: `source.organizeImports` + SourceOrganizeImports CodeActionKind = "source.organizeImports" + // Base kind for auto-fix source actions: `source.fixAll`. + // + // Fix all actions automatically fix errors that have a clear fix that do not require user input. + // They should not suppress errors or perform unsafe fixes such as generating new types or classes. + // + // @since 3.15.0 + SourceFixAll CodeActionKind = "source.fixAll" + // The reason why code actions were requested. + // + // @since 3.17.0 + // Code actions were explicitly requested by the user or by an extension. + CodeActionInvoked CodeActionTriggerKind = 1 + // Code actions were requested automatically. + // + // This typically happens when current selection in a file changes, but can + // also be triggered when file content changes. + CodeActionAutomatic CodeActionTriggerKind = 2 + // The kind of a completion entry. + TextCompletion CompletionItemKind = 1 + MethodCompletion CompletionItemKind = 2 + FunctionCompletion CompletionItemKind = 3 + ConstructorCompletion CompletionItemKind = 4 + FieldCompletion CompletionItemKind = 5 + VariableCompletion CompletionItemKind = 6 + ClassCompletion CompletionItemKind = 7 + InterfaceCompletion CompletionItemKind = 8 + ModuleCompletion CompletionItemKind = 9 + PropertyCompletion CompletionItemKind = 10 + UnitCompletion CompletionItemKind = 11 + ValueCompletion CompletionItemKind = 12 + EnumCompletion CompletionItemKind = 13 + KeywordCompletion CompletionItemKind = 14 + SnippetCompletion CompletionItemKind = 15 + ColorCompletion CompletionItemKind = 16 + FileCompletion CompletionItemKind = 17 + ReferenceCompletion CompletionItemKind = 18 + FolderCompletion CompletionItemKind = 19 + EnumMemberCompletion CompletionItemKind = 20 + ConstantCompletion CompletionItemKind = 21 + StructCompletion CompletionItemKind = 22 + EventCompletion CompletionItemKind = 23 + OperatorCompletion CompletionItemKind = 24 + TypeParameterCompletion CompletionItemKind = 25 + // Completion item tags are extra annotations that tweak the rendering of a completion + // item. + // + // @since 3.15.0 + // Render a completion as obsolete, usually using a strike-out. + ComplDeprecated CompletionItemTag = 1 + // How a completion was triggered + // Completion was triggered by typing an identifier (24x7 code + // complete), manual invocation (e.g Ctrl+Space) or via API. Invoked CompletionTriggerKind = 1 - - /*TriggerCharacter defined: - * Completion was triggered by a trigger character specified by - * the `triggerCharacters` properties of the `CompletionRegistrationOptions`. - */ + // Completion was triggered by a trigger character specified by + // the `triggerCharacters` properties of the `CompletionRegistrationOptions`. TriggerCharacter CompletionTriggerKind = 2 - - /*TriggerForIncompleteCompletions defined: - * Completion was re-triggered as current completion list is incomplete - */ + // Completion was re-triggered as current completion list is incomplete TriggerForIncompleteCompletions CompletionTriggerKind = 3 - - /*ContentChange defined: - * Signature help was triggered by the cursor moving or by the document content changing. - */ - ContentChange SignatureHelpTriggerKind = 3 - - /*SeverityError defined: - * Reports an error. - */ + // The diagnostic's severity. + // Reports an error. SeverityError DiagnosticSeverity = 1 - - /*SeverityWarning defined: - * Reports a warning. - */ + // Reports a warning. SeverityWarning DiagnosticSeverity = 2 - - /*SeverityInformation defined: - * Reports an information. - */ + // Reports an information. SeverityInformation DiagnosticSeverity = 3 - - /*SeverityHint defined: - * Reports a hint. - */ + // Reports a hint. SeverityHint DiagnosticSeverity = 4 - - /*Unnecessary defined: - * Unused or unnecessary code. - * - * Clients are allowed to render diagnostics with this tag faded out instead of having - * an error squiggle. - */ + // The diagnostic tags. + // + // @since 3.15.0 + // Unused or unnecessary code. + // + // Clients are allowed to render diagnostics with this tag faded out instead of having + // an error squiggle. Unnecessary DiagnosticTag = 1 - - /*Deprecated defined: - * Deprecated or obsolete code. - * - * Clients are allowed to rendered diagnostics with this tag strike through. - */ + // Deprecated or obsolete code. + // + // Clients are allowed to rendered diagnostics with this tag strike through. Deprecated DiagnosticTag = 2 - - /*PlainText defined: - * Plain text is supported as a content format - */ - PlainText MarkupKind = "plaintext" - - /*Markdown defined: - * Markdown is supported as a content format - */ - Markdown MarkupKind = "markdown" - - // TextCompletion is - TextCompletion CompletionItemKind = 1 - - // MethodCompletion is - MethodCompletion CompletionItemKind = 2 - - // FunctionCompletion is - FunctionCompletion CompletionItemKind = 3 - - // ConstructorCompletion is - ConstructorCompletion CompletionItemKind = 4 - - // FieldCompletion is - FieldCompletion CompletionItemKind = 5 - - // VariableCompletion is - VariableCompletion CompletionItemKind = 6 - - // ClassCompletion is - ClassCompletion CompletionItemKind = 7 - - // InterfaceCompletion is - InterfaceCompletion CompletionItemKind = 8 - - // ModuleCompletion is - ModuleCompletion CompletionItemKind = 9 - - // PropertyCompletion is - PropertyCompletion CompletionItemKind = 10 - - // UnitCompletion is - UnitCompletion CompletionItemKind = 11 - - // ValueCompletion is - ValueCompletion CompletionItemKind = 12 - - // EnumCompletion is - EnumCompletion CompletionItemKind = 13 - - // KeywordCompletion is - KeywordCompletion CompletionItemKind = 14 - - // SnippetCompletion is - SnippetCompletion CompletionItemKind = 15 - - // ColorCompletion is - ColorCompletion CompletionItemKind = 16 - - // FileCompletion is - FileCompletion CompletionItemKind = 17 - - // ReferenceCompletion is - ReferenceCompletion CompletionItemKind = 18 - - // FolderCompletion is - FolderCompletion CompletionItemKind = 19 - - // EnumMemberCompletion is - EnumMemberCompletion CompletionItemKind = 20 - - // ConstantCompletion is - ConstantCompletion CompletionItemKind = 21 - - // StructCompletion is - StructCompletion CompletionItemKind = 22 - - // EventCompletion is - EventCompletion CompletionItemKind = 23 - - // OperatorCompletion is - OperatorCompletion CompletionItemKind = 24 - - // TypeParameterCompletion is - TypeParameterCompletion CompletionItemKind = 25 - - /*PlainTextTextFormat defined: - * The primary text to be inserted is treated as a plain string. - */ - PlainTextTextFormat InsertTextFormat = 1 - - /*SnippetTextFormat defined: - * The primary text to be inserted is treated as a snippet. - * - * A snippet can define tab stops and placeholders with `$1`, `$2` - * and `${3:foo}`. `$0` defines the final tab stop, it defaults to - * the end of the snippet. Placeholders with equal identifiers are linked, - * that is typing in one will update others too. - * - * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md - */ - SnippetTextFormat InsertTextFormat = 2 - - /*Text defined: - * A textual occurrence. - */ + // The document diagnostic report kinds. + // + // @since 3.17.0 + // A diagnostic report with a full + // set of problems. + DiagnosticFull DocumentDiagnosticReportKind = "full" + // A report indicating that the last + // returned report is still accurate. + DiagnosticUnchanged DocumentDiagnosticReportKind = "unchanged" + // A document highlight kind. + // A textual occurrence. Text DocumentHighlightKind = 1 - - /*Read defined: - * Read-access of a symbol, like reading a variable. - */ + // Read-access of a symbol, like reading a variable. Read DocumentHighlightKind = 2 - - /*Write defined: - * Write-access of a symbol, like writing to a variable. - */ + // Write-access of a symbol, like writing to a variable. Write DocumentHighlightKind = 3 - - // File is - File SymbolKind = 1 - - // Module is - Module SymbolKind = 2 - - // Namespace is - Namespace SymbolKind = 3 - - // Package is - Package SymbolKind = 4 - - // Class is - Class SymbolKind = 5 - - // Method is - Method SymbolKind = 6 - - // Property is - Property SymbolKind = 7 - - // Field is - Field SymbolKind = 8 - - // Constructor is - Constructor SymbolKind = 9 - - // Enum is - Enum SymbolKind = 10 - - // Interface is - Interface SymbolKind = 11 - - // Function is - Function SymbolKind = 12 - - // Variable is - Variable SymbolKind = 13 - - // Constant is - Constant SymbolKind = 14 - - // String is - String SymbolKind = 15 - - // Number is - Number SymbolKind = 16 - - // Boolean is - Boolean SymbolKind = 17 - - // Array is - Array SymbolKind = 18 - - // Object is - Object SymbolKind = 19 - - // Key is - Key SymbolKind = 20 - - // Null is - Null SymbolKind = 21 - - // EnumMember is - EnumMember SymbolKind = 22 - - // Struct is - Struct SymbolKind = 23 - - // Event is - Event SymbolKind = 24 - - // Operator is - Operator SymbolKind = 25 - - // TypeParameter is + // Predefined error codes. + ParseError ErrorCodes = -32700 + InvalidRequest ErrorCodes = -32600 + MethodNotFound ErrorCodes = -32601 + InvalidParams ErrorCodes = -32602 + InternalError ErrorCodes = -32603 + // Error code indicating that a server received a notification or + // request before the server has received the `initialize` request. + ServerNotInitialized ErrorCodes = -32002 + UnknownErrorCode ErrorCodes = -32001 + // Applying the workspace change is simply aborted if one of the changes provided + // fails. All operations executed before the failing operation stay executed. + Abort FailureHandlingKind = "abort" + // All operations are executed transactional. That means they either all + // succeed or no changes at all are applied to the workspace. + Transactional FailureHandlingKind = "transactional" + // If the workspace edit contains only textual file changes they are executed transactional. + // If resource changes (create, rename or delete file) are part of the change the failure + // handling strategy is abort. + TextOnlyTransactional FailureHandlingKind = "textOnlyTransactional" + // The client tries to undo the operations already executed. But there is no + // guarantee that this is succeeding. + Undo FailureHandlingKind = "undo" + // The file event type + // The file got created. + Created FileChangeType = 1 + // The file got changed. + Changed FileChangeType = 2 + // The file got deleted. + Deleted FileChangeType = 3 + // A pattern kind describing if a glob pattern matches a file a folder or + // both. + // + // @since 3.16.0 + // The pattern matches a file only. + FilePattern FileOperationPatternKind = "file" + // The pattern matches a folder only. + FolderPattern FileOperationPatternKind = "folder" + // A set of predefined range kinds. + // Folding range for a comment + Comment FoldingRangeKind = "comment" + // Folding range for an import or include + Imports FoldingRangeKind = "imports" + // Folding range for a region (e.g. `#region`) + Region FoldingRangeKind = "region" + // Inlay hint kinds. + // + // @since 3.17.0 + // An inlay hint that for a type annotation. + Type InlayHintKind = 1 + // An inlay hint that is for a parameter. + Parameter InlayHintKind = 2 + // Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered. + // + // @since 3.18.0 + // @proposed + // Completion was triggered explicitly by a user gesture. + InlineInvoked InlineCompletionTriggerKind = 0 + // Completion was triggered automatically while editing. + InlineAutomatic InlineCompletionTriggerKind = 1 + // Defines whether the insert text in a completion item should be interpreted as + // plain text or a snippet. + // The primary text to be inserted is treated as a plain string. + PlainTextTextFormat InsertTextFormat = 1 + // The primary text to be inserted is treated as a snippet. + // + // A snippet can define tab stops and placeholders with `$1`, `$2` + // and `${3:foo}`. `$0` defines the final tab stop, it defaults to + // the end of the snippet. Placeholders with equal identifiers are linked, + // that is typing in one will update others too. + // + // See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax + SnippetTextFormat InsertTextFormat = 2 + // How whitespace and indentation is handled during completion + // item insertion. + // + // @since 3.16.0 + // The insertion or replace strings is taken as it is. If the + // value is multi line the lines below the cursor will be + // inserted using the indentation defined in the string value. + // The client will not apply any kind of adjustments to the + // string. + AsIs InsertTextMode = 1 + // The editor adjusts leading whitespace of new lines so that + // they match the indentation up to the cursor of the line for + // which the item is accepted. + // + // Consider a line like this: <2tabs><3tabs>foo. Accepting a + // multi line completion item is indented using 2 tabs and all + // following lines inserted will be indented using 2 tabs as well. + AdjustIndentation InsertTextMode = 2 + // A request failed but it was syntactically correct, e.g the + // method name was known and the parameters were valid. The error + // message should contain human readable information about why + // the request failed. + // + // @since 3.17.0 + RequestFailed LSPErrorCodes = -32803 + // The server cancelled the request. This error code should + // only be used for requests that explicitly support being + // server cancellable. + // + // @since 3.17.0 + ServerCancelled LSPErrorCodes = -32802 + // The server detected that the content of a document got + // modified outside normal conditions. A server should + // NOT send this error code if it detects a content change + // in it unprocessed messages. The result even computed + // on an older state might still be useful for the client. + // + // If a client decides that a result is not of any use anymore + // the client should cancel the request. + ContentModified LSPErrorCodes = -32801 + // The client has canceled a request and a server as detected + // the cancel. + RequestCancelled LSPErrorCodes = -32800 + // Describes the content type that a client supports in various + // result literals like `Hover`, `ParameterInfo` or `CompletionItem`. + // + // Please note that `MarkupKinds` must not start with a `$`. This kinds + // are reserved for internal usage. + // Plain text is supported as a content format + PlainText MarkupKind = "plaintext" + // Markdown is supported as a content format + Markdown MarkupKind = "markdown" + // The message type + // An error message. + Error MessageType = 1 + // A warning message. + Warning MessageType = 2 + // An information message. + Info MessageType = 3 + // A log message. + Log MessageType = 4 + // A debug message. + // + // @since 3.18.0 + Debug MessageType = 5 + // The moniker kind. + // + // @since 3.16.0 + // The moniker represent a symbol that is imported into a project + Import MonikerKind = "import" + // The moniker represents a symbol that is exported from a project + Export MonikerKind = "export" + // The moniker represents a symbol that is local to a project (e.g. a local + // variable of a function, a class not visible outside the project, ...) + Local MonikerKind = "local" + // A notebook cell kind. + // + // @since 3.17.0 + // A markup-cell is formatted source that is used for display. + Markup NotebookCellKind = 1 + // A code-cell is source code. + Code NotebookCellKind = 2 + // A set of predefined position encoding kinds. + // + // @since 3.17.0 + // Character offsets count UTF-8 code units (e.g. bytes). + UTF8 PositionEncodingKind = "utf-8" + // Character offsets count UTF-16 code units. + // + // This is the default and must always be supported + // by servers + UTF16 PositionEncodingKind = "utf-16" + // Character offsets count UTF-32 code units. + // + // Implementation note: these are the same as Unicode codepoints, + // so this `PositionEncodingKind` may also be used for an + // encoding-agnostic representation of character offsets. + UTF32 PositionEncodingKind = "utf-32" + // The client's default behavior is to select the identifier + // according the to language's syntax rule. + Identifier PrepareSupportDefaultBehavior = 1 + // Supports creating new files and folders. + Create ResourceOperationKind = "create" + // Supports renaming existing files and folders. + Rename ResourceOperationKind = "rename" + // Supports deleting existing files and folders. + Delete ResourceOperationKind = "delete" + // A set of predefined token modifiers. This set is not fixed + // an clients can specify additional token types via the + // corresponding client capabilities. + // + // @since 3.16.0 + ModDeclaration SemanticTokenModifiers = "declaration" + ModDefinition SemanticTokenModifiers = "definition" + ModReadonly SemanticTokenModifiers = "readonly" + ModStatic SemanticTokenModifiers = "static" + ModDeprecated SemanticTokenModifiers = "deprecated" + ModAbstract SemanticTokenModifiers = "abstract" + ModAsync SemanticTokenModifiers = "async" + ModModification SemanticTokenModifiers = "modification" + ModDocumentation SemanticTokenModifiers = "documentation" + ModDefaultLibrary SemanticTokenModifiers = "defaultLibrary" + // A set of predefined token types. This set is not fixed + // an clients can specify additional token types via the + // corresponding client capabilities. + // + // @since 3.16.0 + NamespaceType SemanticTokenTypes = "namespace" + // Represents a generic type. Acts as a fallback for types which can't be mapped to + // a specific type like class or enum. + TypeType SemanticTokenTypes = "type" + ClassType SemanticTokenTypes = "class" + EnumType SemanticTokenTypes = "enum" + InterfaceType SemanticTokenTypes = "interface" + StructType SemanticTokenTypes = "struct" + TypeParameterType SemanticTokenTypes = "typeParameter" + ParameterType SemanticTokenTypes = "parameter" + VariableType SemanticTokenTypes = "variable" + PropertyType SemanticTokenTypes = "property" + EnumMemberType SemanticTokenTypes = "enumMember" + EventType SemanticTokenTypes = "event" + FunctionType SemanticTokenTypes = "function" + MethodType SemanticTokenTypes = "method" + MacroType SemanticTokenTypes = "macro" + KeywordType SemanticTokenTypes = "keyword" + ModifierType SemanticTokenTypes = "modifier" + CommentType SemanticTokenTypes = "comment" + StringType SemanticTokenTypes = "string" + NumberType SemanticTokenTypes = "number" + RegexpType SemanticTokenTypes = "regexp" + OperatorType SemanticTokenTypes = "operator" + // @since 3.17.0 + DecoratorType SemanticTokenTypes = "decorator" + // How a signature help was triggered. + // + // @since 3.15.0 + // Signature help was invoked manually by the user or by a command. + SigInvoked SignatureHelpTriggerKind = 1 + // Signature help was triggered by a trigger character. + SigTriggerCharacter SignatureHelpTriggerKind = 2 + // Signature help was triggered by the cursor moving or by the document content changing. + SigContentChange SignatureHelpTriggerKind = 3 + // A symbol kind. + File SymbolKind = 1 + Module SymbolKind = 2 + Namespace SymbolKind = 3 + Package SymbolKind = 4 + Class SymbolKind = 5 + Method SymbolKind = 6 + Property SymbolKind = 7 + Field SymbolKind = 8 + Constructor SymbolKind = 9 + Enum SymbolKind = 10 + Interface SymbolKind = 11 + Function SymbolKind = 12 + Variable SymbolKind = 13 + Constant SymbolKind = 14 + String SymbolKind = 15 + Number SymbolKind = 16 + Boolean SymbolKind = 17 + Array SymbolKind = 18 + Object SymbolKind = 19 + Key SymbolKind = 20 + Null SymbolKind = 21 + EnumMember SymbolKind = 22 + Struct SymbolKind = 23 + Event SymbolKind = 24 + Operator SymbolKind = 25 TypeParameter SymbolKind = 26 - - /*Empty defined: - * Empty kind. - */ - Empty CodeActionKind = "" - - /*QuickFix defined: - * Base kind for quickfix actions: 'quickfix' - */ - QuickFix CodeActionKind = "quickfix" - - /*Refactor defined: - * Base kind for refactoring actions: 'refactor' - */ - Refactor CodeActionKind = "refactor" - - /*RefactorExtract defined: - * Base kind for refactoring extraction actions: 'refactor.extract' - * - * Example extract actions: - * - * - Extract method - * - Extract function - * - Extract variable - * - Extract interface from class - * - ... - */ - RefactorExtract CodeActionKind = "refactor.extract" - - /*RefactorInline defined: - * Base kind for refactoring inline actions: 'refactor.inline' - * - * Example inline actions: - * - * - Inline function - * - Inline variable - * - Inline constant - * - ... - */ - RefactorInline CodeActionKind = "refactor.inline" - - /*RefactorRewrite defined: - * Base kind for refactoring rewrite actions: 'refactor.rewrite' - * - * Example rewrite actions: - * - * - Convert JavaScript function to class - * - Add or remove parameter - * - Encapsulate field - * - Make method static - * - Move method to base class - * - ... - */ - RefactorRewrite CodeActionKind = "refactor.rewrite" - - /*Source defined: - * Base kind for source actions: `source` - * - * Source code actions apply to the entire file. - */ - Source CodeActionKind = "source" - - /*SourceOrganizeImports defined: - * Base kind for an organize imports source action: `source.organizeImports` - */ - SourceOrganizeImports CodeActionKind = "source.organizeImports" - - /*Manual defined: - * Manually triggered, e.g. by the user pressing save, by starting debugging, - * or by an API call. - */ + // Symbol tags are extra annotations that tweak the rendering of a symbol. + // + // @since 3.16 + // Render a symbol as obsolete, usually using a strike-out. + DeprecatedSymbol SymbolTag = 1 + // Represents reasons why a text document is saved. + // Manually triggered, e.g. by the user pressing save, by starting debugging, + // or by an API call. Manual TextDocumentSaveReason = 1 - - /*AfterDelay defined: - * Automatic after a delay. - */ + // Automatic after a delay. AfterDelay TextDocumentSaveReason = 2 - - /*FocusOut defined: - * When the editor lost focus. - */ + // When the editor lost focus. FocusOut TextDocumentSaveReason = 3 - - // MessageWriteError is - MessageWriteError ErrorCodes = 1 - - // MessageReadError is - MessageReadError ErrorCodes = 2 - - // First is - First Touch = 1 - - // Last is - Last Touch = 2 - - // JSON is - JSON TraceFormat = "json" - - /*Closed defined: - * The connection is closed. - */ - Closed ConnectionErrors = 1 - - /*Disposed defined: - * The connection got disposed. - */ - Disposed ConnectionErrors = 2 - - /*AlreadyListening defined: - * The connection is already in listening mode. - */ - AlreadyListening ConnectionErrors = 3 - - // New is - New ConnectionState = 1 - - // Listening is - Listening ConnectionState = 2 + // Defines how the host (editor) should sync + // document changes to the language server. + // Documents should not be synced at all. + None TextDocumentSyncKind = 0 + // Documents are synced by always sending the full content + // of the document. + Full TextDocumentSyncKind = 1 + // Documents are synced by sending the full content on open. + // After that only incremental updates to the document are + // send. + Incremental TextDocumentSyncKind = 2 + Relative TokenFormat = "relative" + // Turn tracing off. + Off TraceValues = "off" + // Trace messages only. + Messages TraceValues = "messages" + // Verbose message tracing. + Verbose TraceValues = "verbose" + // Moniker uniqueness level to define scope of the moniker. + // + // @since 3.16.0 + // The moniker is only unique inside a document + Document UniquenessLevel = "document" + // The moniker is unique inside a project for which a dump got created + Project UniquenessLevel = "project" + // The moniker is unique inside the group to which a project belongs + Group UniquenessLevel = "group" + // The moniker is unique inside the moniker scheme. + Scheme UniquenessLevel = "scheme" + // The moniker is globally unique + Global UniquenessLevel = "global" + // Interested in create events. + WatchCreate WatchKind = 1 + // Interested in change events + WatchChange WatchKind = 2 + // Interested in delete events + WatchDelete WatchKind = 4 ) - -// DocumentFilter is a type -/** - * A document filter denotes a document by different properties like - * the [language](#TextDocument.languageId), the [scheme](#Uri.scheme) of - * its resource, or a glob-pattern that is applied to the [path](#TextDocument.fileName). - * - * Glob patterns can have the following syntax: - * - `*` to match one or more characters in a path segment - * - `?` to match on one character in a path segment - * - `**` to match any number of path segments, including none - * - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) - * - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) - * - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) - * - * @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }` - * @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }` - */ -type DocumentFilter = struct { - - /*Language defined: A language id, like `typescript`. */ - Language string `json:"language,omitempty"` - - /*Scheme defined: A Uri [scheme](#Uri.scheme), like `file` or `untitled`. */ - Scheme string `json:"scheme,omitempty"` - - /*Pattern defined: A glob pattern, like `*.{ts,js}`. */ - Pattern string `json:"pattern,omitempty"` -} - -// DocumentSelector is a type -/** - * A document selector is the combination of one or many document filters. - * - * @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`; - */ -type DocumentSelector = []DocumentFilter - -// DocumentURI is a type -/** - * A tagging type for string properties that are actually URIs. - */ -type DocumentURI = string - -// MarkedString is a type -/** - * MarkedString can be used to render human readable text. It is either a markdown string - * or a code-block that provides a language and a code snippet. The language identifier - * is semantically equal to the optional language identifier in fenced code blocks in GitHub - * issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting - * - * The pair of a language and a value is an equivalent to markdown: - * ```${language} - * ${value} - * ``` - * - * Note that markdown strings will be sanitized - that means html will be escaped. - * @deprecated use MarkupContent instead. - */ -type MarkedString = string - -// DefinitionLink is a type -/** - * Information about where a symbol is defined. - * - * Provides additional metadata over normal [location](#Location) definitions, including the range of - * the defining symbol - */ -type DefinitionLink = LocationLink - -// DeclarationLink is a type -/** - * Information about where a symbol is declared. - * - * Provides additional metadata over normal [location](#Location) declarations, including the range of - * the declaring symbol. - * - * Servers should prefer returning `DeclarationLink` over `Declaration` if supported - * by the client. - */ -type DeclarationLink = LocationLink - -// LSPMessageType is a type -/** - * A LSP Log Entry. - */ -type LSPMessageType = string - -// ProgressToken is a type -type ProgressToken = interface{} // number | string -// TraceValues is a type -type TraceValues = string - - -type WorkspaceSymbol struct { - /** - * The name of this symbol. - */ - Name string `json:"name"` - - /** - * The kind of this symbol. - */ - Kind SymbolKind `json:"kind"` - - Location Location `json:"location"` -} \ No newline at end of file diff --git a/provider/internal/java/filter.go b/provider/internal/java/filter.go index 36080b51..b52b8394 100644 --- a/provider/internal/java/filter.go +++ b/provider/internal/java/filter.go @@ -124,12 +124,27 @@ func (p *javaServiceClient) filterConstructorSymbols(ctx context.Context, symbol } func (p *javaServiceClient) convertToIncidentContext(symbol protocol.WorkspaceSymbol) (provider.IncidentContext, error) { - u, err := p.getURI(symbol.Location.URI) + var locationURI protocol.DocumentURI + var locationRange protocol.Range + switch x := symbol.Location.Value.(type) { + case protocol.Location: + locationURI = x.URI + locationRange = x.Range + case protocol.PLocationMsg_workspace_symbol: + locationURI = x.URI + locationRange = protocol.Range{} + default: + locationURI = "" + locationRange = protocol.Range{} + } + + u, err := p.getURI(locationURI) if err != nil { return provider.IncidentContext{}, err } - lineNumber := int(symbol.Location.Range.Start.Line) + 1 + lineNumber := int(locationRange.Start.Line) + 1 + incident := provider.IncidentContext{ FileURI: u, LineNumber: &lineNumber, @@ -140,17 +155,17 @@ func (p *javaServiceClient) convertToIncidentContext(symbol protocol.WorkspaceSy FILE_KEY: u, }, } - if symbol.Location.Range.Start.Line == 0 && symbol.Location.Range.Start.Character == 0 && symbol.Location.Range.End.Line == 0 && symbol.Location.Range.End.Character == 0 { + if locationRange.Start.Line == 0 && locationRange.Start.Character == 0 && locationRange.End.Line == 0 && locationRange.End.Character == 0 { return incident, nil } incident.CodeLocation = &provider.Location{ StartPosition: provider.Position{ - Line: symbol.Location.Range.Start.Line, - Character: symbol.Location.Range.Start.Character, + Line: float64(locationRange.Start.Line), + Character: float64(locationRange.Start.Character), }, EndPosition: provider.Position{ - Line: symbol.Location.Range.End.Line, - Character: symbol.Location.Range.End.Character, + Line: float64(locationRange.End.Line), + Character: float64(locationRange.End.Character), }, } return incident, nil @@ -176,12 +191,12 @@ func (p *javaServiceClient) convertSymbolRefToIncidentContext(symbol protocol.Wo incident.CodeLocation = &provider.Location{ StartPosition: provider.Position{ - Line: ref.Range.Start.Line, - Character: ref.Range.Start.Character, + Line: float64(ref.Range.Start.Line), + Character: float64(ref.Range.Start.Character), }, EndPosition: provider.Position{ - Line: ref.Range.End.Line, - Character: ref.Range.End.Character, + Line: float64(ref.Range.End.Line), + Character: float64(ref.Range.End.Character), }, } lineNumber := int(ref.Range.Start.Line) + 1 diff --git a/provider/internal/java/service_client.go b/provider/internal/java/service_client.go index 15045196..05d08305 100644 --- a/provider/internal/java/service_client.go +++ b/provider/internal/java/service_client.go @@ -2,6 +2,7 @@ package java import ( "context" + "encoding/json" "fmt" "os/exec" "path/filepath" @@ -98,16 +99,19 @@ func (p *javaServiceClient) GetAllSymbols(ctx context.Context, query, location s // This command will run the added bundle to the language server. The command over the wire needs too look like this. // in this case the project is hardcoded in the init of the Langauge Server above // workspace/executeCommand '{"command": "io.konveyor.tackle.ruleEntry", "arguments": {"query":"*customresourcedefinition","project": "java"}}' - arguments := map[string]string{ + argumentsMap := map[string]string{ "query": query, "project": "java", "location": fmt.Sprintf("%v", locationToCode[strings.ToLower(location)]), "analysisMode": string(p.config.AnalysisMode), } + argumentsBytes, _ := json.Marshal(argumentsMap) + arguments := []json.RawMessage{argumentsBytes} + wsp := &protocol.ExecuteCommandParams{ Command: "io.konveyor.tackle.ruleEntry", - Arguments: []interface{}{arguments}, + Arguments: arguments, } var refs []protocol.WorkspaceSymbol @@ -120,20 +124,34 @@ func (p *javaServiceClient) GetAllSymbols(ctx context.Context, query, location s } func (p *javaServiceClient) GetAllReferences(ctx context.Context, symbol protocol.WorkspaceSymbol) []protocol.Location { - if strings.Contains(symbol.Location.URI, FILE_URI_PREFIX) { + var locationURI protocol.DocumentURI + var locationRange protocol.Range + switch x := symbol.Location.Value.(type) { + case protocol.Location: + locationURI = x.URI + locationRange = x.Range + case protocol.PLocationMsg_workspace_symbol: + locationURI = x.URI + locationRange = protocol.Range{} + default: + locationURI = "" + locationRange = protocol.Range{} + } + + if strings.Contains(locationURI, FILE_URI_PREFIX) { return []protocol.Location{ { - URI: symbol.Location.URI, - Range: symbol.Location.Range, + URI: locationURI, + Range: locationRange, }, } } params := &protocol.ReferenceParams{ TextDocumentPositionParams: protocol.TextDocumentPositionParams{ TextDocument: protocol.TextDocumentIdentifier{ - URI: symbol.Location.URI, + URI: locationURI, }, - Position: symbol.Location.Range.Start, + Position: locationRange.Start, }, } @@ -172,27 +190,26 @@ func (p *javaServiceClient) initialization(ctx context.Context) { downloadSources = false } - params := &protocol.InitializeParams{ - //TODO(shawn-hurley): add ability to parse path to URI in a real supported way - RootURI: fmt.Sprintf("file://%v", absLocation), - Capabilities: protocol.ClientCapabilities{}, - ExtendedClientCapilities: map[string]interface{}{ - "classFileContentsSupport": true, - }, - InitializationOptions: map[string]interface{}{ - "bundles": absBundles, - "workspaceFolders": []string{fmt.Sprintf("file://%v", absLocation)}, - "settings": map[string]interface{}{ - "java": map[string]interface{}{ - "configuration": map[string]interface{}{ - "maven": map[string]interface{}{ - "userSettings": p.mvnSettingsFile, - }, - }, + //TODO(shawn-hurley): add ability to parse path to URI in a real supported way + params := &protocol.InitializeParams{} + params.RootURI = fmt.Sprintf("file://%v", absLocation) + params.Capabilities = protocol.ClientCapabilities{} + params.ExtendedClientCapilities = map[string]interface{}{ + "classFileContentsSupport": true, + } + params.InitializationOptions = map[string]interface{}{ + "bundles": absBundles, + "workspaceFolders": []string{fmt.Sprintf("file://%v", absLocation)}, + "settings": map[string]interface{}{ + "java": map[string]interface{}{ + "configuration": map[string]interface{}{ "maven": map[string]interface{}{ - "downloadSources": downloadSources, + "userSettings": p.mvnSettingsFile, }, }, + "maven": map[string]interface{}{ + "downloadSources": downloadSources, + }, }, }, } diff --git a/rule-example.yaml b/rule-example.yaml index 9d4a3dbc..a2ac341f 100644 --- a/rule-example.yaml +++ b/rule-example.yaml @@ -43,12 +43,12 @@ pattern: "*apiextensions.v1beta1.CustomResourceDefinition*" location: TYPE - go.referenced: - pattern: ".*v1beta1.CustomResourceDefinition" + pattern: "v1beta1.CustomResourceDefinition" - message: 'golang apiextensions/v1/customresourcedefinitions found {{file}}:{{lineNumber}}' ruleID: go-lang-ref-001 when: go.referenced: - pattern: ".*v1beta1.CustomResourceDefinition" + pattern: "v1beta1.CustomResourceDefinition" - message: testing nested conditions ruleID: lang-ref-002 when: