massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-go / node_modules / vscode-languageserver-textdocument / lib / umd / main.d.ts
1 /**
2  * A tagging type for string properties that are actually URIs.
3  */
4 export declare type DocumentUri = string;
5 /**
6  * Position in a text document expressed as zero-based line and character offset.
7  * The offsets are based on a UTF-16 string representation. So a string of the form
8  * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`
9  * is 1 and the character offset of b is 3 since `𐐀` is represented using two code
10  * units in UTF-16.
11  *
12  * Positions are line end character agnostic. So you can not specify a position that
13  * denotes `\r|\n` or `\n|` where `|` represents the character offset.
14  */
15 export interface Position {
16     /**
17      * Line position in a document (zero-based).
18      * If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
19      * If a line number is negative, it defaults to 0.
20      */
21     line: number;
22     /**
23      * Character offset on a line in a document (zero-based). Assuming that the line is
24      * represented as a string, the `character` value represents the gap between the
25      * `character` and `character + 1`.
26      *
27      * If the character value is greater than the line length it defaults back to the
28      * line length.
29      * If a line number is negative, it defaults to 0.
30      */
31     character: number;
32 }
33 /**
34  * A range in a text document expressed as (zero-based) start and end positions.
35  *
36  * If you want to specify a range that contains a line including the line ending
37  * character(s) then use an end position denoting the start of the next line.
38  * For example:
39  * ```ts
40  * {
41  *     start: { line: 5, character: 23 }
42  *     end : { line 6, character : 0 }
43  * }
44  * ```
45  */
46 export interface Range {
47     /**
48      * The range's start position
49      */
50     start: Position;
51     /**
52      * The range's end position.
53      */
54     end: Position;
55 }
56 /**
57  * A text edit applicable to a text document.
58  */
59 export interface TextEdit {
60     /**
61      * The range of the text document to be manipulated. To insert
62      * text into a document create a range where start === end.
63      */
64     range: Range;
65     /**
66      * The string to be inserted. For delete operations use an
67      * empty string.
68      */
69     newText: string;
70 }
71 /**
72  * An event describing a change to a text document. If range and rangeLength are omitted
73  * the new text is considered to be the full content of the document.
74  */
75 export declare type TextDocumentContentChangeEvent = {
76     /**
77      * The range of the document that changed.
78      */
79     range: Range;
80     /**
81      * The optional length of the range that got replaced.
82      *
83      * @deprecated use range instead.
84      */
85     rangeLength?: number;
86     /**
87      * The new text for the provided range.
88      */
89     text: string;
90 } | {
91     /**
92      * The new text of the whole document.
93      */
94     text: string;
95 };
96 /**
97  * A simple text document. Not to be implemented. The document keeps the content
98  * as string.
99  */
100 export interface TextDocument {
101     /**
102      * The associated URI for this document. Most documents have the __file__-scheme, indicating that they
103      * represent files on disk. However, some documents may have other schemes indicating that they are not
104      * available on disk.
105      *
106      * @readonly
107      */
108     readonly uri: DocumentUri;
109     /**
110      * The identifier of the language associated with this document.
111      *
112      * @readonly
113      */
114     readonly languageId: string;
115     /**
116      * The version number of this document (it will increase after each
117      * change, including undo/redo).
118      *
119      * @readonly
120      */
121     readonly version: number;
122     /**
123      * Get the text of this document. A substring can be retrieved by
124      * providing a range.
125      *
126      * @param range (optional) An range within the document to return.
127      * If no range is passed, the full content is returned.
128      * Invalid range positions are adjusted as described in [Position.line](#Position.line)
129      * and [Position.character](#Position.character).
130      * If the start range position is greater than the end range position,
131      * then the effect of getText is as if the two positions were swapped.
132
133      * @return The text of this document or a substring of the text if a
134      *         range is provided.
135      */
136     getText(range?: Range): string;
137     /**
138      * Converts a zero-based offset to a position.
139      *
140      * @param offset A zero-based offset.
141      * @return A valid [position](#Position).
142      */
143     positionAt(offset: number): Position;
144     /**
145      * Converts the position to a zero-based offset.
146      * Invalid positions are adjusted as described in [Position.line](#Position.line)
147      * and [Position.character](#Position.character).
148      *
149      * @param position A position.
150      * @return A valid zero-based offset.
151      */
152     offsetAt(position: Position): number;
153     /**
154      * The number of lines in this document.
155      *
156      * @readonly
157      */
158     readonly lineCount: number;
159 }
160 export declare namespace TextDocument {
161     /**
162      * Creates a new text document.
163      *
164      * @param uri The document's uri.
165      * @param languageId  The document's language Id.
166      * @param version The document's initial version number.
167      * @param content The document's content.
168      */
169     function create(uri: DocumentUri, languageId: string, version: number, content: string): TextDocument;
170     /**
171      * Updates a TextDocument by modifying its content.
172      *
173      * @param document the document to update. Only documents created by TextDocument.create are valid inputs.
174      * @param changes the changes to apply to the document.
175      * @param version the changes version for the document.
176      * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
177      *
178      */
179     function update(document: TextDocument, changes: TextDocumentContentChangeEvent[], version: number): TextDocument;
180     function applyEdits(document: TextDocument, edits: TextEdit[]): string;
181 }