-
Notifications
You must be signed in to change notification settings - Fork 20
/
lsp.go
112 lines (91 loc) · 3.28 KB
/
lsp.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
package main
type DocumentURI string
type InitializeParams struct {
RootURI string `json:"rootUri,omitempty"`
InitializationOptions InitializationOptions `json:"initializationOptions,omitempty"`
}
type InitializationOptions struct {
Command []string
}
type InitializeResult struct {
Capabilities ServerCapabilities `json:"capabilities,omitempty"`
}
type TextDocumentSyncKind int
//nolint:unused,deadcode
const (
TDSKNone TextDocumentSyncKind = iota
TDSKFull
TDSKIncremental
)
type CompletionProvider struct {
ResolveProvider bool `json:"resolveProvider,omitempty"`
TriggerCharacters []string `json:"triggerCharacters"`
}
type TextDocumentSyncOptions struct {
OpenClose bool `json:"openClose,omitempty"`
Change TextDocumentSyncKind `json:"change,omitempty"`
WillSave bool `json:"willSave,omitempty"`
WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
Save bool `json:"save,omitempty"`
}
type ServerCapabilities struct {
TextDocumentSync TextDocumentSyncOptions `json:"textDocumentSync,omitempty"`
CompletionProvider *CompletionProvider `json:"completionProvider,omitempty"`
DocumentSymbolProvider bool `json:"documentSymbolProvider,omitempty"`
DefinitionProvider bool `json:"definitionProvider,omitempty"`
DocumentFormattingProvider bool `json:"documentFormattingProvider,omitempty"`
HoverProvider bool `json:"hoverProvider,omitempty"`
CodeActionProvider bool `json:"codeActionProvider,omitempty"`
}
type TextDocumentItem struct {
URI DocumentURI `json:"uri"`
LanguageID string `json:"languageId"`
Version int `json:"version"`
Text string `json:"text"`
}
type TextDocumentIdentifier struct {
URI DocumentURI `json:"uri"`
}
type DidOpenTextDocumentParams struct {
TextDocument TextDocumentItem `json:"textDocument"`
}
type DidSaveTextDocumentParams struct {
Text *string `json:"text"`
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
type Location struct {
URI string `json:"uri"`
Range Range `json:"range"`
}
type Range struct {
Start Position `json:"start"`
End Position `json:"end"`
}
type Position struct {
Line int `json:"line"`
Character int `json:"character"`
}
type DiagnosticRelatedInformation struct {
Location Location `json:"location"`
Message string `json:"message"`
}
type DiagnosticSeverity int
//nolint:unused,deadcode
const (
DSError DiagnosticSeverity = iota + 1
DSWarning
DSInformation
DSHint
)
type Diagnostic struct {
Range Range `json:"range"`
Severity DiagnosticSeverity `json:"severity,omitempty"`
Code *string `json:"code,omitempty"`
Source *string `json:"source,omitempty"`
Message string `json:"message"`
RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"`
}
type PublishDiagnosticsParams struct {
URI DocumentURI `json:"uri"`
Diagnostics []Diagnostic `json:"diagnostics"`
}