-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
general.go
461 lines (385 loc) · 14 KB
/
general.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
// SPDX-FileCopyrightText: 2019 The Go Language Server Authors
// SPDX-License-Identifier: BSD-3-Clause
package protocol
// TraceValue represents a InitializeParams Trace mode.
type TraceValue string
// list of TraceValue.
const (
// TraceOff disable tracing.
TraceOff TraceValue = "off"
// TraceMessage normal tracing mode.
TraceMessage TraceValue = "message"
// TraceVerbose verbose tracing mode.
TraceVerbose TraceValue = "verbose"
)
// ClientInfo information about the client.
//
// @since 3.15.0.
type ClientInfo struct {
// Name is the name of the client as defined by the client.
Name string `json:"name"`
// Version is the client's version as defined by the client.
Version string `json:"version,omitempty"`
}
// InitializeParams params of Initialize request.
type InitializeParams struct {
WorkDoneProgressParams
// ProcessID is 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 (see exit notification) its process.
ProcessID int32 `json:"processId"`
// ClientInfo is the information about the client.
//
// @since 3.15.0
ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
// Locale is 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"`
// RootPath is the rootPath of the workspace. Is null
// if no folder is open.
//
// Deprecated: Use RootURI instead.
RootPath string `json:"rootPath,omitempty"`
// RootURI is the rootUri of the workspace. Is null if no
// folder is open. If both `rootPath` and "rootUri" are set
// "rootUri" wins.
//
// Deprecated: Use WorkspaceFolders instead.
RootURI DocumentURI `json:"rootUri,omitempty"`
// InitializationOptions user provided initialization options.
InitializationOptions interface{} `json:"initializationOptions,omitempty"`
// Capabilities is the capabilities provided by the client (editor or tool)
Capabilities ClientCapabilities `json:"capabilities"`
// Trace is the initial trace setting. If omitted trace is disabled ('off').
Trace TraceValue `json:"trace,omitempty"`
// WorkspaceFolders is 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"`
}
// InitializeResult result of ClientCapabilities.
type InitializeResult struct {
// Capabilities is the capabilities the language server provides.
Capabilities ServerCapabilities `json:"capabilities"`
// ServerInfo Information about the server.
//
// @since 3.15.0.
ServerInfo *ServerInfo `json:"serverInfo,omitempty"`
}
// LogTraceParams params of LogTrace notification.
//
// @since 3.16.0.
type LogTraceParams struct {
// Message is the message to be logged.
Message string `json:"message"`
// Verbose is the additional information that can be computed if the "trace" configuration
// is set to "verbose".
Verbose TraceValue `json:"verbose,omitempty"`
}
// SetTraceParams params of SetTrace notification.
//
// @since 3.16.0.
type SetTraceParams struct {
// Value is the new value that should be assigned to the trace setting.
Value TraceValue `json:"value"`
}
// FileOperationPatternKind is a pattern kind describing if a glob pattern matches a file a folder or
// both.
//
// @since 3.16.0.
type FileOperationPatternKind string
// list of FileOperationPatternKind.
const (
// FileOperationPatternKindFile is the pattern matches a file only.
FileOperationPatternKindFile FileOperationPatternKind = "file"
// FileOperationPatternKindFolder is the pattern matches a folder only.
FileOperationPatternKindFolder FileOperationPatternKind = "folder"
)
// FileOperationPatternOptions matching options for the file operation pattern.
//
// @since 3.16.0.
type FileOperationPatternOptions struct {
// IgnoreCase is The pattern should be matched ignoring casing.
IgnoreCase bool `json:"ignoreCase,omitempty"`
}
// FileOperationPattern a pattern to describe in which file operation requests or notifications
// the server is interested in.
//
// @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 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`)
Glob string `json:"glob"`
// Matches whether to match files or folders with this pattern.
//
// Matches both if undefined.
Matches FileOperationPatternKind `json:"matches,omitempty"`
// Options additional options used during matching.
Options FileOperationPatternOptions `json:"options,omitempty"`
}
// FileOperationFilter is a filter to describe in which file operation requests or notifications
// the server is interested in.
//
// @since 3.16.0.
type FileOperationFilter struct {
// Scheme is a URI like "file" or "untitled".
Scheme string `json:"scheme,omitempty"`
// Pattern is the actual file operation pattern.
Pattern FileOperationPattern `json:"pattern"`
}
// CreateFilesParams is the parameters sent in notifications/requests for user-initiated creation
// of files.
//
// @since 3.16.0.
type CreateFilesParams struct {
// Files an array of all files/folders created in this operation.
Files []FileCreate `json:"files"`
}
// FileCreate nepresents information on a file/folder create.
//
// @since 3.16.0.
type FileCreate struct {
// URI is a file:// URI for the location of the file/folder being created.
URI string `json:"uri"`
}
// RenameFilesParams is the parameters sent in notifications/requests for user-initiated renames
// of files.
//
// @since 3.16.0.
type RenameFilesParams struct {
// Files 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"`
}
// FileRename represents information on a file/folder rename.
//
// @since 3.16.0.
type FileRename struct {
// OldURI is a file:// URI for the original location of the file/folder being renamed.
OldURI string `json:"oldUri"`
// NewURI is a file:// URI for the new location of the file/folder being renamed.
NewURI string `json:"newUri"`
}
// DeleteFilesParams is the parameters sent in notifications/requests for user-initiated deletes
// of files.
//
// @since 3.16.0.
type DeleteFilesParams struct {
// Files an array of all files/folders deleted in this operation.
Files []FileDelete `json:"files"`
}
// FileDelete represents information on a file/folder delete.
//
// @since 3.16.0.
type FileDelete struct {
// URI is a file:// URI for the location of the file/folder being deleted.
URI string `json:"uri"`
}
// DocumentHighlightParams params of DocumentHighlight request.
//
// @since 3.15.0.
type DocumentHighlightParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// DeclarationParams params of Declaration request.
//
// @since 3.15.0.
type DeclarationParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// DefinitionParams params of Definition request.
//
// @since 3.15.0.
type DefinitionParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// TypeDefinitionParams params of TypeDefinition request.
//
// @since 3.15.0.
type TypeDefinitionParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// ImplementationParams params of Implementation request.
//
// @since 3.15.0.
type ImplementationParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// ShowDocumentParams params to show a document.
//
// @since 3.16.0.
type ShowDocumentParams struct {
// URI is the document uri to show.
URI URI `json:"uri"`
// External 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"`
// TakeFocus 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"`
// Selection 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"`
}
// ShowDocumentResult is the result of an show document request.
//
// @since 3.16.0.
type ShowDocumentResult struct {
// Success a boolean indicating if the show was successful.
Success bool `json:"success"`
}
// ServerInfo Information about the server.
//
// @since 3.15.0.
type ServerInfo struct {
// Name is the name of the server as defined by the server.
Name string `json:"name"`
// Version is the server's version as defined by the server.
Version string `json:"version,omitempty"`
}
// InitializeError known error codes for an "InitializeError".
type InitializeError struct {
// Retry 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,omitempty"`
}
// ReferencesOptions ReferencesProvider options.
//
// @since 3.15.0.
type ReferencesOptions struct {
WorkDoneProgressOptions
}
// WorkDoneProgressOptions WorkDoneProgress options.
//
// @since 3.15.0.
type WorkDoneProgressOptions struct {
WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
}
// LinkedEditingRangeParams params for the LinkedEditingRange request.
//
// @since 3.16.0.
type LinkedEditingRangeParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
}
// LinkedEditingRanges result of LinkedEditingRange request.
//
// @since 3.16.0.
type LinkedEditingRanges struct {
// Ranges a list of ranges that can be renamed together.
//
// The ranges must have identical length and contain identical text content.
//
// The ranges cannot overlap.
Ranges []Range `json:"ranges"`
// WordPattern 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"`
}
// MonikerParams params for the Moniker request.
//
// @since 3.16.0.
type MonikerParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// UniquenessLevel is the Moniker uniqueness level to define scope of the moniker.
//
// @since 3.16.0.
type UniquenessLevel string
// list of UniquenessLevel.
const (
// UniquenessLevelDocument is the moniker is only unique inside a document.
UniquenessLevelDocument UniquenessLevel = "document"
// UniquenessLevelProject is the moniker is unique inside a project for which a dump got created.
UniquenessLevelProject UniquenessLevel = "project"
// UniquenessLevelGroup is the moniker is unique inside the group to which a project belongs.
UniquenessLevelGroup UniquenessLevel = "group"
// UniquenessLevelScheme is the moniker is unique inside the moniker scheme.
UniquenessLevelScheme UniquenessLevel = "scheme"
// UniquenessLevelGlobal is the moniker is globally unique.
UniquenessLevelGlobal UniquenessLevel = "global"
)
// MonikerKind is the moniker kind.
//
// @since 3.16.0.
type MonikerKind string
// list of MonikerKind.
const (
// MonikerKindImport is the moniker represent a symbol that is imported into a project.
MonikerKindImport MonikerKind = "import"
// MonikerKindExport is the moniker represents a symbol that is exported from a project.
MonikerKindExport MonikerKind = "export"
// MonikerKindLocal is 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, ...).
MonikerKindLocal MonikerKind = "local"
)
// Moniker definition to match LSIF 0.5 moniker definition.
//
// @since 3.16.0.
type Moniker struct {
// Scheme is the scheme of the moniker. For example tsc or .Net.
Scheme string `json:"scheme"`
// Identifier is 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"`
// Unique is the scope in which the moniker is unique.
Unique UniquenessLevel `json:"unique"`
// Kind is the moniker kind if known.
Kind MonikerKind `json:"kind,omitempty"`
}
// StaticRegistrationOptions staticRegistration options to be returned in the initialize request.
type StaticRegistrationOptions struct {
// ID is 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"`
}
// DocumentLinkRegistrationOptions DocumentLinkRegistration options.
type DocumentLinkRegistrationOptions struct {
TextDocumentRegistrationOptions
// ResolveProvider document links have a resolve provider as well.
ResolveProvider bool `json:"resolveProvider,omitempty"`
}
// InitializedParams params of Initialized notification.
type InitializedParams struct{}
// WorkspaceFolders represents a slice of WorkspaceFolder.
type WorkspaceFolders []WorkspaceFolder