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
|
package lsp
import "fmt"
type Position struct {
/**
* Line position in a document (zero-based).
*/
Line int `json:"line"`
/**
* Character offset on a line in a document (zero-based).
*/
Character int `json:"character"`
}
func (p Position) String() string {
return fmt.Sprintf("%d:%d", p.Line, p.Character)
}
type Range struct {
/**
* The range's start position.
*/
Start Position `json:"start"`
/**
* The range's end position.
*/
End Position `json:"end"`
}
func (r Range) String() string {
return fmt.Sprintf("%s-%s", r.Start, r.End)
}
type Location struct {
URI DocumentURI `json:"uri"`
Range Range `json:"range"`
}
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. Can be omitted.
*/
Code string `json:"code,omitempty"`
/**
* A human-readable string describing the source of this
* diagnostic, e.g. 'typescript' or 'super lint'.
*/
Source string `json:"source,omitempty"`
/**
* The diagnostic's message.
*/
Message string `json:"message"`
}
type DiagnosticSeverity int
const (
Error DiagnosticSeverity = 1
Warning = 2
Information = 3
Hint = 4
)
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 []interface{} `json:"arguments"`
}
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 WorkspaceEdit struct {
/**
* Holds changes to existing resources.
*/
Changes map[string][]TextEdit `json:"changes"`
}
type TextDocumentIdentifier struct {
/**
* The text document's URI.
*/
URI DocumentURI `json:"uri"`
}
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 strictly increase after each
* change, including undo/redo).
*/
Version int `json:"version"`
/**
* The content of the opened text document.
*/
Text string `json:"text"`
}
type VersionedTextDocumentIdentifier struct {
TextDocumentIdentifier
/**
* The version number of this document.
*/
Version int `json:"version"`
}
type TextDocumentPositionParams struct {
/**
* The text document.
*/
TextDocument TextDocumentIdentifier `json:"textDocument"`
/**
* The position inside the text document.
*/
Position Position `json:"position"`
}
|