| 1 |
package lsp |
| 2 |
|
| 3 |
import "fmt" |
| 4 |
|
| 5 |
type Position struct { |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
Line int `json:"line"` |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
Character int `json:"character"` |
| 15 |
} |
| 16 |
|
| 17 |
func (p Position) String() string { |
| 18 |
return fmt.Sprintf("%d:%d", p.Line, p.Character) |
| 19 |
} |
| 20 |
|
| 21 |
type Range struct { |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
Start Position `json:"start"` |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
End Position `json:"end"` |
| 31 |
} |
| 32 |
|
| 33 |
func (r Range) String() string { |
| 34 |
return fmt.Sprintf("%s-%s", r.Start, r.End) |
| 35 |
} |
| 36 |
|
| 37 |
type Location struct { |
| 38 |
URI DocumentURI `json:"uri"` |
| 39 |
Range Range `json:"range"` |
| 40 |
} |
| 41 |
|
| 42 |
type Diagnostic struct { |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
Range Range `json:"range"` |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
Severity DiagnosticSeverity `json:"severity,omitempty"` |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
Code string `json:"code,omitempty"` |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
Source string `json:"source,omitempty"` |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
Message string `json:"message"` |
| 69 |
} |
| 70 |
|
| 71 |
type DiagnosticSeverity int |
| 72 |
|
| 73 |
const ( |
| 74 |
Error DiagnosticSeverity = 1 |
| 75 |
Warning = 2 |
| 76 |
Information = 3 |
| 77 |
Hint = 4 |
| 78 |
) |
| 79 |
|
| 80 |
type Command struct { |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
Title string `json:"title"` |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
Command string `json:"command"` |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
Arguments []interface{} `json:"arguments"` |
| 94 |
} |
| 95 |
|
| 96 |
type TextEdit struct { |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
Range Range `json:"range"` |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
NewText string `json:"newText"` |
| 108 |
} |
| 109 |
|
| 110 |
type WorkspaceEdit struct { |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
Changes map[string][]TextEdit `json:"changes"` |
| 115 |
} |
| 116 |
|
| 117 |
type TextDocumentIdentifier struct { |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
URI DocumentURI `json:"uri"` |
| 122 |
} |
| 123 |
|
| 124 |
type TextDocumentItem struct { |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
URI DocumentURI `json:"uri"` |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
LanguageID string `json:"languageId"` |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
Version int `json:"version"` |
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
Text string `json:"text"` |
| 145 |
} |
| 146 |
|
| 147 |
type VersionedTextDocumentIdentifier struct { |
| 148 |
TextDocumentIdentifier |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
Version int `json:"version"` |
| 153 |
} |
| 154 |
|
| 155 |
type TextDocumentPositionParams struct { |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
TextDocument TextDocumentIdentifier `json:"textDocument"` |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
Position Position `json:"position"` |
| 165 |
} |