2 * A tagging type for string properties that are actually document URIs.
4 export declare type DocumentUri = string;
6 * A tagging type for string properties that are actually URIs
10 export declare type URI = string;
12 * Defines an integer in the range of -2^31 to 2^31 - 1.
14 export declare type integer = number;
15 export declare namespace integer {
16 const MIN_VALUE = -2147483648;
17 const MAX_VALUE = 2147483647;
20 * Defines an unsigned integer in the range of 0 to 2^31 - 1.
22 export declare type uinteger = number;
23 export declare namespace uinteger {
25 const MAX_VALUE = 2147483647;
28 * Defines a decimal number. Since decimal numbers are very
29 * rare in the language server specification we denote the
30 * exact range with every decimal using the mathematics
31 * interval notations (e.g. [0, 1] denotes all decimals d with
34 export declare type decimal = number;
36 * Position in a text document expressed as zero-based line and character offset.
37 * The offsets are based on a UTF-16 string representation. So a string of the form
38 * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`
39 * is 1 and the character offset of b is 3 since `𐐀` is represented using two code
42 * Positions are line end character agnostic. So you can not specify a position that
43 * denotes `\r|\n` or `\n|` where `|` represents the character offset.
45 export interface Position {
47 * Line position in a document (zero-based).
51 * Character offset on a line in a document (zero-based). Assuming that the line is
52 * represented as a string, the `character` value represents the gap between the
53 * `character` and `character + 1`.
55 * If the character value is greater than the line length it defaults back to the
61 * The Position namespace provides helper functions to work with
62 * [Position](#Position) literals.
64 export declare namespace Position {
66 * Creates a new Position literal from the given line and character.
67 * @param line The position's line.
68 * @param character The position's character.
70 function create(line: uinteger, character: uinteger): Position;
72 * Checks whether the given literal conforms to the [Position](#Position) interface.
74 function is(value: any): value is Position;
77 * A range in a text document expressed as (zero-based) start and end positions.
79 * If you want to specify a range that contains a line including the line ending
80 * character(s) then use an end position denoting the start of the next line.
84 * start: { line: 5, character: 23 }
85 * end : { line 6, character : 0 }
89 export interface Range {
91 * The range's start position
95 * The range's end position.
100 * The Range namespace provides helper functions to work with
101 * [Range](#Range) literals.
103 export declare namespace Range {
105 * Create a new Range literal.
106 * @param start The range's start position.
107 * @param end The range's end position.
109 function create(start: Position, end: Position): Range;
111 * Create a new Range literal.
112 * @param startLine The start line number.
113 * @param startCharacter The start character.
114 * @param endLine The end line number.
115 * @param endCharacter The end character.
117 function create(startLine: uinteger, startCharacter: uinteger, endLine: uinteger, endCharacter: uinteger): Range;
119 * Checks whether the given literal conforms to the [Range](#Range) interface.
121 function is(value: any): value is Range;
124 * Represents a location inside a resource, such as a line
125 * inside a text file.
127 export interface Location {
132 * The Location namespace provides helper functions to work with
133 * [Location](#Location) literals.
135 export declare namespace Location {
137 * Creates a Location literal.
138 * @param uri The location's uri.
139 * @param range The location's range.
141 function create(uri: DocumentUri, range: Range): Location;
143 * Checks whether the given literal conforms to the [Location](#Location) interface.
145 function is(value: any): value is Location;
148 * Represents the connection of two locations. Provides additional metadata over normal [locations](#Location),
149 * including an origin range.
151 export interface LocationLink {
153 * Span of the origin of this link.
155 * Used as the underlined span for mouse definition hover. Defaults to the word range at
156 * the definition position.
158 originSelectionRange?: Range;
160 * The target resource identifier of this link.
162 targetUri: DocumentUri;
164 * The full target range of this link. If the target for example is a symbol then target range is the
165 * range enclosing this symbol not including leading/trailing whitespace but everything else
166 * like comments. This information is typically used to highlight the range in the editor.
170 * The range that should be selected and revealed when this link is being followed, e.g the name of a function.
171 * Must be contained by the the `targetRange`. See also `DocumentSymbol#range`
173 targetSelectionRange: Range;
176 * The LocationLink namespace provides helper functions to work with
177 * [LocationLink](#LocationLink) literals.
179 export declare namespace LocationLink {
181 * Creates a LocationLink literal.
182 * @param targetUri The definition's uri.
183 * @param targetRange The full range of the definition.
184 * @param targetSelectionRange The span of the symbol definition at the target.
185 * @param originSelectionRange The span of the symbol being defined in the originating source file.
187 function create(targetUri: DocumentUri, targetRange: Range, targetSelectionRange: Range, originSelectionRange?: Range): LocationLink;
189 * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
191 function is(value: any): value is LocationLink;
194 * Represents a color in RGBA space.
196 export interface Color {
198 * The red component of this color in the range [0-1].
200 readonly red: decimal;
202 * The green component of this color in the range [0-1].
204 readonly green: decimal;
206 * The blue component of this color in the range [0-1].
208 readonly blue: decimal;
210 * The alpha component of this color in the range [0-1].
212 readonly alpha: decimal;
215 * The Color namespace provides helper functions to work with
216 * [Color](#Color) literals.
218 export declare namespace Color {
220 * Creates a new Color literal.
222 function create(red: decimal, green: decimal, blue: decimal, alpha: decimal): Color;
224 * Checks whether the given literal conforms to the [Color](#Color) interface.
226 function is(value: any): value is Color;
229 * Represents a color range from a document.
231 export interface ColorInformation {
233 * The range in the document where this color appears.
237 * The actual color value for this color range.
242 * The ColorInformation namespace provides helper functions to work with
243 * [ColorInformation](#ColorInformation) literals.
245 export declare namespace ColorInformation {
247 * Creates a new ColorInformation literal.
249 function create(range: Range, color: Color): ColorInformation;
251 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
253 function is(value: any): value is ColorInformation;
255 export interface ColorPresentation {
257 * The label of this color presentation. It will be shown on the color
258 * picker header. By default this is also the text that is inserted when selecting
259 * this color presentation.
263 * An [edit](#TextEdit) which is applied to a document when selecting
264 * this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
269 * An optional array of additional [text edits](#TextEdit) that are applied when
270 * selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
272 additionalTextEdits?: TextEdit[];
275 * The Color namespace provides helper functions to work with
276 * [ColorPresentation](#ColorPresentation) literals.
278 export declare namespace ColorPresentation {
280 * Creates a new ColorInformation literal.
282 function create(label: string, textEdit?: TextEdit, additionalTextEdits?: TextEdit[]): ColorPresentation;
284 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
286 function is(value: any): value is ColorPresentation;
289 * Enum of known range kinds
291 export declare enum FoldingRangeKind {
293 * Folding range for a comment
297 * Folding range for a imports or includes
301 * Folding range for a region (e.g. `#region`)
306 * Represents a folding range. To be valid, start and end line must be bigger than zero and smaller
307 * than the number of lines in the document. Clients are free to ignore invalid ranges.
309 export interface FoldingRange {
311 * The zero-based start line of the range to fold. The folded area starts after the line's last character.
312 * To be valid, the end must be zero or larger and smaller than the number of lines in the document.
316 * The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
318 startCharacter?: uinteger;
320 * The zero-based end line of the range to fold. The folded area ends with the line's last character.
321 * To be valid, the end must be zero or larger and smaller than the number of lines in the document.
325 * The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
327 endCharacter?: uinteger;
329 * Describes the kind of the folding range such as `comment' or 'region'. The kind
330 * is used to categorize folding ranges and used by commands like 'Fold all comments'. See
331 * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds.
336 * The folding range namespace provides helper functions to work with
337 * [FoldingRange](#FoldingRange) literals.
339 export declare namespace FoldingRange {
341 * Creates a new FoldingRange literal.
343 function create(startLine: uinteger, endLine: uinteger, startCharacter?: uinteger, endCharacter?: uinteger, kind?: string): FoldingRange;
345 * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
347 function is(value: any): value is FoldingRange;
350 * Represents a related message and source code location for a diagnostic. This should be
351 * used to point to code locations that cause or related to a diagnostics, e.g when duplicating
352 * a symbol in a scope.
354 export interface DiagnosticRelatedInformation {
356 * The location of this related diagnostic information.
360 * The message of this related diagnostic information.
365 * The DiagnosticRelatedInformation namespace provides helper functions to work with
366 * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
368 export declare namespace DiagnosticRelatedInformation {
370 * Creates a new DiagnosticRelatedInformation literal.
372 function create(location: Location, message: string): DiagnosticRelatedInformation;
374 * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
376 function is(value: any): value is DiagnosticRelatedInformation;
379 * The diagnostic's severity.
381 export declare namespace DiagnosticSeverity {
391 * Reports an information.
393 const Information: 3;
399 export declare type DiagnosticSeverity = 1 | 2 | 3 | 4;
401 * The diagnostic tags.
405 export declare namespace DiagnosticTag {
407 * Unused or unnecessary code.
409 * Clients are allowed to render diagnostics with this tag faded out instead of having
412 const Unnecessary: 1;
414 * Deprecated or obsolete code.
416 * Clients are allowed to rendered diagnostics with this tag strike through.
420 export declare type DiagnosticTag = 1 | 2;
422 * Structure to capture a description for an error code.
426 export interface CodeDescription {
428 * An URI to open with more information about the diagnostic error.
433 * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
437 export declare namespace CodeDescription {
438 function is(value: CodeDescription | undefined | null): value is CodeDescription;
441 * Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
442 * are only valid in the scope of a resource.
444 export interface Diagnostic {
446 * The range at which the message applies
450 * The diagnostic's severity. Can be omitted. If omitted it is up to the
451 * client to interpret diagnostics as error, warning, info or hint.
453 severity?: DiagnosticSeverity;
455 * The diagnostic's code, which usually appear in the user interface.
457 code?: integer | string;
459 * An optional property to describe the error code.
463 codeDescription?: CodeDescription;
465 * A human-readable string describing the source of this
466 * diagnostic, e.g. 'typescript' or 'super lint'. It usually
467 * appears in the user interface.
471 * The diagnostic's message. It usually appears in the user interface
475 * Additional metadata about the diagnostic.
479 tags?: DiagnosticTag[];
481 * An array of related diagnostic information, e.g. when symbol-names within
482 * a scope collide all definitions can be marked via this property.
484 relatedInformation?: DiagnosticRelatedInformation[];
486 * A data entry field that is preserved between a `textDocument/publishDiagnostics`
487 * notification and `textDocument/codeAction` request.
494 * The Diagnostic namespace provides helper functions to work with
495 * [Diagnostic](#Diagnostic) literals.
497 export declare namespace Diagnostic {
499 * Creates a new Diagnostic literal.
501 function create(range: Range, message: string, severity?: DiagnosticSeverity, code?: integer | string, source?: string, relatedInformation?: DiagnosticRelatedInformation[]): Diagnostic;
503 * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
505 function is(value: any): value is Diagnostic;
508 * Represents a reference to a command. Provides a title which
509 * will be used to represent a command in the UI and, optionally,
510 * an array of arguments which will be passed to the command handler
511 * function when invoked.
513 export interface Command {
515 * Title of the command, like `save`.
519 * The identifier of the actual command handler.
523 * Arguments that the command handler should be
529 * The Command namespace provides helper functions to work with
530 * [Command](#Command) literals.
532 export declare namespace Command {
534 * Creates a new Command literal.
536 function create(title: string, command: string, ...args: any[]): Command;
538 * Checks whether the given literal conforms to the [Command](#Command) interface.
540 function is(value: any): value is Command;
543 * A text edit applicable to a text document.
545 export interface TextEdit {
547 * The range of the text document to be manipulated. To insert
548 * text into a document create a range where start === end.
552 * The string to be inserted. For delete operations use an
558 * The TextEdit namespace provides helper function to create replace,
559 * insert and delete edits more easily.
561 export declare namespace TextEdit {
563 * Creates a replace text edit.
564 * @param range The range of text to be replaced.
565 * @param newText The new text.
567 function replace(range: Range, newText: string): TextEdit;
569 * Creates a insert text edit.
570 * @param position The position to insert the text at.
571 * @param newText The text to be inserted.
573 function insert(position: Position, newText: string): TextEdit;
575 * Creates a delete text edit.
576 * @param range The range of text to be deleted.
578 function del(range: Range): TextEdit;
579 function is(value: any): value is TextEdit;
582 * Additional information that describes document changes.
586 export interface ChangeAnnotation {
588 * A human-readable string describing the actual change. The string
589 * is rendered prominent in the user interface.
593 * A flag which indicates that user confirmation is needed
594 * before applying the change.
596 needsConfirmation?: boolean;
598 * A human-readable string which is rendered less prominent in
599 * the user interface.
601 description?: string;
603 export declare namespace ChangeAnnotation {
604 function create(label: string, needsConfirmation?: boolean, description?: string): ChangeAnnotation;
605 function is(value: any): value is ChangeAnnotation;
607 export declare namespace ChangeAnnotationIdentifier {
608 function is(value: any): value is ChangeAnnotationIdentifier;
611 * An identifier to refer to a change annotation stored with a workspace edit.
613 export declare type ChangeAnnotationIdentifier = string;
615 * A special text edit with an additional change annotation.
619 export interface AnnotatedTextEdit extends TextEdit {
621 * The actual identifier of the change annotation
623 annotationId: ChangeAnnotationIdentifier;
625 export declare namespace AnnotatedTextEdit {
627 * Creates an annotated replace text edit.
629 * @param range The range of text to be replaced.
630 * @param newText The new text.
631 * @param annotation The annotation.
633 function replace(range: Range, newText: string, annotation: ChangeAnnotationIdentifier): AnnotatedTextEdit;
635 * Creates an annotated insert text edit.
637 * @param position The position to insert the text at.
638 * @param newText The text to be inserted.
639 * @param annotation The annotation.
641 function insert(position: Position, newText: string, annotation: ChangeAnnotationIdentifier): AnnotatedTextEdit;
643 * Creates an annotated delete text edit.
645 * @param range The range of text to be deleted.
646 * @param annotation The annotation.
648 function del(range: Range, annotation: ChangeAnnotationIdentifier): AnnotatedTextEdit;
649 function is(value: any): value is AnnotatedTextEdit;
652 * Describes textual changes on a text document. A TextDocumentEdit describes all changes
653 * on a document version Si and after they are applied move the document to version Si+1.
654 * So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
655 * kind of ordering. However the edits must be non overlapping.
657 export interface TextDocumentEdit {
659 * The text document to change.
661 textDocument: OptionalVersionedTextDocumentIdentifier;
663 * The edits to be applied.
665 * @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
668 edits: (TextEdit | AnnotatedTextEdit)[];
671 * The TextDocumentEdit namespace provides helper function to create
672 * an edit that manipulates a text document.
674 export declare namespace TextDocumentEdit {
676 * Creates a new `TextDocumentEdit`
678 function create(textDocument: OptionalVersionedTextDocumentIdentifier, edits: (TextEdit | AnnotatedTextEdit)[]): TextDocumentEdit;
679 function is(value: any): value is TextDocumentEdit;
682 * A generic resource operation.
684 interface ResourceOperation {
686 * The resource operation kind.
690 * An optional annotation identifier describing the operation.
694 annotationId?: ChangeAnnotationIdentifier;
697 * Options to create a file.
699 export interface CreateFileOptions {
701 * Overwrite existing file. Overwrite wins over `ignoreIfExists`
707 ignoreIfExists?: boolean;
710 * Create file operation.
712 export interface CreateFile extends ResourceOperation {
718 * The resource to create.
724 options?: CreateFileOptions;
726 export declare namespace CreateFile {
727 function create(uri: DocumentUri, options?: CreateFileOptions, annotation?: ChangeAnnotationIdentifier): CreateFile;
728 function is(value: any): value is CreateFile;
731 * Rename file options
733 export interface RenameFileOptions {
735 * Overwrite target if existing. Overwrite wins over `ignoreIfExists`
739 * Ignores if target exists.
741 ignoreIfExists?: boolean;
744 * Rename file operation
746 export interface RenameFile extends ResourceOperation {
752 * The old (existing) location.
762 options?: RenameFileOptions;
764 export declare namespace RenameFile {
765 function create(oldUri: DocumentUri, newUri: DocumentUri, options?: RenameFileOptions, annotation?: ChangeAnnotationIdentifier): RenameFile;
766 function is(value: any): value is RenameFile;
769 * Delete file options
771 export interface DeleteFileOptions {
773 * Delete the content recursively if a folder is denoted.
777 * Ignore the operation if the file doesn't exist.
779 ignoreIfNotExists?: boolean;
782 * Delete file operation
784 export interface DeleteFile extends ResourceOperation {
790 * The file to delete.
796 options?: DeleteFileOptions;
798 export declare namespace DeleteFile {
799 function create(uri: DocumentUri, options?: DeleteFileOptions, annotation?: ChangeAnnotationIdentifier): DeleteFile;
800 function is(value: any): value is DeleteFile;
803 * A workspace edit represents changes to many resources managed in the workspace. The edit
804 * should either provide `changes` or `documentChanges`. If documentChanges are present
805 * they are preferred over `changes` if the client can handle versioned document edits.
807 export interface WorkspaceEdit {
809 * Holds changes to existing resources.
812 [uri: string]: TextEdit[];
815 * Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
816 * are either an array of `TextDocumentEdit`s to express changes to n different text documents
817 * where each text document edit addresses a specific version of a text document. Or it can contain
818 * above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
820 * Whether a client supports versioned document edits is expressed via
821 * `workspace.workspaceEdit.documentChanges` client capability.
823 * If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
824 * only plain `TextEdit`s using the `changes` property are supported.
826 documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[];
828 * A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
829 * delete file / folder operations.
831 * Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.
835 changeAnnotations?: {
836 [id: string]: ChangeAnnotation;
839 export declare namespace WorkspaceEdit {
840 function is(value: any): value is WorkspaceEdit;
843 * A change to capture text edits for existing resources.
845 export interface TextEditChange {
847 * Gets all text edits for this change.
849 * @return An array of text edits.
851 * @since 3.16.0 - support for annotated text edits. This is usually
852 * guarded using a client capability.
854 all(): (TextEdit | AnnotatedTextEdit)[];
856 * Clears the edits for this change.
862 * @param edit the text edit to add.
864 * @since 3.16.0 - support for annotated text edits. This is usually
865 * guarded using a client capability.
867 add(edit: TextEdit | AnnotatedTextEdit): void;
869 * Insert the given text at the given position.
871 * @param position A position.
872 * @param newText A string.
873 * @param annotation An optional annotation.
875 insert(position: Position, newText: string): void;
876 insert(position: Position, newText: string, annotation: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;
878 * Replace the given range with given text for the given resource.
880 * @param range A range.
881 * @param newText A string.
882 * @param annotation An optional annotation.
884 replace(range: Range, newText: string): void;
885 replace(range: Range, newText: string, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;
887 * Delete the text at the given range.
889 * @param range A range.
890 * @param annotation An optional annotation.
892 delete(range: Range): void;
893 delete(range: Range, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;
896 * A workspace change helps constructing changes to a workspace.
898 export declare class WorkspaceChange {
899 private _workspaceEdit;
900 private _textEditChanges;
901 private _changeAnnotations;
902 constructor(workspaceEdit?: WorkspaceEdit);
904 * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
905 * use to be returned from a workspace edit operation like rename.
907 get edit(): WorkspaceEdit;
909 * Returns the [TextEditChange](#TextEditChange) to manage text edits
912 getTextEditChange(textDocument: OptionalVersionedTextDocumentIdentifier): TextEditChange;
913 getTextEditChange(uri: DocumentUri): TextEditChange;
914 private initDocumentChanges;
916 createFile(uri: DocumentUri, options?: CreateFileOptions): void;
917 createFile(uri: DocumentUri, annotation: ChangeAnnotation | ChangeAnnotationIdentifier, options?: CreateFileOptions): ChangeAnnotationIdentifier;
918 renameFile(oldUri: DocumentUri, newUri: DocumentUri, options?: RenameFileOptions): void;
919 renameFile(oldUri: DocumentUri, newUri: DocumentUri, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier, options?: RenameFileOptions): ChangeAnnotationIdentifier;
920 deleteFile(uri: DocumentUri, options?: DeleteFileOptions): void;
921 deleteFile(uri: DocumentUri, annotation: ChangeAnnotation | ChangeAnnotationIdentifier, options?: DeleteFileOptions): ChangeAnnotationIdentifier;
924 * A literal to identify a text document in the client.
926 export interface TextDocumentIdentifier {
928 * The text document's uri.
933 * The TextDocumentIdentifier namespace provides helper functions to work with
934 * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
936 export declare namespace TextDocumentIdentifier {
938 * Creates a new TextDocumentIdentifier literal.
939 * @param uri The document's uri.
941 function create(uri: DocumentUri): TextDocumentIdentifier;
943 * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
945 function is(value: any): value is TextDocumentIdentifier;
948 * A text document identifier to denote a specific version of a text document.
950 export interface VersionedTextDocumentIdentifier extends TextDocumentIdentifier {
952 * The version number of this document.
957 * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
958 * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
960 export declare namespace VersionedTextDocumentIdentifier {
962 * Creates a new VersionedTextDocumentIdentifier literal.
963 * @param uri The document's uri.
964 * @param uri The document's text.
966 function create(uri: DocumentUri, version: integer): VersionedTextDocumentIdentifier;
968 * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
970 function is(value: any): value is VersionedTextDocumentIdentifier;
973 * A text document identifier to optionally denote a specific version of a text document.
975 export interface OptionalVersionedTextDocumentIdentifier extends TextDocumentIdentifier {
977 * The version number of this document. If a versioned text document identifier
978 * is sent from the server to the client and the file is not open in the editor
979 * (the server has not received an open notification before) the server can send
980 * `null` to indicate that the version is unknown and the content on disk is the
981 * truth (as specified with document content ownership).
983 version: integer | null;
986 * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
987 * [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals.
989 export declare namespace OptionalVersionedTextDocumentIdentifier {
991 * Creates a new OptionalVersionedTextDocumentIdentifier literal.
992 * @param uri The document's uri.
993 * @param uri The document's text.
995 function create(uri: DocumentUri, version: integer | null): OptionalVersionedTextDocumentIdentifier;
997 * Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface.
999 function is(value: any): value is OptionalVersionedTextDocumentIdentifier;
1002 * An item to transfer a text document from the client to the
1005 export interface TextDocumentItem {
1007 * The text document's uri.
1011 * The text document's language identifier
1015 * The version number of this document (it will increase after each
1016 * change, including undo/redo).
1020 * The content of the opened text document.
1025 * The TextDocumentItem namespace provides helper functions to work with
1026 * [TextDocumentItem](#TextDocumentItem) literals.
1028 export declare namespace TextDocumentItem {
1030 * Creates a new TextDocumentItem literal.
1031 * @param uri The document's uri.
1032 * @param languageId The document's language identifier.
1033 * @param version The document's version number.
1034 * @param text The document's text.
1036 function create(uri: DocumentUri, languageId: string, version: integer, text: string): TextDocumentItem;
1038 * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
1040 function is(value: any): value is TextDocumentItem;
1043 * Describes the content type that a client supports in various
1044 * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
1046 * Please note that `MarkupKinds` must not start with a `$`. This kinds
1047 * are reserved for internal usage.
1049 export declare namespace MarkupKind {
1051 * Plain text is supported as a content format
1053 const PlainText: 'plaintext';
1055 * Markdown is supported as a content format
1057 const Markdown: 'markdown';
1059 export declare type MarkupKind = 'plaintext' | 'markdown';
1060 export declare namespace MarkupKind {
1062 * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
1064 function is(value: any): value is MarkupKind;
1067 * A `MarkupContent` literal represents a string value which content is interpreted base on its
1068 * kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
1070 * If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
1071 * See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
1073 * Here is an example how such a string can be constructed using JavaScript / TypeScript:
1075 * let markdown: MarkdownContent = {
1076 * kind: MarkupKind.Markdown,
1087 * *Please Note* that clients might sanitize the return markdown. A client could decide to
1088 * remove HTML from the markdown to avoid script execution.
1090 export interface MarkupContent {
1092 * The type of the Markup
1096 * The content itself
1100 export declare namespace MarkupContent {
1102 * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
1104 function is(value: any): value is MarkupContent;
1107 * The kind of a completion entry.
1109 export declare namespace CompletionItemKind {
1113 const Constructor: 4;
1127 const Reference: 18;
1129 const EnumMember: 20;
1134 const TypeParameter: 25;
1136 export declare type CompletionItemKind = 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;
1138 * Defines whether the insert text in a completion item should be interpreted as
1139 * plain text or a snippet.
1141 export declare namespace InsertTextFormat {
1143 * The primary text to be inserted is treated as a plain string.
1147 * The primary text to be inserted is treated as a snippet.
1149 * A snippet can define tab stops and placeholders with `$1`, `$2`
1150 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
1151 * the end of the snippet. Placeholders with equal identifiers are linked,
1152 * that is typing in one will update others too.
1154 * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
1158 export declare type InsertTextFormat = 1 | 2;
1160 * Completion item tags are extra annotations that tweak the rendering of a completion
1165 export declare namespace CompletionItemTag {
1167 * Render a completion as obsolete, usually using a strike-out.
1169 const Deprecated = 1;
1171 export declare type CompletionItemTag = 1;
1173 * A special text edit to provide an insert and a replace operation.
1177 export interface InsertReplaceEdit {
1179 * The string to be inserted.
1183 * The range if the insert is requested
1187 * The range if the replace is requested.
1192 * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
1196 export declare namespace InsertReplaceEdit {
1198 * Creates a new insert / replace edit
1200 function create(newText: string, insert: Range, replace: Range): InsertReplaceEdit;
1202 * Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
1204 function is(value: TextEdit | InsertReplaceEdit): value is InsertReplaceEdit;
1207 * How whitespace and indentation is handled during completion
1212 export declare namespace InsertTextMode {
1214 * The insertion or replace strings is taken as it is. If the
1215 * value is multi line the lines below the cursor will be
1216 * inserted using the indentation defined in the string value.
1217 * The client will not apply any kind of adjustments to the
1222 * The editor adjusts leading whitespace of new lines so that
1223 * they match the indentation up to the cursor of the line for
1224 * which the item is accepted.
1226 * Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
1227 * multi line completion item is indented using 2 tabs and all
1228 * following lines inserted will be indented using 2 tabs as well.
1230 const adjustIndentation: 2;
1232 export declare type InsertTextMode = 1 | 2;
1234 * A completion item represents a text snippet that is
1235 * proposed to complete text that is being typed.
1237 export interface CompletionItem {
1239 * The label of this completion item. By default
1240 * also the text that is inserted when selecting
1245 * The kind of this completion item. Based of the kind
1246 * an icon is chosen by the editor.
1248 kind?: CompletionItemKind;
1250 * Tags for this completion item.
1254 tags?: CompletionItemTag[];
1256 * A human-readable string with additional information
1257 * about this item, like type or symbol information.
1261 * A human-readable string that represents a doc-comment.
1263 documentation?: string | MarkupContent;
1265 * Indicates if this item is deprecated.
1266 * @deprecated Use `tags` instead.
1268 deprecated?: boolean;
1270 * Select this item when showing.
1272 * *Note* that only one completion item can be selected and that the
1273 * tool / client decides which item that is. The rule is that the *first*
1274 * item of those that match best is selected.
1276 preselect?: boolean;
1278 * A string that should be used when comparing this item
1279 * with other items. When `falsy` the [label](#CompletionItem.label)
1284 * A string that should be used when filtering a set of
1285 * completion items. When `falsy` the [label](#CompletionItem.label)
1288 filterText?: string;
1290 * A string that should be inserted into a document when selecting
1291 * this completion. When `falsy` the [label](#CompletionItem.label)
1294 * The `insertText` is subject to interpretation by the client side.
1295 * Some tools might not take the string literally. For example
1296 * VS Code when code complete is requested in this example `con<cursor position>`
1297 * and a completion item with an `insertText` of `console` is provided it
1298 * will only insert `sole`. Therefore it is recommended to use `textEdit` instead
1299 * since it avoids additional client side interpretation.
1301 insertText?: string;
1303 * The format of the insert text. The format applies to both the `insertText` property
1304 * and the `newText` property of a provided `textEdit`. If omitted defaults to
1305 * `InsertTextFormat.PlainText`.
1307 insertTextFormat?: InsertTextFormat;
1309 * How whitespace and indentation is handled during completion
1310 * item insertion. If ignored the clients default value depends on
1311 * the `textDocument.completion.insertTextMode` client capability.
1315 insertTextMode?: InsertTextMode;
1317 * An [edit](#TextEdit) which is applied to a document when selecting
1318 * this completion. When an edit is provided the value of
1319 * [insertText](#CompletionItem.insertText) is ignored.
1321 * Most editors support two different operation when accepting a completion item. One is to insert a
1322 * completion text and the other is to replace an existing text with a completion text. Since this can
1323 * usually not predetermined by a server it can report both ranges. Clients need to signal support for
1324 * `InsertReplaceEdits` via the `textDocument.completion.insertReplaceSupport` client capability
1327 * *Note 1:* The text edit's range as well as both ranges from a insert replace edit must be a
1328 * [single line] and they must contain the position at which completion has been requested.
1329 * *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range must be a prefix of
1330 * the edit's replace range, that means it must be contained and starting at the same position.
1332 * @since 3.16.0 additional type `InsertReplaceEdit`
1334 textEdit?: TextEdit | InsertReplaceEdit;
1336 * An optional array of additional [text edits](#TextEdit) that are applied when
1337 * selecting this completion. Edits must not overlap (including the same insert position)
1338 * with the main [edit](#CompletionItem.textEdit) nor with themselves.
1340 * Additional text edits should be used to change text unrelated to the current cursor position
1341 * (for example adding an import statement at the top of the file if the completion item will
1342 * insert an unqualified type).
1344 additionalTextEdits?: TextEdit[];
1346 * An optional set of characters that when pressed while this completion is active will accept it first and
1347 * then type that character. *Note* that all commit characters should have `length=1` and that superfluous
1348 * characters will be ignored.
1350 commitCharacters?: string[];
1352 * An optional [command](#Command) that is executed *after* inserting this completion. *Note* that
1353 * additional modifications to the current document should be described with the
1354 * [additionalTextEdits](#CompletionItem.additionalTextEdits)-property.
1358 * A data entry field that is preserved on a completion item between
1359 * a [CompletionRequest](#CompletionRequest) and a [CompletionResolveRequest]
1360 * (#CompletionResolveRequest)
1365 * The CompletionItem namespace provides functions to deal with
1368 export declare namespace CompletionItem {
1370 * Create a completion item and seed it with a label.
1371 * @param label The completion item's label
1373 function create(label: string): CompletionItem;
1376 * Represents a collection of [completion items](#CompletionItem) to be presented
1379 export interface CompletionList {
1381 * This list it not complete. Further typing results in recomputing this list.
1383 isIncomplete: boolean;
1385 * The completion items.
1387 items: CompletionItem[];
1390 * The CompletionList namespace provides functions to deal with
1393 export declare namespace CompletionList {
1395 * Creates a new completion list.
1397 * @param items The completion items.
1398 * @param isIncomplete The list is not complete.
1400 function create(items?: CompletionItem[], isIncomplete?: boolean): CompletionList;
1403 * MarkedString can be used to render human readable text. It is either a markdown string
1404 * or a code-block that provides a language and a code snippet. The language identifier
1405 * is semantically equal to the optional language identifier in fenced code blocks in GitHub
1406 * issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
1408 * The pair of a language and a value is an equivalent to markdown:
1413 * Note that markdown strings will be sanitized - that means html will be escaped.
1414 * @deprecated use MarkupContent instead.
1416 export declare type MarkedString = string | {
1420 export declare namespace MarkedString {
1422 * Creates a marked string from plain text.
1424 * @param plainText The plain text.
1426 function fromPlainText(plainText: string): string;
1428 * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
1430 function is(value: any): value is MarkedString;
1433 * The result of a hover request.
1435 export interface Hover {
1437 * The hover's content
1439 contents: MarkupContent | MarkedString | MarkedString[];
1445 export declare namespace Hover {
1447 * Checks whether the given value conforms to the [Hover](#Hover) interface.
1449 function is(value: any): value is Hover;
1452 * Represents a parameter of a callable-signature. A parameter can
1453 * have a label and a doc-comment.
1455 export interface ParameterInformation {
1457 * The label of this parameter information.
1459 * Either a string or an inclusive start and exclusive end offsets within its containing
1460 * signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
1461 * string representation as `Position` and `Range` does.
1463 * *Note*: a label of type string should be a substring of its containing signature label.
1464 * Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
1466 label: string | [uinteger, uinteger];
1468 * The human-readable doc-comment of this signature. Will be shown
1469 * in the UI but can be omitted.
1471 documentation?: string | MarkupContent;
1474 * The ParameterInformation namespace provides helper functions to work with
1475 * [ParameterInformation](#ParameterInformation) literals.
1477 export declare namespace ParameterInformation {
1479 * Creates a new parameter information literal.
1481 * @param label A label string.
1482 * @param documentation A doc string.
1484 function create(label: string | [uinteger, uinteger], documentation?: string): ParameterInformation;
1487 * Represents the signature of something callable. A signature
1488 * can have a label, like a function-name, a doc-comment, and
1489 * a set of parameters.
1491 export interface SignatureInformation {
1493 * The label of this signature. Will be shown in
1498 * The human-readable doc-comment of this signature. Will be shown
1499 * in the UI but can be omitted.
1501 documentation?: string | MarkupContent;
1503 * The parameters of this signature.
1505 parameters?: ParameterInformation[];
1507 * The index of the active parameter.
1509 * If provided, this is used in place of `SignatureHelp.activeParameter`.
1513 activeParameter?: uinteger;
1516 * The SignatureInformation namespace provides helper functions to work with
1517 * [SignatureInformation](#SignatureInformation) literals.
1519 export declare namespace SignatureInformation {
1520 function create(label: string, documentation?: string, ...parameters: ParameterInformation[]): SignatureInformation;
1523 * Signature help represents the signature of something
1524 * callable. There can be multiple signature but only one
1525 * active and only one active parameter.
1527 export interface SignatureHelp {
1529 * One or more signatures.
1531 signatures: SignatureInformation[];
1533 * The active signature. Set to `null` if no
1536 activeSignature: uinteger | null;
1538 * The active parameter of the active signature. Set to `null`
1539 * if the active signature has no parameters.
1541 activeParameter: uinteger | null;
1544 * The definition of a symbol represented as one or many [locations](#Location).
1545 * For most programming languages there is only one location at which a symbol is
1548 * Servers should prefer returning `DefinitionLink` over `Definition` if supported
1551 export declare type Definition = Location | Location[];
1553 * Information about where a symbol is defined.
1555 * Provides additional metadata over normal [location](#Location) definitions, including the range of
1556 * the defining symbol
1558 export declare type DefinitionLink = LocationLink;
1560 * The declaration of a symbol representation as one or many [locations](#Location).
1562 export declare type Declaration = Location | Location[];
1564 * Information about where a symbol is declared.
1566 * Provides additional metadata over normal [location](#Location) declarations, including the range of
1567 * the declaring symbol.
1569 * Servers should prefer returning `DeclarationLink` over `Declaration` if supported
1572 export declare type DeclarationLink = LocationLink;
1574 * Value-object that contains additional information when
1575 * requesting references.
1577 export interface ReferenceContext {
1579 * Include the declaration of the current symbol.
1581 includeDeclaration: boolean;
1584 * A document highlight kind.
1586 export declare namespace DocumentHighlightKind {
1588 * A textual occurrence.
1592 * Read-access of a symbol, like reading a variable.
1596 * Write-access of a symbol, like writing to a variable.
1600 export declare type DocumentHighlightKind = 1 | 2 | 3;
1602 * A document highlight is a range inside a text document which deserves
1603 * special attention. Usually a document highlight is visualized by changing
1604 * the background color of its range.
1606 export interface DocumentHighlight {
1608 * The range this highlight applies to.
1612 * The highlight kind, default is [text](#DocumentHighlightKind.Text).
1614 kind?: DocumentHighlightKind;
1617 * DocumentHighlight namespace to provide helper functions to work with
1618 * [DocumentHighlight](#DocumentHighlight) literals.
1620 export declare namespace DocumentHighlight {
1622 * Create a DocumentHighlight object.
1623 * @param range The range the highlight applies to.
1625 function create(range: Range, kind?: DocumentHighlightKind): DocumentHighlight;
1630 export declare namespace SymbolKind {
1639 const Constructor: 9;
1641 const Interface: 11;
1652 const EnumMember: 22;
1656 const TypeParameter: 26;
1658 export declare type SymbolKind = 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;
1660 * Symbol tags are extra annotations that tweak the rendering of a symbol.
1663 export declare namespace SymbolTag {
1665 * Render a symbol as obsolete, usually using a strike-out.
1667 const Deprecated: 1;
1669 export declare type SymbolTag = 1;
1671 * Represents information about programming constructs like variables, classes,
1674 export interface SymbolInformation {
1676 * The name of this symbol.
1680 * The kind of this symbol.
1684 * Tags for this completion item.
1690 * Indicates if this symbol is deprecated.
1692 * @deprecated Use tags instead
1694 deprecated?: boolean;
1696 * The location of this symbol. The location's range is used by a tool
1697 * to reveal the location in the editor. If the symbol is selected in the
1698 * tool the range's start information is used to position the cursor. So
1699 * the range usually spans more than the actual symbol's name and does
1700 * normally include thinks like visibility modifiers.
1702 * The range doesn't have to denote a node range in the sense of a abstract
1703 * syntax tree. It can therefore not be used to re-construct a hierarchy of
1708 * The name of the symbol containing this symbol. This information is for
1709 * user interface purposes (e.g. to render a qualifier in the user interface
1710 * if necessary). It can't be used to re-infer a hierarchy for the document
1713 containerName?: string;
1715 export declare namespace SymbolInformation {
1717 * Creates a new symbol information literal.
1719 * @param name The name of the symbol.
1720 * @param kind The kind of the symbol.
1721 * @param range The range of the location of the symbol.
1722 * @param uri The resource of the location of symbol, defaults to the current document.
1723 * @param containerName The name of the symbol containing the symbol.
1725 function create(name: string, kind: SymbolKind, range: Range, uri?: string, containerName?: string): SymbolInformation;
1728 * Represents programming constructs like variables, classes, interfaces etc.
1729 * that appear in a document. Document symbols can be hierarchical and they
1730 * have two ranges: one that encloses its definition and one that points to
1731 * its most interesting range, e.g. the range of an identifier.
1733 export interface DocumentSymbol {
1735 * The name of this symbol. Will be displayed in the user interface and therefore must not be
1736 * an empty string or a string only consisting of white spaces.
1740 * More detail for this symbol, e.g the signature of a function.
1744 * The kind of this symbol.
1748 * Tags for this completion item.
1754 * Indicates if this symbol is deprecated.
1756 * @deprecated Use tags instead
1758 deprecated?: boolean;
1760 * The range enclosing this symbol not including leading/trailing whitespace but everything else
1761 * like comments. This information is typically used to determine if the the clients cursor is
1762 * inside the symbol to reveal in the symbol in the UI.
1766 * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
1767 * Must be contained by the the `range`.
1769 selectionRange: Range;
1771 * Children of this symbol, e.g. properties of a class.
1773 children?: DocumentSymbol[];
1775 export declare namespace DocumentSymbol {
1777 * Creates a new symbol information literal.
1779 * @param name The name of the symbol.
1780 * @param detail The detail of the symbol.
1781 * @param kind The kind of the symbol.
1782 * @param range The range of the symbol.
1783 * @param selectionRange The selectionRange of the symbol.
1784 * @param children Children of the symbol.
1786 function create(name: string, detail: string | undefined, kind: SymbolKind, range: Range, selectionRange: Range, children?: DocumentSymbol[]): DocumentSymbol;
1788 * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
1790 function is(value: any): value is DocumentSymbol;
1793 * The kind of a code action.
1795 * Kinds are a hierarchical list of identifiers separated by `.`, e.g. `"refactor.extract.function"`.
1797 * The set of kinds is open and client needs to announce the kinds it supports to the server during
1800 export declare type CodeActionKind = string;
1802 * A set of predefined code action kinds
1804 export declare namespace CodeActionKind {
1808 const Empty: CodeActionKind;
1810 * Base kind for quickfix actions: 'quickfix'
1812 const QuickFix: CodeActionKind;
1814 * Base kind for refactoring actions: 'refactor'
1816 const Refactor: CodeActionKind;
1818 * Base kind for refactoring extraction actions: 'refactor.extract'
1820 * Example extract actions:
1823 * - Extract function
1824 * - Extract variable
1825 * - Extract interface from class
1828 const RefactorExtract: CodeActionKind;
1830 * Base kind for refactoring inline actions: 'refactor.inline'
1832 * Example inline actions:
1839 const RefactorInline: CodeActionKind;
1841 * Base kind for refactoring rewrite actions: 'refactor.rewrite'
1843 * Example rewrite actions:
1845 * - Convert JavaScript function to class
1846 * - Add or remove parameter
1847 * - Encapsulate field
1848 * - Make method static
1849 * - Move method to base class
1852 const RefactorRewrite: CodeActionKind;
1854 * Base kind for source actions: `source`
1856 * Source code actions apply to the entire file.
1858 const Source: CodeActionKind;
1860 * Base kind for an organize imports source action: `source.organizeImports`
1862 const SourceOrganizeImports: CodeActionKind;
1864 * Base kind for auto-fix source actions: `source.fixAll`.
1866 * Fix all actions automatically fix errors that have a clear fix that do not require user input.
1867 * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
1871 const SourceFixAll: CodeActionKind;
1874 * Contains additional diagnostic information about the context in which
1875 * a [code action](#CodeActionProvider.provideCodeActions) is run.
1877 export interface CodeActionContext {
1879 * An array of diagnostics known on the client side overlapping the range provided to the
1880 * `textDocument/codeAction` request. They are provided so that the server knows which
1881 * errors are currently presented to the user for the given range. There is no guarantee
1882 * that these accurately reflect the error state of the resource. The primary parameter
1883 * to compute code actions is the provided range.
1885 diagnostics: Diagnostic[];
1887 * Requested kind of actions to return.
1889 * Actions not of this kind are filtered out by the client before being shown. So servers
1890 * can omit computing them.
1892 only?: CodeActionKind[];
1895 * The CodeActionContext namespace provides helper functions to work with
1896 * [CodeActionContext](#CodeActionContext) literals.
1898 export declare namespace CodeActionContext {
1900 * Creates a new CodeActionContext literal.
1902 function create(diagnostics: Diagnostic[], only?: CodeActionKind[]): CodeActionContext;
1904 * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
1906 function is(value: any): value is CodeActionContext;
1909 * A code action represents a change that can be performed in code, e.g. to fix a problem or
1912 * A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed.
1914 export interface CodeAction {
1916 * A short, human-readable, title for this code action.
1920 * The kind of the code action.
1922 * Used to filter code actions.
1924 kind?: CodeActionKind;
1926 * The diagnostics that this code action resolves.
1928 diagnostics?: Diagnostic[];
1930 * Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
1933 * A quick fix should be marked preferred if it properly addresses the underlying error.
1934 * A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
1938 isPreferred?: boolean;
1940 * Marks that the code action cannot currently be applied.
1942 * Clients should follow the following guidelines regarding disabled code actions:
1944 * - Disabled code actions are not shown in automatic [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
1947 * - Disabled actions are shown as faded out in the code action menu when the user request a more specific type
1948 * of code action, such as refactorings.
1950 * - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)
1951 * that auto applies a code action and only a disabled code actions are returned, the client should show the user an
1952 * error message with `reason` in the editor.
1958 * Human readable description of why the code action is currently disabled.
1960 * This is displayed in the code actions UI.
1965 * The workspace edit this code action performs.
1967 edit?: WorkspaceEdit;
1969 * A command this code action executes. If a code action
1970 * provides a edit and a command, first the edit is
1971 * executed and then the command.
1975 * A data entry field that is preserved on a code action between
1976 * a `textDocument/codeAction` and a `codeAction/resolve` request.
1982 export declare namespace CodeAction {
1984 * Creates a new code action.
1986 * @param title The title of the code action.
1987 * @param kind The kind of the code action.
1989 function create(title: string, kind?: CodeActionKind): CodeAction;
1991 * Creates a new code action.
1993 * @param title The title of the code action.
1994 * @param command The command to execute.
1995 * @param kind The kind of the code action.
1997 function create(title: string, command: Command, kind?: CodeActionKind): CodeAction;
1999 * Creates a new code action.
2001 * @param title The title of the code action.
2002 * @param command The command to execute.
2003 * @param kind The kind of the code action.
2005 function create(title: string, edit: WorkspaceEdit, kind?: CodeActionKind): CodeAction;
2006 function is(value: any): value is CodeAction;
2009 * A code lens represents a [command](#Command) that should be shown along with
2010 * source text, like the number of references, a way to run tests, etc.
2012 * A code lens is _unresolved_ when no command is associated to it. For performance
2013 * reasons the creation of a code lens and resolving should be done to two stages.
2015 export interface CodeLens {
2017 * The range in which this code lens is valid. Should only span a single line.
2021 * The command this code lens represents.
2025 * A data entry field that is preserved on a code lens item between
2026 * a [CodeLensRequest](#CodeLensRequest) and a [CodeLensResolveRequest]
2027 * (#CodeLensResolveRequest)
2032 * The CodeLens namespace provides helper functions to work with
2033 * [CodeLens](#CodeLens) literals.
2035 export declare namespace CodeLens {
2037 * Creates a new CodeLens literal.
2039 function create(range: Range, data?: any): CodeLens;
2041 * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
2043 function is(value: any): value is CodeLens;
2046 * Value-object describing what options formatting should use.
2048 export interface FormattingOptions {
2050 * Size of a tab in spaces.
2054 * Prefer spaces over tabs.
2056 insertSpaces: boolean;
2058 * Trim trailing whitespaces on a line.
2062 trimTrailingWhitespace?: boolean;
2064 * Insert a newline character at the end of the file if one does not exist.
2068 insertFinalNewline?: boolean;
2070 * Trim all newlines after the final newline at the end of the file.
2074 trimFinalNewlines?: boolean;
2076 * Signature for further properties.
2078 [key: string]: boolean | integer | string | undefined;
2081 * The FormattingOptions namespace provides helper functions to work with
2082 * [FormattingOptions](#FormattingOptions) literals.
2084 export declare namespace FormattingOptions {
2086 * Creates a new FormattingOptions literal.
2088 function create(tabSize: uinteger, insertSpaces: boolean): FormattingOptions;
2090 * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
2092 function is(value: any): value is FormattingOptions;
2095 * A document link is a range in a text document that links to an internal or external resource, like another
2096 * text document or a web site.
2098 export interface DocumentLink {
2100 * The range this link applies to.
2104 * The uri this link points to.
2108 * The tooltip text when you hover over this link.
2110 * If a tooltip is provided, is will be displayed in a string that includes instructions on how to
2111 * trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
2112 * user settings, and localization.
2118 * A data entry field that is preserved on a document link between a
2119 * DocumentLinkRequest and a DocumentLinkResolveRequest.
2124 * The DocumentLink namespace provides helper functions to work with
2125 * [DocumentLink](#DocumentLink) literals.
2127 export declare namespace DocumentLink {
2129 * Creates a new DocumentLink literal.
2131 function create(range: Range, target?: string, data?: any): DocumentLink;
2133 * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
2135 function is(value: any): value is DocumentLink;
2138 * A selection range represents a part of a selection hierarchy. A selection range
2139 * may have a parent selection range that contains it.
2141 export interface SelectionRange {
2143 * The [range](#Range) of this selection range.
2147 * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
2149 parent?: SelectionRange;
2152 * The SelectionRange namespace provides helper function to work with
2153 * SelectionRange literals.
2155 export declare namespace SelectionRange {
2157 * Creates a new SelectionRange
2158 * @param range the range.
2159 * @param parent an optional parent.
2161 function create(range: Range, parent?: SelectionRange): SelectionRange;
2162 function is(value: any): value is SelectionRange;
2165 * Represents programming constructs like functions or constructors in the context
2166 * of call hierarchy.
2170 export interface CallHierarchyItem {
2172 * The name of this item.
2176 * The kind of this item.
2180 * Tags for this item.
2184 * More detail for this item, e.g. the signature of a function.
2188 * The resource identifier of this item.
2192 * The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
2196 * The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
2197 * Must be contained by the [`range`](#CallHierarchyItem.range).
2199 selectionRange: Range;
2201 * A data entry field that is preserved between a call hierarchy prepare and
2202 * incoming calls or outgoing calls requests.
2207 * Represents an incoming call, e.g. a caller of a method or constructor.
2211 export interface CallHierarchyIncomingCall {
2213 * The item that makes the call.
2215 from: CallHierarchyItem;
2217 * The ranges at which the calls appear. This is relative to the caller
2218 * denoted by [`this.from`](#CallHierarchyIncomingCall.from).
2220 fromRanges: Range[];
2223 * Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
2227 export interface CallHierarchyOutgoingCall {
2229 * The item that is called.
2231 to: CallHierarchyItem;
2233 * The range at which this item is called. This is the range relative to the caller, e.g the item
2234 * passed to [`provideCallHierarchyOutgoingCalls`](#CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls)
2235 * and not [`this.to`](#CallHierarchyOutgoingCall.to).
2237 fromRanges: Range[];
2239 export declare const EOL: string[];
2241 * A simple text document. Not to be implemented. The document keeps the content
2244 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
2246 export interface TextDocument {
2248 * The associated URI for this document. Most documents have the __file__-scheme, indicating that they
2249 * represent files on disk. However, some documents may have other schemes indicating that they are not
2250 * available on disk.
2254 readonly uri: DocumentUri;
2256 * The identifier of the language associated with this document.
2260 readonly languageId: string;
2262 * The version number of this document (it will increase after each
2263 * change, including undo/redo).
2267 readonly version: integer;
2269 * Get the text of this document. A substring can be retrieved by
2270 * providing a range.
2272 * @param range (optional) An range within the document to return.
2273 * If no range is passed, the full content is returned.
2274 * Invalid range positions are adjusted as described in [Position.line](#Position.line)
2275 * and [Position.character](#Position.character).
2276 * If the start range position is greater than the end range position,
2277 * then the effect of getText is as if the two positions were swapped.
2279 * @return The text of this document or a substring of the text if a
2280 * range is provided.
2282 getText(range?: Range): string;
2284 * Converts a zero-based offset to a position.
2286 * @param offset A zero-based offset.
2287 * @return A valid [position](#Position).
2289 positionAt(offset: uinteger): Position;
2291 * Converts the position to a zero-based offset.
2292 * Invalid positions are adjusted as described in [Position.line](#Position.line)
2293 * and [Position.character](#Position.character).
2295 * @param position A position.
2296 * @return A valid zero-based offset.
2298 offsetAt(position: Position): uinteger;
2300 * The number of lines in this document.
2304 readonly lineCount: uinteger;
2307 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
2309 export declare namespace TextDocument {
2311 * Creates a new ITextDocument literal from the given uri and content.
2312 * @param uri The document's uri.
2313 * @param languageId The document's language Id.
2314 * @param content The document's content.
2316 function create(uri: DocumentUri, languageId: string, version: integer, content: string): TextDocument;
2318 * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
2320 function is(value: any): value is TextDocument;
2321 function applyEdits(document: TextDocument, edits: TextEdit[]): string;