-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extension: Importers View and separate LSP protocol package (#8747)
- Loading branch information
Showing
24 changed files
with
690 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
// @flow | ||
declare module 'vscode-languageserver' { | ||
declare export opaque type ODiagnosticTag; | ||
declare export opaque type ODiagnosticSeverity; | ||
|
||
/** | ||
* The diagnostic tags. | ||
* | ||
* @since 3.15.0 | ||
*/ | ||
declare export var DiagnosticTag: {| | ||
/** | ||
* Unused or unnecessary code. | ||
* | ||
* Clients are allowed to render diagnostics with this tag faded out instead of having | ||
* an error squiggle. | ||
*/ | ||
Unnecessary: ODiagnosticTag, | ||
/** | ||
* Deprecated or obsolete code. | ||
* | ||
* Clients are allowed to rendered diagnostics with this tag strike through. | ||
*/ | ||
Deprecated: ODiagnosticTag, | ||
|}; | ||
|
||
/** | ||
* The diagnostic's severity. | ||
*/ | ||
declare export var DiagnosticSeverity: {| | ||
/** | ||
* Reports an error. | ||
*/ | ||
Error: ODiagnosticSeverity, | ||
/** | ||
* Reports a warning. | ||
*/ | ||
Warning: ODiagnosticSeverity, | ||
/** | ||
* Reports an information. | ||
*/ | ||
Information: ODiagnosticSeverity, | ||
/** | ||
* Reports a hint. | ||
*/ | ||
Hint: ODiagnosticSeverity, | ||
|}; | ||
|
||
declare export type DocumentUri = string; | ||
|
||
/** | ||
* A literal to identify a text document in the client. | ||
*/ | ||
declare export type TextDocumentIdentifier = {| | ||
uri: DocumentUri, | ||
|}; | ||
|
||
/** | ||
* Position in a text document expressed as zero-based line and character | ||
* offset. Prior to 3.17 the offsets were always based on a UTF-16 string | ||
* representation. So a string of the form `a𐐀b` the character offset of the | ||
* character `a` is 0, the character offset of `𐐀` is 1 and the character | ||
* offset of b is 3 since `𐐀` is represented using two code units in UTF-16. | ||
* Since 3.17 clients and servers can agree on a different string encoding | ||
* representation (e.g. UTF-8). The client announces it's supported encoding | ||
* via the client capability [`general.positionEncodings`](#clientCapabilities). | ||
* The value is an array of position encodings the client supports, with | ||
* decreasing preference (e.g. the encoding at index `0` is the most preferred | ||
* one). To stay backwards compatible the only mandatory encoding is UTF-16 | ||
* represented via the string `utf-16`. The server can pick one of the | ||
* encodings offered by the client and signals that encoding back to the | ||
* client via the initialize result's property | ||
* [`capabilities.positionEncoding`](#serverCapabilities). If the string value | ||
* `utf-16` is missing from the client's capability `general.positionEncodings` | ||
* servers can safely assume that the client supports UTF-16. If the server | ||
* omits the position encoding in its initialize result the encoding defaults | ||
* to the string value `utf-16`. Implementation considerations: since the | ||
* conversion from one encoding into another requires the content of the | ||
* file / line the conversion is best done where the file is read which is | ||
* usually on the server side. | ||
* | ||
* Positions are line end character agnostic. So you can not specify a position | ||
* that denotes `\r|\n` or `\n|` where `|` represents the character offset. | ||
* | ||
* @since 3.17.0 - support for negotiated position encoding. | ||
*/ | ||
declare export type Position = {|line: number, character: number|}; | ||
|
||
/** | ||
* A range in a text document expressed as (zero-based) start and end positions. | ||
* | ||
* If you want to specify a range that contains a line including the line ending | ||
* character(s) then use an end position denoting the start of the next line. | ||
* For example: | ||
* ```ts | ||
* { | ||
* start: { line: 5, character: 23 } | ||
* end : { line 6, character : 0 } | ||
* } | ||
* ``` | ||
*/ | ||
declare export type Range = {|start: Position, end: Position|}; | ||
|
||
/** | ||
* Structure to capture a description for an error code. | ||
* | ||
* @since 3.16.0 | ||
*/ | ||
declare export type CodeDescription = {|href: string|}; | ||
|
||
/** | ||
* Represents a location inside a resource, such as a line | ||
* inside a text file. | ||
*/ | ||
declare export type Location = {|uri: string, range: Range|}; | ||
|
||
/** | ||
* The DiagnosticRelatedInformation namespace provides helper functions to work with | ||
* [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals. | ||
*/ | ||
declare export type DiagnosticRelatedInformation = {| | ||
location: Location, | ||
message: string, | ||
|}; | ||
|
||
/** | ||
* Represents a diagnostic, such as a compiler error or warning. Diagnostic objects | ||
* are only valid in the scope of a resource. | ||
*/ | ||
declare export type Diagnostic = {| | ||
range: Range, | ||
severity?: ODiagnosticSeverity, | ||
code?: number | string, | ||
codeDescription?: CodeDescription, | ||
source?: string, | ||
message: string, | ||
tags?: ODiagnosticTag[], | ||
relatedInformation?: DiagnosticRelatedInformation[], | ||
data?: mixed, | ||
|}; | ||
|
||
/** | ||
* A parameter literal used in requests to pass a text document and a position inside that | ||
* document. | ||
*/ | ||
declare export type TextDocumentPositionParams = { | ||
textDocument: TextDocumentIdentifier, | ||
position: Position, | ||
... | ||
}; | ||
|
||
/** | ||
* Represents the connection of two locations. Provides additional metadata over normal [locations](#Location), | ||
* including an origin range. | ||
*/ | ||
declare export type LocationLink = {| | ||
/** | ||
* Span of the origin of this link. | ||
* | ||
* Used as the underlined span for mouse interaction. Defaults to the word range at | ||
* the definition position. | ||
*/ | ||
originSelectionRange?: Range, | ||
/** | ||
* The target resource identifier of this link. | ||
*/ | ||
targetUri: DocumentUri, | ||
/** | ||
* The full target range of this link. If the target for example is a symbol then target range is the | ||
* range enclosing this symbol not including leading/trailing whitespace but everything else | ||
* like comments. This information is typically used to highlight the range in the editor. | ||
*/ | ||
targetRange: Range, | ||
/** | ||
* The range that should be selected and revealed when this link is being followed, e.g the name of a function. | ||
* Must be contained by the `targetRange`. See also `DocumentSymbol#range` | ||
*/ | ||
targetSelectionRange: Range, | ||
|}; | ||
|
||
/** | ||
* Information about where a symbol is defined. | ||
* | ||
* Provides additional metadata over normal [location](#Location) definitions, including the range of | ||
* the defining symbol | ||
*/ | ||
declare export type DefinitionLink = LocationLink; | ||
} |
Oops, something went wrong.