github.com/tiagovtristao/plz@v13.4.0+incompatible/tools/build_langserver/lsp/specs.go (about) 1 package lsp 2 3 // EOL is a list of options for end of line characters 4 var EOL = []string{"\n", "\r\n", "\r"} 5 6 // DocumentURI is the uri representation of the filepath, usually prefixed with "files://" 7 type DocumentURI string 8 9 // RequestCancelled is an error code specific to language server protocol 10 // it is been used when the requests returns an error response on cancellation 11 const RequestCancelled int64 = -32800 12 13 // Position is the position in a text document expressed as zero-based line and zero-based character offset 14 type Position struct { 15 /** 16 * Line position in a document (zero-based). 17 */ 18 Line int `json:"line"` 19 20 /** 21 * Character offset on a line in a document (zero-based). 22 */ 23 Character int `json:"character"` 24 } 25 26 // Range is A range in a text document expressed as (zero-based) start and end positions. 27 // A range is comparable to a selection in an editor 28 type Range struct { 29 /** 30 * The range's start position. 31 */ 32 Start Position `json:"start"` 33 34 /** 35 * The range's end position. 36 */ 37 End Position `json:"end"` 38 } 39 40 // Location represents a location inside a resource, such as a line inside a text file. 41 type Location struct { 42 URI DocumentURI `json:"uri"` 43 Range Range `json:"range"` 44 } 45 46 // Diagnostic represents a diagnostic, such as a compiler error or warning. 47 // Diagnostic objects are only valid in the scope of a resource. 48 type Diagnostic struct { 49 /** 50 * The range at which the message applies. 51 */ 52 Range Range `json:"range"` 53 54 /** 55 * The diagnostic's severity. Can be omitted. If omitted it is up to the 56 * client to interpret diagnostics as error, warning, info or hint. 57 */ 58 Severity DiagnosticSeverity `json:"severity,omitempty"` 59 60 /** 61 * The diagnostic's code. Can be omitted. 62 */ 63 Code string `json:"code,omitempty"` 64 65 /** 66 * A human-readable string describing the source of this 67 * diagnostic, e.g. 'typescript' or 'super lint'. 68 */ 69 Source string `json:"source,omitempty"` 70 71 /** 72 * The diagnostic's message. 73 */ 74 Message string `json:"message"` 75 76 /** 77 * An array of related diagnostic information, e.g. when symbol-names within 78 * a scope collide all definitions can be marked via this property. 79 */ 80 RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation"` 81 } 82 83 // DiagnosticRelatedInformation represents a related message and source code location for a diagnostic. This should be 84 // used to point to code locations that cause or related to a diagnostics, e.g when duplicating 85 // a symbol in a scope. 86 type DiagnosticRelatedInformation struct { 87 /** 88 * The location of this related diagnostic information. 89 */ 90 Location Location `json:"location"` 91 92 /** 93 * The message of this related diagnostic information. 94 */ 95 Message string `json:"message"` 96 } 97 98 // Command Represents a reference to a command. 99 // Provides a title which will be used to represent a command in the UI. 100 // Commands are identified by a string identifier. 101 type Command struct { 102 /** 103 * Title of the command, like `save`. 104 */ 105 Title string `json:"title"` 106 107 /** 108 * The identifier of the actual command handler. 109 */ 110 Command string `json:"command"` 111 112 /** 113 * Arguments that the command handler should be 114 * invoked with. 115 */ 116 Arguments []interface{} `json:"arguments"` 117 } 118 119 // MarkedString can be used to render human readable text. 120 // TODO(bnmetrics): this might not be needed anymore 121 type MarkedString struct { 122 Language string `json:"language"` 123 Value string `json:"value"` 124 } 125 126 // MarkupContent represents a string value which content can be represented in different formats. 127 type MarkupContent struct { 128 Kind MarkupKind `json:"kind"` 129 Value string `json:"value"` 130 } 131 132 // MarkupKind Describes the content type that a client supports in various result literals 133 // like `Hover`, `ParameterInfo` or `CompletionItem`. 134 // `MarkupKinds` must not start with a `$` 135 type MarkupKind string 136 137 // Two types of MarkupKind 138 const ( 139 PlainText MarkupKind = "plaintext" 140 MarkDown MarkupKind = "markdown" 141 ) 142 143 // DocumentFilter denotes a document through properties like language, scheme or pattern. 144 // TODO: not sure this is useful...As I think this has to do with specific languages on the list 145 type DocumentFilter struct { 146 }