DocumentUri
A tagging type for string properties that are actually document URIs.
Type definition
export type DocumentUri = string;- Kind
- type alias
- Declaration
- typings/index.d.ts:16
All 554 public APIs exported from the types module, with declarations, documentation, and source-backed examples.
Generated from typings/index.d.ts @ 555f5ceon
A tagging type for string properties that are actually document URIs.
export type DocumentUri = string;Defines an integer in the range of -2^31 to 2^31 - 1.
export type integer = number;Defines an unsigned integer in the range of 0 to 2^31 - 1.
export type uinteger = number;Defines a decimal number. Since decimal numbers are very rare in the language server specification we denote the exact range with every decimal using the mathematics interval notations (e.g. [0, 1] denotes all decimals d with 0 <= d <= 1.
export type decimal = number;The LSP any type.
In the current implementation we map LSPAny to any. This is due to the fact that the TypeScript compilers can't infer string access signatures for interface correctly (it can though for types). See the following issue for details: microsoft/TypeScript issue #15300.
When the issue is addressed LSPAny can be defined as follows:
export type LSPAny = LSPObject | LSPArray | string | integer | uinteger | decimal | boolean | null | undefined;
export type LSPObject = { [key: string]: LSPAny };
export type LSPArray = LSPAny[];
Please note that strictly speaking a property with the value undefined
can't be converted into JSON preserving the property name. However for
convenience it is allowed and assumed that all these properties are
optional as well.
export type LSPAny = any;Type alias exported by coc.nvim.
export type LSPObject = object;Type alias exported by coc.nvim.
export type LSPArray = any[];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.
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. 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.
export interface Position {
line: uinteger;
character: uinteger;
}line: uinteger;Line position in a document (zero-based).
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. If a line number is negative, it defaults to 0.
character: uinteger;Character offset on a line in a document (zero-based).
The meaning of this offset is determined by the negotiated
PositionEncodingKind.
If the character value is greater than the line length it defaults back to the line length.
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:
{
start: { line: 5, character: 23 }
end : { line 6, character : 0 }
}Represents a location inside a resource, such as a line inside a text file.
export interface Location {
uri: DocumentUri;
range: Range;
}uri: DocumentUri;The document URI of the location.
range: Range;The range of the location.
export interface LocationLink {
originSelectionRange?: Range;
targetUri: DocumentUri;
targetRange: Range;
targetSelectionRange: Range;
}originSelectionRange?: Range;Span of the origin of this link.
Used as the underlined span for mouse interaction. Defaults to the word range at the definition position.
targetUri: DocumentUri;The target resource identifier of this link.
targetRange: Range;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.
targetSelectionRange: 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
Represents a color in RGBA space.
export interface Color {
readonly red: decimal;
readonly green: decimal;
readonly blue: decimal;
readonly alpha: decimal;
}readonly red: decimal;The red component of this color in the range [0-1].
readonly green: decimal;The green component of this color in the range [0-1].
readonly blue: decimal;The blue component of this color in the range [0-1].
readonly alpha: decimal;The alpha component of this color in the range [0-1].
Represents a color range from a document.
export interface ColorInformation {
range: Range;
color: Color;
}Interface exported by coc.nvim.
export interface ColorPresentation {
label: string;
textEdit?: TextEdit;
additionalTextEdits?: TextEdit[];
}label: string;The label of this color presentation. It will be shown on the color picker header. By default this is also the text that is inserted when selecting this color presentation.
textEdit?: TextEdit;additionalTextEdits?: TextEdit[];An optional array of additional text edits that are applied when selecting this color presentation. Edits must not overlap with the main edit nor with themselves.
A predefined folding range kind.
The type is a string since the value set is extensible
export type FoldingRangeKind = string;Represents a folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document. Clients are free to ignore invalid ranges.
export interface FoldingRange {
startLine: uinteger;
startCharacter?: uinteger;
endLine: uinteger;
endCharacter?: uinteger;
kind?: FoldingRangeKind;
collapsedText?: string;
}startLine: uinteger;The zero-based start line of the range to fold. The folded area starts after the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document.
startCharacter?: uinteger;The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
endLine: uinteger;The zero-based end line of the range to fold. The folded area ends with the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document.
endCharacter?: uinteger;The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
kind?: FoldingRangeKind;Describes the kind of the folding range such as `comment' or 'region'. The kind is used to categorize folding ranges and used by commands like 'Fold all comments'. See FoldingRangeKind for an enumeration of standardized kinds.
collapsedText?: string;The text that the client should show when the specified range is collapsed. If not defined or not supported by the client, a default will be chosen by the client.
Represents a related message and source code location for a diagnostic. This should be used to point to code locations that cause or related to a diagnostics, e.g when duplicating a symbol in a scope.
export interface DiagnosticRelatedInformation {
location: Location;
message: string;
}location: Location;The location of this related diagnostic information.
message: string;The message of this related diagnostic information.
Type alias exported by coc.nvim.
export type DiagnosticSeverity = 1 | 2 | 3 | 4;Type alias exported by coc.nvim.
export type DiagnosticTag = 1 | 2;Structure to capture a description for an error code.
export interface CodeDescription {
href: string;
}href: string;An URI to open with more information about the diagnostic error.
Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource.
export interface Diagnostic {
range: Range;
severity?: DiagnosticSeverity;
code?: integer | string;
codeDescription?: CodeDescription;
source?: string;
message: string;
tags?: DiagnosticTag[];
relatedInformation?: DiagnosticRelatedInformation[];
data?: LSPAny;
}range: Range;The range at which the message applies
severity?: DiagnosticSeverity;The diagnostic's severity. Can be omitted. If omitted it is up to the client to interpret diagnostics as error, warning, info or hint.
code?: integer | string;The diagnostic's code, which usually appear in the user interface.
codeDescription?: CodeDescription;An optional property to describe the error code. Requires the code field (above) to be present/not null.
source?: string;A human-readable string describing the source of this diagnostic, e.g. 'typescript' or 'super lint'. It usually appears in the user interface.
message: string;The diagnostic's message. It usually appears in the user interface
tags?: DiagnosticTag[];Additional metadata about the diagnostic.
relatedInformation?: DiagnosticRelatedInformation[];An array of related diagnostic information, e.g. when symbol-names within a scope collide all definitions can be marked via this property.
data?: LSPAny;A data entry field that is preserved between a textDocument/publishDiagnostics
notification and textDocument/codeAction request.
Represents a reference to a command. Provides a title which will be used to represent a command in the UI and, optionally, an array of arguments which will be passed to the command handler function when invoked.
export interface Command {
title: string;
command: string;
arguments?: LSPAny[];
}title: string;Title of the command, like save.
command: string;The identifier of the actual command handler.
arguments?: LSPAny[];Arguments that the command handler should be invoked with.
A text edit applicable to a text document.
export interface TextEdit {
range: Range;
newText: string;
}range: Range;The range of the text document to be manipulated. To insert text into a document create a range where start === end.
newText: string;The string to be inserted. For delete operations use an empty string.
Additional information that describes document changes.
export interface ChangeAnnotation {
label: string;
needsConfirmation?: boolean;
description?: string;
}label: string;A human-readable string describing the actual change. The string is rendered prominent in the user interface.
needsConfirmation?: boolean;A flag which indicates that user confirmation is needed before applying the change.
description?: string;A human-readable string which is rendered less prominent in the user interface.
An identifier to refer to a change annotation stored with a workspace edit.
export type ChangeAnnotationIdentifier = string;A special text edit with an additional change annotation.
export interface AnnotatedTextEdit extends TextEdit {
annotationId: ChangeAnnotationIdentifier;
}annotationId: ChangeAnnotationIdentifier;The actual identifier of the change annotation
Describes textual changes on a text document. A TextDocumentEdit describes all changes on a document version Si and after they are applied move the document to version Si+1. So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any kind of ordering. However the edits must be non overlapping.
export interface TextDocumentEdit {
textDocument: OptionalVersionedTextDocumentIdentifier;
edits: (TextEdit | AnnotatedTextEdit | SnippetTextEdit)[];
}textDocument: OptionalVersionedTextDocumentIdentifier;The text document to change.
edits: (TextEdit | AnnotatedTextEdit | SnippetTextEdit)[];The edits to be applied.
A generic resource operation.
interface ResourceOperation {
kind: string;
annotationId?: ChangeAnnotationIdentifier;
}kind: string;The resource operation kind.
annotationId?: ChangeAnnotationIdentifier;An optional annotation identifier describing the operation.
Options to create a file.
export interface CreateFileOptions {
overwrite?: boolean;
ignoreIfExists?: boolean;
}overwrite?: boolean;Overwrite existing file. Overwrite wins over ignoreIfExists
ignoreIfExists?: boolean;Ignore if exists.
Create file operation.
export interface CreateFile extends ResourceOperation {
kind: 'create';
uri: DocumentUri;
options?: CreateFileOptions;
}kind: 'create';A create
uri: DocumentUri;The resource to create.
options?: CreateFileOptions;Additional options
Rename file options
export interface RenameFileOptions {
overwrite?: boolean;
ignoreIfExists?: boolean;
}overwrite?: boolean;Overwrite target if existing. Overwrite wins over ignoreIfExists
ignoreIfExists?: boolean;Ignores if target exists.
Rename file operation
export interface RenameFile extends ResourceOperation {
kind: 'rename';
oldUri: DocumentUri;
newUri: DocumentUri;
options?: RenameFileOptions;
}kind: 'rename';A rename
oldUri: DocumentUri;The old (existing) location.
newUri: DocumentUri;The new location.
options?: RenameFileOptions;Rename options.
Delete file options
export interface DeleteFileOptions {
recursive?: boolean;
ignoreIfNotExists?: boolean;
}recursive?: boolean;Delete the content recursively if a folder is denoted.
ignoreIfNotExists?: boolean;Ignore the operation if the file doesn't exist.
Delete file operation
export interface DeleteFile extends ResourceOperation {
kind: 'delete';
uri: DocumentUri;
options?: DeleteFileOptions;
}kind: 'delete';A delete
uri: DocumentUri;The file to delete.
options?: DeleteFileOptions;Delete options.
A workspace edit represents changes to many resources managed in the workspace. The edit
should either provide changes or documentChanges. If documentChanges are present
they are preferred over changes if the client can handle versioned document edits.
Since version 3.13.0 a workspace edit can contain resource operations as well. If resource operations are present clients need to execute the operations in the order in which they are provided. So a workspace edit for example can consist of the following two changes: (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.
An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will
cause failure of the operation. How the client recovers from the failure is described by
the client capability: workspace.workspaceEdit.failureHandling
export interface WorkspaceEdit {
changes?: {
[uri: DocumentUri]: TextEdit[];
};
documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[];
changeAnnotations?: {
[id: ChangeAnnotationIdentifier]: ChangeAnnotation;
};
}changes?: {
[uri: DocumentUri]: TextEdit[];
};Holds changes to existing resources.
documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[];Depending on the client capability workspace.workspaceEdit.resourceOperations document changes
are either an array of TextDocumentEdits to express changes to n different text documents
where each text document edit addresses a specific version of a text document. Or it can contain
above TextDocumentEdits mixed with create, rename and delete file / folder operations.
Whether a client supports versioned document edits is expressed via
workspace.workspaceEdit.documentChanges client capability.
If a client neither supports documentChanges nor workspace.workspaceEdit.resourceOperations then
only plain TextEdits using the changes property are supported.
changeAnnotations?: {
[id: ChangeAnnotationIdentifier]: ChangeAnnotation;
};A map of change annotations that can be referenced in AnnotatedTextEdits or create, rename and
delete file / folder operations.
Whether clients honor this property depends on the client capability workspace.changeAnnotationSupport.
A change to capture text edits for existing resources.
export interface TextEditChange {
all(): (TextEdit | AnnotatedTextEdit)[];
clear(): void;
add(edit: TextEdit | AnnotatedTextEdit): void;
insert(position: Position, newText: string): void;
insert(position: Position, newText: string, annotation: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;
replace(range: Range, newText: string): void;
replace(range: Range, newText: string, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;
delete(range: Range): void;
delete(range: Range, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;
}all(): (TextEdit | AnnotatedTextEdit)[];Gets all text edits for this change.
clear(): void;Clears the edits for this change.
add(edit: TextEdit | AnnotatedTextEdit): void;Adds a text edit.
insert(position: Position, newText: string): void;Insert the given text at the given position.
insert(position: Position, newText: string, annotation: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;Insert the given text at the given position with an annotation.
replace(range: Range, newText: string): void;Replace the given range with given text for the given resource.
replace(range: Range, newText: string, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;Replace the given range with given text with an annotation.
delete(range: Range): void;Delete the text at the given range.
delete(range: Range, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier): ChangeAnnotationIdentifier;Delete the text at the given range with an annotation.
A workspace change helps constructing changes to a workspace.
export class WorkspaceChange {
private _workspaceEdit;
private _textEditChanges;
private _changeAnnotations;
constructor(workspaceEdit?: WorkspaceEdit);
get edit(): WorkspaceEdit;
getTextEditChange(textDocument: OptionalVersionedTextDocumentIdentifier): TextEditChange;
getTextEditChange(uri: DocumentUri): TextEditChange;
private initDocumentChanges;
private initChanges;
createFile(uri: DocumentUri, options?: CreateFileOptions): void;
createFile(uri: DocumentUri, annotation: ChangeAnnotation | ChangeAnnotationIdentifier, options?: CreateFileOptions): ChangeAnnotationIdentifier;
renameFile(oldUri: DocumentUri, newUri: DocumentUri, options?: RenameFileOptions): void;
renameFile(oldUri: DocumentUri, newUri: DocumentUri, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier, options?: RenameFileOptions): ChangeAnnotationIdentifier;
deleteFile(uri: DocumentUri, options?: DeleteFileOptions): void;
deleteFile(uri: DocumentUri, annotation: ChangeAnnotation | ChangeAnnotationIdentifier, options?: DeleteFileOptions): ChangeAnnotationIdentifier;
}private _workspaceEdit;private _textEditChanges;private _changeAnnotations;constructor(workspaceEdit?: WorkspaceEdit);get edit(): WorkspaceEdit;Returns the underlying WorkspaceEdit literal use to be returned from a workspace edit operation like rename.
getTextEditChange(textDocument: OptionalVersionedTextDocumentIdentifier): TextEditChange;Returns the TextEditChange to manage text edits for resources.
getTextEditChange(uri: DocumentUri): TextEditChange;private initDocumentChanges;private initChanges;createFile(uri: DocumentUri, options?: CreateFileOptions): void;Create a file in the workspace edit.
createFile(uri: DocumentUri, annotation: ChangeAnnotation | ChangeAnnotationIdentifier, options?: CreateFileOptions): ChangeAnnotationIdentifier;Create a file in the workspace edit with an annotation.
renameFile(oldUri: DocumentUri, newUri: DocumentUri, options?: RenameFileOptions): void;Rename a file in the workspace edit.
renameFile(oldUri: DocumentUri, newUri: DocumentUri, annotation?: ChangeAnnotation | ChangeAnnotationIdentifier, options?: RenameFileOptions): ChangeAnnotationIdentifier;Rename a file in the workspace edit with an annotation.
deleteFile(uri: DocumentUri, options?: DeleteFileOptions): void;Delete a file in the workspace edit.
deleteFile(uri: DocumentUri, annotation: ChangeAnnotation | ChangeAnnotationIdentifier, options?: DeleteFileOptions): ChangeAnnotationIdentifier;Delete a file in the workspace edit with an annotation.
A literal to identify a text document in the client.
export interface TextDocumentIdentifier {
uri: DocumentUri;
}uri: DocumentUri;The text document's uri.
A text document identifier to denote a specific version of a text document.
export interface VersionedTextDocumentIdentifier extends TextDocumentIdentifier {
version: integer;
}version: integer;The version number of this document.
A text document identifier to optionally denote a specific version of a text document.
export interface OptionalVersionedTextDocumentIdentifier extends TextDocumentIdentifier {
version: integer | null;
}version: integer | null;The version number of this document. If a versioned text document identifier
is sent from the server to the client and the file is not open in the editor
(the server has not received an open notification before) the server can send
null to indicate that the version is unknown and the content on disk is the
truth (as specified with document content ownership).
An item to transfer a text document from the client to the server.
export interface TextDocumentItem {
uri: DocumentUri;
languageId: string;
version: integer;
text: string;
}uri: DocumentUri;The text document's uri.
languageId: string;The text document's language identifier.
version: integer;The version number of this document (it will increase after each change, including undo/redo).
text: string;The content of the opened text document.
Type alias exported by coc.nvim.
export type MarkupKind = 'plaintext' | 'markdown';A MarkupContent literal represents a string value which content is interpreted base on its
kind flag. Currently the protocol supports plaintext and markdown as markup kinds.
If the kind is markdown then the value can contain fenced code blocks like in GitHub issues.
See GitHub documentation
Here is an example how such a string can be constructed using JavaScript / TypeScript:
let markdown: MarkdownContent = {
kind: MarkupKind.Markdown,
value: [
'# Header',
'Some text',
'```typescript',
'someCode();',
'```'
].join('\n')
};
Please Note that clients might sanitize the return markdown. A client could decide to remove HTML from the markdown to avoid script execution.
export interface MarkupContent {
kind: MarkupKind;
value: string;
}kind: MarkupKind;The type of the Markup
value: string;The content itself
Type alias exported by coc.nvim.
export 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;Type alias exported by coc.nvim.
export type InsertTextFormat = 1 | 2;Type alias exported by coc.nvim.
export type CompletionItemTag = 1;A special text edit to provide an insert and a replace operation.
export interface InsertReplaceEdit {
newText: string;
insert: Range;
replace: Range;
}Type alias exported by coc.nvim.
export type InsertTextMode = 1 | 2;Additional details for a completion item label.
export interface CompletionItemLabelDetails {
detail?: string;
description?: string;
}detail?: string;An optional string which is rendered less prominently directly after label, without any spacing. Should be used for function signatures and type annotations.
description?: string;An optional string which is rendered less prominently after . Should be used for fully qualified names and file paths.
A completion item represents a text snippet that is proposed to complete text that is being typed.
export interface CompletionItem {
label: string;
labelDetails?: CompletionItemLabelDetails;
kind?: CompletionItemKind;
tags?: CompletionItemTag[];
detail?: string;
documentation?: string | MarkupContent;
deprecated?: boolean;
preselect?: boolean;
sortText?: string;
filterText?: string;
insertText?: string;
insertTextFormat?: InsertTextFormat;
insertTextMode?: InsertTextMode;
textEdit?: TextEdit | InsertReplaceEdit;
textEditText?: string;
additionalTextEdits?: TextEdit[];
commitCharacters?: string[];
command?: Command;
data?: LSPAny;
}label: string;The label of this completion item.
The label property is also by default the text that is inserted when selecting this completion.
If label details are provided the label itself should be an unqualified name of the completion item.
labelDetails?: CompletionItemLabelDetails;Additional details for the label
kind?: CompletionItemKind;The kind of this completion item. Based of the kind an icon is chosen by the editor.
tags?: CompletionItemTag[];Tags for this completion item.
detail?: string;A human-readable string with additional information about this item, like type or symbol information.
documentation?: string | MarkupContent;A human-readable string that represents a doc-comment.
deprecated?: boolean;Indicates if this item is deprecated.
preselect?: boolean;Select this item when showing.
Note that only one completion item can be selected and that the tool / client decides which item that is. The rule is that the first item of those that match best is selected.
sortText?: string;A string that should be used when comparing this item
with other items. When falsy the label
is used.
filterText?: string;A string that should be used when filtering a set of
completion items. When falsy the label
is used.
insertText?: string;A string that should be inserted into a document when selecting
this completion. When falsy the label
is used.
The insertText is subject to interpretation by the client side.
Some tools might not take the string literally. For example
VS Code when code complete is requested in this example
con<cursor position> and a completion item with an insertText of
console is provided it will only insert sole. Therefore it is
recommended to use textEdit instead since it avoids additional client
side interpretation.
insertTextFormat?: InsertTextFormat;The format of the insert text. The format applies to both the
insertText property and the newText property of a provided
textEdit. If omitted defaults to InsertTextFormat.PlainText.
Please note that the insertTextFormat doesn't apply to
additionalTextEdits.
insertTextMode?: InsertTextMode;How whitespace and indentation is handled during completion
item insertion. If not provided the clients default value depends on
the textDocument.completion.insertTextMode client capability.
textEdit?: TextEdit | InsertReplaceEdit;An edit which is applied to a document when selecting this completion. When an edit is provided the value of insertText is ignored.
Most editors support two different operations when accepting a completion
item. One is to insert a completion text and the other is to replace an
existing text with a completion text. Since this can usually not be
predetermined by a server it can report both ranges. Clients need to
signal support for InsertReplaceEdits via the
textDocument.completion.insertReplaceSupport client capability
property.
Note 1: The text edit's range as well as both ranges from an insert
replace edit must be a [single line] and they must contain the position
at which completion has been requested.
Note 2: If an InsertReplaceEdit is returned the edit's insert range
must be a prefix of the edit's replace range, that means it must be
contained and starting at the same position.
textEditText?: string;The edit text used if the completion item is part of a CompletionList and CompletionList defines an item default for the text edit range.
Clients will only honor this property if they opt into completion list
item defaults using the capability completionList.itemDefaults.
If not provided and a list's default range is provided the label property is used as a text.
additionalTextEdits?: TextEdit[];An optional array of additional text edits that are applied when selecting this completion. Edits must not overlap (including the same insert position) with the main edit nor with themselves.
Additional text edits should be used to change text unrelated to the current cursor position (for example adding an import statement at the top of the file if the completion item will insert an unqualified type).
commitCharacters?: string[];An optional set of characters that when pressed while this completion is active will accept it first and
then type that character. Note that all commit characters should have length=1 and that superfluous
characters will be ignored.
command?: Command;An optional command that is executed after inserting this completion. Note that additional modifications to the current document should be described with the additionalTextEdits-property.
data?: LSPAny;A data entry field that is preserved on a completion item between a
CompletionRequest and a CompletionResolveRequest.
export interface CompletionList {
isIncomplete: boolean;
itemDefaults?: {
commitCharacters?: string[];
editRange?: Range | {
insert: Range;
replace: Range;
};
insertTextFormat?: InsertTextFormat;
insertTextMode?: InsertTextMode;
data?: LSPAny;
};
items: CompletionItem[];
}isIncomplete: boolean;This list it not complete. Further typing results in recomputing this list.
Recomputed lists have all their items replaced (not appended) in the incomplete completion sessions.
itemDefaults?: {
commitCharacters?: string[];
editRange?: Range | {
insert: Range;
replace: Range;
};
insertTextFormat?: InsertTextFormat;
insertTextMode?: InsertTextMode;
data?: LSPAny;
};In many cases the items of an actual completion result share the same
value for properties like commitCharacters or the range of a text
edit. A completion list can therefore define item defaults which will
be used if a completion item itself doesn't specify the value.
If a completion list specifies a default value and a completion item also specifies a corresponding value the one from the item is used.
Servers are only allowed to return default values if the client
signals support for this via the completionList.itemDefaults
capability.
items: CompletionItem[];The completion items.
MarkedString can be used to render human readable text. It is either a markdown string or a code-block that provides a language and a code snippet. The language identifier is semantically equal to the optional language identifier in fenced code blocks in GitHub issues. See GitHub documentation
The pair of a language and a value is an equivalent to markdown:
${value}
Note that markdown strings will be sanitized - that means html will be escaped.
export type MarkedString = string | {
language: string;
value: string;
};The result of a hover request.
export interface Hover {
contents: MarkupContent | MarkedString | MarkedString[];
range?: Range;
}contents: MarkupContent | MarkedString | MarkedString[];The hover's content
range?: Range;An optional range inside the text document that is used to visualize the hover, e.g. by changing the background color.
Represents a parameter of a callable-signature. A parameter can have a label and a doc-comment.
export interface ParameterInformation {
label: string | [
uinteger,
uinteger
];
documentation?: string | MarkupContent;
}label: string | [
uinteger,
uinteger
];The label of this parameter information.
Either a string or an inclusive start and exclusive end offsets within its containing
signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
string representation as Position and Range does.
Note: a label of type string should be a substring of its containing signature label.
Its intended use case is to highlight the parameter label part in the SignatureInformation.label.
documentation?: string | MarkupContent;The human-readable doc-comment of this parameter. Will be shown in the UI but can be omitted.
Represents the signature of something callable. A signature can have a label, like a function-name, a doc-comment, and a set of parameters.
export interface SignatureInformation {
label: string;
documentation?: string | MarkupContent;
parameters?: ParameterInformation[];
activeParameter?: uinteger;
}label: string;The label of this signature. Will be shown in the UI.
documentation?: string | MarkupContent;The human-readable doc-comment of this signature. Will be shown in the UI but can be omitted.
parameters?: ParameterInformation[];The parameters of this signature.
activeParameter?: uinteger;The index of the active parameter.
If provided, this is used in place of SignatureHelp.activeParameter.
Signature help represents the signature of something callable. There can be multiple signature but only one active and only one active parameter.
export interface SignatureHelp {
signatures: SignatureInformation[];
activeSignature?: uinteger;
activeParameter?: uinteger;
}signatures: SignatureInformation[];One or more signatures.
activeSignature?: uinteger;The active signature. If omitted or the value lies outside the
range of signatures the value defaults to zero or is ignored if
the SignatureHelp has no signatures.
Whenever possible implementors should make an active decision about the active signature and shouldn't rely on a default value.
In future version of the protocol this property might become mandatory to better express this.
activeParameter?: uinteger;The active parameter of the active signature. If omitted or the value
lies outside the range of signatures[activeSignature].parameters
defaults to 0 if the active signature has parameters. If
the active signature has no parameters it is ignored.
In future version of the protocol this property might become
mandatory to better express the active parameter if the
active signature does have any.
export type Definition = Location | Location[];export type DefinitionLink = LocationLink;export type Declaration = Location | Location[];export type DeclarationLink = LocationLink;Value-object that contains additional information when requesting references.
export interface ReferenceContext {
includeDeclaration: boolean;
}includeDeclaration: boolean;Include the declaration of the current symbol.
Type alias exported by coc.nvim.
export type DocumentHighlightKind = 1 | 2 | 3;A document highlight is a range inside a text document which deserves special attention. Usually a document highlight is visualized by changing the background color of its range.
export interface DocumentHighlight {
range: Range;
kind?: DocumentHighlightKind;
}range: Range;The range this highlight applies to.
kind?: DocumentHighlightKind;The highlight kind, default is text.
Type alias exported by coc.nvim.
export 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;Type alias exported by coc.nvim.
export type SymbolTag = 1;A base for all symbol information.
export interface BaseSymbolInformation {
name: string;
kind: SymbolKind;
tags?: SymbolTag[];
containerName?: string;
}name: string;The name of this symbol.
kind: SymbolKind;The kind of this symbol.
tags?: SymbolTag[];Tags for this symbol.
containerName?: string;The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can't be used to re-infer a hierarchy for the document symbols.
Represents information about programming constructs like variables, classes, interfaces etc.
export interface SymbolInformation extends BaseSymbolInformation {
deprecated?: boolean;
location: Location;
}deprecated?: boolean;Indicates if this symbol is deprecated.
location: Location;The location of this symbol. The location's range is used by a tool to reveal the location in the editor. If the symbol is selected in the tool the range's start information is used to position the cursor. So the range usually spans more than the actual symbol's name and does normally include things like visibility modifiers.
The range doesn't have to denote a node range in the sense of an abstract syntax tree. It can therefore not be used to re-construct a hierarchy of the symbols.
A special workspace symbol that supports locations without a range.
See also SymbolInformation.
export interface WorkspaceSymbol extends BaseSymbolInformation {
location: Location | {
uri: DocumentUri;
};
data?: LSPAny;
}location: Location | {
uri: DocumentUri;
};The location of the symbol. Whether a server is allowed to
return a location without a range depends on the client
capability workspace.symbol.resolveSupport.
See SymbolInformation#location for more details.
data?: LSPAny;A data entry field that is preserved on a workspace symbol between a workspace symbol request and a workspace symbol resolve request.
Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, e.g. the range of an identifier.
export interface DocumentSymbol {
name: string;
detail?: string;
kind: SymbolKind;
tags?: SymbolTag[];
deprecated?: boolean;
range: Range;
selectionRange: Range;
children?: DocumentSymbol[];
}name: string;The name of this symbol. Will be displayed in the user interface and therefore must not be an empty string or a string only consisting of white spaces.
detail?: string;More detail for this symbol, e.g the signature of a function.
kind: SymbolKind;The kind of this symbol.
tags?: SymbolTag[];Tags for this document symbol.
deprecated?: boolean;Indicates if this symbol is deprecated.
range: Range;The range enclosing this symbol not including leading/trailing whitespace but everything else like comments. This information is typically used to determine if the clients cursor is inside the symbol to reveal in the symbol in the UI.
selectionRange: Range;The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
Must be contained by the range.
children?: DocumentSymbol[];Children of this symbol, e.g. properties of a class.
The kind of a code action.
Kinds are a hierarchical list of identifiers separated by ., e.g. "refactor.extract.function".
The set of kinds is open and client needs to announce the kinds it supports to the server during initialization.
export type CodeActionKind = string;Type alias exported by coc.nvim.
export type CodeActionTriggerKind = 1 | 2;Contains additional diagnostic information about the context in which a code action is run.
export interface CodeActionContext {
diagnostics: Diagnostic[];
only?: CodeActionKind[];
triggerKind?: CodeActionTriggerKind;
}diagnostics: Diagnostic[];An array of diagnostics known on the client side overlapping the range provided to the
textDocument/codeAction request. They are provided so that the server knows which
errors are currently presented to the user for the given range. There is no guarantee
that these accurately reflect the error state of the resource. The primary parameter
to compute code actions is the provided range.
only?: CodeActionKind[];Requested kind of actions to return.
Actions not of this kind are filtered out by the client before being shown. So servers can omit computing them.
triggerKind?: CodeActionTriggerKind;The reason why code actions were requested.
A code action represents a change that can be performed in code, e.g. to fix a problem or to refactor code.
A CodeAction must set either edit and/or a command. If both are supplied, the edit is applied first, then the command is executed.
export interface CodeAction {
title: string;
kind?: CodeActionKind;
diagnostics?: Diagnostic[];
isPreferred?: boolean;
disabled?: {
reason: string;
};
edit?: WorkspaceEdit;
command?: Command;
data?: LSPAny;
}title: string;A short, human-readable, title for this code action.
kind?: CodeActionKind;The kind of the code action.
Used to filter code actions.
diagnostics?: Diagnostic[];The diagnostics that this code action resolves.
isPreferred?: boolean;Marks this as a preferred action. Preferred actions are used by the auto fix command and can be targeted
by keybindings.
A quick fix should be marked preferred if it properly addresses the underlying error. A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
disabled?: {
reason: string;
};Marks that the code action cannot currently be applied.
Clients should follow the following guidelines regarding disabled code actions:
Disabled code actions are not shown in automatic lightbulbs code action menus.
Disabled actions are shown as faded out in the code action menu when the user requests a more specific type of code action, such as refactorings.
If the user has a keybinding
that auto applies a code action and only disabled code actions are returned, the client should show the user an
error message with reason in the editor.
edit?: WorkspaceEdit;The workspace edit this code action performs.
command?: Command;A command this code action executes. If a code action provides an edit and a command, first the edit is executed and then the command.
data?: LSPAny;A data entry field that is preserved on a code action between
a textDocument/codeAction and a codeAction/resolve request.
A code lens represents a command that should be shown along with source text, like the number of references, a way to run tests, etc.
A code lens is unresolved when no command is associated to it. For performance reasons the creation of a code lens and resolving should be done in two stages.
Value-object describing what options formatting should use.
export interface FormattingOptions {
tabSize: uinteger;
insertSpaces: boolean;
trimTrailingWhitespace?: boolean;
insertFinalNewline?: boolean;
trimFinalNewlines?: boolean;
[key: string]: boolean | integer | string | undefined;
}tabSize: uinteger;Size of a tab in spaces.
insertSpaces: boolean;Prefer spaces over tabs.
trimTrailingWhitespace?: boolean;Trim trailing whitespace on a line.
insertFinalNewline?: boolean;Insert a newline character at the end of the file if one does not exist.
trimFinalNewlines?: boolean;Trim all newlines after the final newline at the end of the file.
[key: string]: boolean | integer | string | undefined;Signature for further properties.
A document link is a range in a text document that links to an internal or external resource, like another text document or a web site.
export interface DocumentLink {
range: Range;
target?: string;
tooltip?: string;
data?: LSPAny;
}range: Range;The range this link applies to.
target?: string;The uri this link points to. If missing a resolve request is sent later.
tooltip?: string;The tooltip text when you hover over this link.
If a tooltip is provided, is will be displayed in a string that includes instructions on how to
trigger the link, such as {0} (ctrl + click). The specific instructions vary depending on OS,
user settings, and localization.
data?: LSPAny;A data entry field that is preserved on a document link between a DocumentLinkRequest and a DocumentLinkResolveRequest.
A selection range represents a part of a selection hierarchy. A selection range may have a parent selection range that contains it.
export interface SelectionRange {
range: Range;
parent?: SelectionRange;
}parent?: SelectionRange;The parent selection range containing this range. Therefore parent.range must contain this.range.
Represents programming constructs like functions or constructors in the context of call hierarchy.
export interface CallHierarchyItem {
name: string;
kind: SymbolKind;
tags?: SymbolTag[];
detail?: string;
uri: DocumentUri;
range: Range;
selectionRange: Range;
data?: LSPAny;
}name: string;The name of this item.
kind: SymbolKind;The kind of this item.
tags?: SymbolTag[];Tags for this item.
detail?: string;More detail for this item, e.g. the signature of a function.
uri: DocumentUri;The resource identifier of this item.
range: Range;The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
selectionRange: Range;The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
Must be contained by the range.
data?: LSPAny;A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing calls requests.
Represents an incoming call, e.g. a caller of a method or constructor.
export interface CallHierarchyIncomingCall {
from: CallHierarchyItem;
fromRanges: Range[];
}from: CallHierarchyItem;The item that makes the call.
Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
export interface CallHierarchyOutgoingCall {
to: CallHierarchyItem;
fromRanges: Range[];
}to: CallHierarchyItem;The item that is called.
A set of predefined token types. This set is not fixed an clients can specify additional token types via the corresponding client capabilities.
export enum SemanticTokenTypes {
namespace = "namespace",
type = "type",
class = "class",
enum = "enum",
interface = "interface",
struct = "struct",
typeParameter = "typeParameter",
parameter = "parameter",
variable = "variable",
property = "property",
enumMember = "enumMember",
event = "event",
function = "function",
method = "method",
macro = "macro",
keyword = "keyword",
modifier = "modifier",
comment = "comment",
string = "string",
number = "number",
regexp = "regexp",
operator = "operator",
decorator = "decorator",
label = "label"
}namespace = "namespace"type = "type"Represents a generic type. Acts as a fallback for types which can't be mapped to a specific type like class or enum.
class = "class"enum = "enum"interface = "interface"struct = "struct"typeParameter = "typeParameter"parameter = "parameter"variable = "variable"property = "property"enumMember = "enumMember"event = "event"function = "function"method = "method"macro = "macro"keyword = "keyword"modifier = "modifier"comment = "comment"string = "string"number = "number"regexp = "regexp"operator = "operator"decorator = "decorator"label = "label"A set of predefined token modifiers. This set is not fixed an clients can specify additional token types via the corresponding client capabilities.
export enum SemanticTokenModifiers {
declaration = "declaration",
definition = "definition",
readonly = "readonly",
static = "static",
deprecated = "deprecated",
abstract = "abstract",
async = "async",
modification = "modification",
documentation = "documentation",
defaultLibrary = "defaultLibrary"
}declaration = "declaration"definition = "definition"readonly = "readonly"static = "static"deprecated = "deprecated"abstract = "abstract"async = "async"modification = "modification"documentation = "documentation"defaultLibrary = "defaultLibrary"Interface exported by coc.nvim.
export interface SemanticTokensLegend {
tokenTypes: string[];
tokenModifiers: string[];
}tokenTypes: string[];The token types a server uses.
tokenModifiers: string[];The token modifiers a server uses.
Interface exported by coc.nvim.
export interface SemanticTokens {
resultId?: string;
data: uinteger[];
}resultId?: string;An optional result id. If provided and clients support delta updating the client will include the result id in the next semantic token request. A server can then instead of computing all semantic tokens again simply send a delta.
data: uinteger[];The actual tokens.
Interface exported by coc.nvim.
export interface SemanticTokensEdit {
start: uinteger;
deleteCount: uinteger;
data?: uinteger[];
}Interface exported by coc.nvim.
export interface SemanticTokensDelta {
readonly resultId?: string;
edits: SemanticTokensEdit[];
}readonly resultId?: string;The result id of the delta, undefined when the delta is a full result.
edits: SemanticTokensEdit[];The semantic token edits to transform a previous result into a new result.
Type alias exported by coc.nvim.
export type TypeHierarchyItem = {
name: string;
kind: SymbolKind;
tags?: SymbolTag[];
detail?: string;
uri: DocumentUri;
range: Range;
selectionRange: Range;
data?: LSPAny;
};Provide inline value as text.
export type InlineValueText = {
range: Range;
text: string;
};Provide inline value through a variable lookup. If only a range is specified, the variable name will be extracted from the underlying document. An optional variable name can be used to override the extracted name.
export type InlineValueVariableLookup = {
range: Range;
variableName?: string;
caseSensitiveLookup: boolean;
};Provide an inline value through an expression evaluation. If only a range is specified, the expression will be extracted from the underlying document. An optional expression can be used to override the extracted expression.
export type InlineValueEvaluatableExpression = {
range: Range;
expression?: string;
};Inline value information can be provided by different means:
export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression;Type alias exported by coc.nvim.
export type InlineValueContext = {
frameId: integer;
stoppedLocation: Range;
};Type alias exported by coc.nvim.
export type InlayHintKind = 1 | 2;An inlay hint label part allows for interactive and composite labels of inlay hints.
export type InlayHintLabelPart = {
value: string;
tooltip?: string | MarkupContent;
location?: Location;
command?: Command;
};Inlay hint information.
export type InlayHint = {
position: Position;
label: string | InlayHintLabelPart[];
kind?: InlayHintKind;
textEdits?: TextEdit[];
tooltip?: string | MarkupContent;
paddingLeft?: boolean;
paddingRight?: boolean;
data?: LSPAny;
};A workspace folder inside a client.
export interface WorkspaceFolder {
uri: string;
name: string;
}uri: string;The associated URI for this workspace folder.
name: string;The name of the workspace folder. Used to refer to this workspace folder in the user interface.
A simple text document. Not to be implemented. The document keeps the content as string.
export interface TextDocument {
readonly uri: DocumentUri;
readonly languageId: string;
readonly version: integer;
getText(range?: Range): string;
positionAt(offset: uinteger): Position;
offsetAt(position: Position): uinteger;
readonly lineCount: uinteger;
}readonly uri: DocumentUri;The associated URI for this document. Most documents have the file-scheme, indicating that they represent files on disk. However, some documents may have other schemes indicating that they are not available on disk.
readonly languageId: string;The identifier of the language associated with this document.
readonly version: integer;The version number of this document (it will increase after each change, including undo/redo).
getText(range?: Range): string;Get the text of this document. A substring can be retrieved by providing a range.
offsetAt(position: Position): uinteger;Converts the position to a zero-based offset. Invalid positions are adjusted as described in Position.line and Position.character.
readonly lineCount: uinteger;The number of lines in this document.
Interface exported by coc.nvim.
export interface InlineCompletionOption {
provider?: string;
autoTrigger?: boolean;
}provider?: string;The provider name, extension name or LanguageClient id.
autoTrigger?: boolean;Set trigger kind to InlineCompletionTriggerKind.Automatic when true.
Type alias exported by coc.nvim.
export type InlineCompletionTriggerKind = 1 | 2;Describes the currently selected completion item.
export type SelectedCompletionInfo = {
range: Range;
text: string;
};Provides information about the context in which an inline completion was requested.
export type InlineCompletionContext = {
triggerKind: InlineCompletionTriggerKind;
selectedCompletionInfo?: SelectedCompletionInfo;
};A string value used as a snippet is a template which allows to insert text and to control the editor cursor when insertion happens.
A snippet can define tab stops and placeholders with $1, $2
and ${3:foo}. $0 defines the final tab stop, it defaults to
the end of the snippet. Variables are defined with $name and
${name:default value}.
export type StringValue = {
kind: 'snippet';
value: string;
};An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.
export interface InlineCompletionItem {
insertText: string | StringValue;
filterText?: string;
range?: Range;
command?: Command;
}insertText: string | StringValue;The text to replace the range with. Must be set.
filterText?: string;A text that is used to decide if this inline completion should be shown. When falsy the is used.
range?: Range;The range to replace. Must begin and end on the same line.
command?: Command;An optional that is executed after inserting this completion.
Represents a collection of inline completion items to be presented in the editor.
export interface InlineCompletionList {
items: InlineCompletionItem[];
}items: InlineCompletionItem[];The inline completion items
An interactive text edit.
export interface SnippetTextEdit {
range: Range;
snippet: StringValue;
annotationId?: ChangeAnnotationIdentifier;
}range: Range;The range of the text document to be manipulated.
snippet: StringValue;The snippet to be inserted.
annotationId?: ChangeAnnotationIdentifier;The actual identifier of the snippet edit.
Defines how values from a set of defaults and an individual item will be merged.
export type ApplyKind = 1 | 2;Additional data about a workspace edit.
export type WorkspaceEditMetadata = {
isRefactoring?: boolean;
};The parameters passed via an apply workspace edit request.
export interface ApplyWorkspaceEditParams {
label?: string;
edit: WorkspaceEdit;
metadata?: WorkspaceEditMetadata;
}label?: string;An optional label of the workspace edit. This label is presented in the user interface for example on an undo stack to undo the workspace edit.
edit: WorkspaceEdit;The edits to apply.
metadata?: WorkspaceEditMetadata;Additional data about the edit.
The result returned from the apply workspace edit request.
export interface ApplyWorkspaceEditResult {
applied: boolean;
failureReason?: string;
failedChange?: uinteger;
}applied: boolean;Indicates whether the edit was applied or not.
failureReason?: string;An optional textual description for why the edit was not applied. This may be used by the server for diagnostic logging or to provide a suitable error for a request that triggered the edit.
failedChange?: uinteger;Depending on the client's failure handling strategy failedChange might
contain the index of the change that failed. This property is only available
if the client signals a failureHandlingStrategy in its client capabilities.
Interface exported by coc.nvim.
export interface Thenable<T> {
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
}Interface exported by coc.nvim.
export interface Disposable {
dispose(): void;
}dispose(): void;Dispose this object.
A parameter literal used in requests to pass a text document and a position inside that document.
export interface TextDocumentPositionParams {
textDocument: TextDocumentIdentifier;
position: Position;
}textDocument: TextDocumentIdentifier;The text document.
position: Position;The position inside the text document.
An event describing a change to a text document.
export interface TextDocumentContentChange {
range: Range;
text: string;
}range: Range;The range of the document that changed.
text: string;The new text for the provided range.
The workspace folder change event.
export interface WorkspaceFoldersChangeEvent {
added: WorkspaceFolder[];
removed: WorkspaceFolder[];
}added: WorkspaceFolder[];The array of added workspace folders
removed: WorkspaceFolder[];The array of the removed workspace folders
An event that is fired when a document will be saved.
To make modifications to the document before it is being saved, call the
waitUntil-function with a thenable
that resolves to an array of text edits.
export interface TextDocumentWillSaveEvent {
document: LinesTextDocument;
reason: 1 | 2 | 3;
}document: LinesTextDocument;The document that will be saved.
reason: 1 | 2 | 3;The reason why save was triggered.
A document filter denotes a document by different properties like the language, the scheme of its resource, or a glob-pattern that is applied to the path.
Glob patterns can have the following syntax:
* to match one or more characters in a path segment? to match on one character in a path segment** to match any number of path segments, including none{} to group conditions (e.g. **/*.{ts,js} matches all TypeScript and JavaScript files)[] to declare a range of characters to match in a path segment (e.g., example.[0-9] to match on example.0, example.1, …)[!...] to negate a range of characters to match in a path segment (e.g., example.[!0-9] to match on example.a, example.b, but not example.0)export type DocumentFilter = {
language: string;
scheme?: string;
pattern?: string;
} | {
language?: string;
scheme: string;
pattern?: string;
} | {
language?: string;
scheme?: string;
pattern: string;
};A language selector is the combination of one or many language identifiers and language filters.
Note that a document selector that is just a language identifier selects all documents, even those that are not saved on disk. Only use such selectors when a feature works without further context, e.g. without the need to resolve related 'files'.
export type DocumentSelector = DocumentFilter | string | ReadonlyArray<DocumentFilter | string>;Type alias exported by coc.nvim.
export type SignatureHelpTriggerKind = 1 | 2 | 3;Additional information about the context in which a signature help request was triggered.
export interface SignatureHelpContext {
triggerKind: SignatureHelpTriggerKind;
triggerCharacter?: string;
isRetrigger: boolean;
activeSignatureHelp?: SignatureHelp;
}triggerKind: SignatureHelpTriggerKind;Action that caused signature help to be triggered.
triggerCharacter?: string;Character that caused signature help to be triggered.
This is undefined when triggerKind !== SignatureHelpTriggerKind.TriggerCharacter
isRetrigger: boolean;true if signature help was already showing when it was triggered.
Retriggers occur when the signature help is already active and can be caused by actions such as typing a trigger character, a cursor move, or document content changes.
activeSignatureHelp?: SignatureHelp;The currently active SignatureHelp.
The activeSignatureHelp has its SignatureHelp.activeSignature field updated based on
the user navigating through available signatures.
Type alias exported by coc.nvim.
export type CompletionTriggerKind = 1 | 2 | 3;Contains additional information about the context in which a completion request is triggered.
export interface CompletionContext {
triggerKind: CompletionTriggerKind;
triggerCharacter?: string;
option: CompleteOption;
}triggerKind: CompletionTriggerKind;How the completion was triggered.
triggerCharacter?: string;The trigger character (a single character) that has trigger code complete.
Is undefined if triggerKind !== CompletionTriggerKind.TriggerCharacter
option: CompleteOption;The completion option of the current completion request.
Represents a typed event.
A function that represents an event to which you subscribe by calling it with a listener function as argument.
export interface Event<T> {
(listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
}(listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;A function that represents an event to which you subscribe by calling it with a listener function as argument.
Interface exported by coc.nvim.
export interface EmitterOptions {
onFirstListenerAdd?: Function;
onLastListenerRemove?: Function;
}onFirstListenerAdd?: Function;Called when the first listener is added.
onLastListenerRemove?: Function;Called when the last listener is removed.
Class exported by coc.nvim.
export class Emitter<T> {
constructor(_options?: EmitterOptions | undefined);
get event(): Event<T>;
fire(event: T): any;
dispose(): void;
}constructor(_options?: EmitterOptions | undefined);get event(): Event<T>;For the public to allow to subscribe to events from this Emitter
fire(event: T): any;To be kept private to fire an event to subscribers
dispose(): void;Dispose the emitter, remove all listeners.
Defines a CancellationToken. This interface is not intended to be implemented. A CancellationToken must be created via a CancellationTokenSource.
export interface CancellationToken {
readonly isCancellationRequested: boolean;
readonly onCancellationRequested: Event<any>;
}readonly isCancellationRequested: boolean;Is true when the token has been cancelled, false otherwise.
Class exported by coc.nvim.
export class CancellationTokenSource {
get token(): CancellationToken;
cancel(): void;
dispose(): void;
}get token(): CancellationToken;The cancellation token of this source.
cancel(): void;Cancel the token, firing the cancellation event.
dispose(): void;Dispose the source.
Represents a line of text, such as a line of source code.
TextLine objects are immutable. When a document changes, previously retrieved lines will not represent the latest state.
export interface TextLine {
readonly lineNumber: number;
readonly text: string;
readonly range: Range;
readonly rangeIncludingLineBreak: Range;
readonly firstNonWhitespaceCharacterIndex: number;
readonly isEmptyOrWhitespace: boolean;
}readonly lineNumber: number;The zero-based line number.
readonly text: string;The text of this line without the line separator characters.
readonly range: Range;The range this line covers without the line separator characters.
readonly rangeIncludingLineBreak: Range;The range this line covers with the line separator characters.
readonly firstNonWhitespaceCharacterIndex: number;The offset of the first character which is not a whitespace character as defined
by /\s/. Note that if a line is all whitespace the length of the line is returned.
readonly isEmptyOrWhitespace: boolean;Whether this line is whitespace only, shorthand for === TextLine.text.length.
Interface exported by coc.nvim.
export interface LinesTextDocument extends TextDocument {
readonly length: number;
readonly end: Position;
readonly eol: boolean;
readonly lines: ReadonlyArray<string>;
lineAt(lineOrPos: number | Position): TextLine;
}readonly length: number;Total length of TextDocument.
readonly end: Position;End position of TextDocument.
readonly eol: boolean;'eol' option of related buffer. When enabled additional \n will be
added to the end of document content
readonly lines: ReadonlyArray<string>;Lines of TextDocument.
The result of a linked editing range request.
export interface LinkedEditingRanges {
ranges: Range[];
wordPattern?: string;
}ranges: Range[];A list of ranges that can be edited together. The ranges must have identical length and contain identical text content. The ranges cannot overlap.
wordPattern?: string;An optional word pattern (regular expression) that describes valid contents for the given ranges. If no pattern is provided, the client configuration's word pattern will be used.
Type alias exported by coc.nvim.
export type UniquenessLevel = 'document' | 'project' | 'group' | 'scheme' | 'global';Type alias exported by coc.nvim.
export type MonikerKind = 'import' | 'export' | 'local';Moniker definition to match LSIF 0.5 moniker definition.
export interface Moniker {
scheme: string;
identifier: string;
unique: UniquenessLevel;
kind?: MonikerKind;
}scheme: string;The scheme of the moniker. For example tsc or .Net
identifier: string;The identifier of the moniker. The value is opaque in LSIF however schema owners are allowed to define the structure if they want.
unique: UniquenessLevel;The scope in which the moniker is unique
kind?: MonikerKind;The moniker kind if known.
A previous result id in a workspace pull request.
export type PreviousResultId = {
uri: string;
value: string;
};Type alias exported by coc.nvim.
export type DocumentDiagnosticReportKind = 'full' | 'unchanged';A diagnostic report with a full set of problems.
export type FullDocumentDiagnosticReport = {
kind: typeof DocumentDiagnosticReportKind.Full;
resultId?: string;
items: Diagnostic[];
};A diagnostic report indicating that the last returned report is still accurate.
export type UnchangedDocumentDiagnosticReport = {
kind: typeof DocumentDiagnosticReportKind.Unchanged;
resultId: string;
};An unchanged diagnostic report with a set of related documents.
export type RelatedUnchangedDocumentDiagnosticReport = UnchangedDocumentDiagnosticReport & {
relatedDocuments?: {
[uri: string]: FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport;
};
};Type alias exported by coc.nvim.
export type RelatedFullDocumentDiagnosticReport = FullDocumentDiagnosticReport & {
relatedDocuments?: {
[uri: string]: FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport;
};
};Type alias exported by coc.nvim.
export type DocumentDiagnosticReport = RelatedFullDocumentDiagnosticReport | RelatedUnchangedDocumentDiagnosticReport;Type alias exported by coc.nvim.
export type WorkspaceDiagnosticReport = {
items: WorkspaceDocumentDiagnosticReport[];
};A partial result for a workspace diagnostic report.
export type WorkspaceDiagnosticReportPartialResult = {
items: WorkspaceDocumentDiagnosticReport[];
};Type alias exported by coc.nvim.
export type WorkspaceFullDocumentDiagnosticReport = FullDocumentDiagnosticReport & {
uri: string;
version: number | null;
};Type alias exported by coc.nvim.
export type WorkspaceUnchangedDocumentDiagnosticReport = UnchangedDocumentDiagnosticReport & {
uri: string;
version: number | null;
};Type alias exported by coc.nvim.
export type WorkspaceDocumentDiagnosticReport = WorkspaceFullDocumentDiagnosticReport | WorkspaceUnchangedDocumentDiagnosticReport;Interface exported by coc.nvim.
export interface ResultReporter {
(chunk: WorkspaceDiagnosticReportPartialResult | null): void;
}(chunk: WorkspaceDiagnosticReportPartialResult | null): void;Type alias exported by coc.nvim.
export type ErrorCodes = number;Interface exported by coc.nvim.
export interface ResponseErrorLiteral<D = void> {
code: number;
message: string;
data?: D;
}code: number;A number indicating the error type that occurred.
message: string;A string providing a short description of the error.
data?: D;A Primitive or Structured value that contains additional information about the error. Can be omitted.
An error object return in a response in case a request has failed.
export class ResponseError<D = void> extends Error {
readonly code: number;
readonly data: D | undefined;
constructor(code: number, message: string, data?: D);
toJson(): ResponseErrorLiteral<D>;
}readonly code: number;Error code of the response.
readonly data: D | undefined;Additional data of the error.
constructor(code: number, message: string, data?: D);toJson(): ResponseErrorLiteral<D>;Serialize to a JSON literal.
A language server message
export interface Message {
jsonrpc: string;
}jsonrpc: string;The protocol version, always "2.0".
Interface exported by coc.nvim.
export interface AbstractCancellationTokenSource extends Disposable {
token: CancellationToken;
cancel(): void;
}token: CancellationToken;The cancellation token of this source.
cancel(): void;Cancel the token.
A response message.
export interface ResponseMessage extends Message {
id: number | string | null;
result?: string | number | boolean | object | any[] | null;
error?: ResponseErrorLiteral<any>;
}id: number | string | null;The request id.
result?: string | number | boolean | object | any[] | null;The result of a request. This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method.
error?: ResponseErrorLiteral<any>;The error object in case a request fails.
Type alias exported by coc.nvim.
type VimValue = number | boolean | string | number[] | {
[key: string]: any;
};Interface exported by coc.nvim.
export interface VimClientInfo {
name: string;
version: {
major?: number;
minor?: number;
patch?: number;
prerelease?: string;
commit?: string;
};
type: 'remote' | 'embedder' | 'host';
methods?: {
[index: string]: any;
};
attributes?: {
[index: string]: any;
};
}name: string;Name of the client.
version: {
major?: number;
minor?: number;
patch?: number;
prerelease?: string;
commit?: string;
};Version of the client.
type: 'remote' | 'embedder' | 'host';Type of the client.
methods?: {
[index: string]: any;
};Custom methods exposed by the client.
attributes?: {
[index: string]: any;
};Custom attributes of the client.
Interface exported by coc.nvim.
export interface UiAttachOptions {
rgb?: boolean;
ext_popupmenu?: boolean;
ext_tabline?: boolean;
ext_wildmenu?: boolean;
ext_cmdline?: boolean;
ext_linegrid?: boolean;
ext_hlstate?: boolean;
}rgb?: boolean;Enable rgb colors.
ext_popupmenu?: boolean;Use external popupmenu.
ext_tabline?: boolean;Use external tabline.
ext_wildmenu?: boolean;Use external wildmenu.
ext_cmdline?: boolean;Use external cmdline.
ext_linegrid?: boolean;Use external linegrid.
ext_hlstate?: boolean;Use external hlstate.
Interface exported by coc.nvim.
export interface ChanInfo {
id: number;
stream: 'stdio' | 'stderr' | 'socket' | 'job';
mode: 'bytes' | 'terminal' | 'rpc';
pty?: number;
buffer?: number;
client?: VimClientInfo;
}id: number;Channel id.
stream: 'stdio' | 'stderr' | 'socket' | 'job';Stream type of the channel.
mode: 'bytes' | 'terminal' | 'rpc';Mode of the channel.
pty?: number;Pseudo terminal id when the channel is a terminal.
buffer?: number;Buffer number of the terminal.
client?: VimClientInfo;Client info when the channel is an rpc client.
Returned by nvim_get_commands api.
export interface VimCommandDescription {
name: string;
bang: boolean;
bar: boolean;
register: boolean;
definition: string;
count?: number | null;
script_id: number;
complete?: string;
nargs?: string;
range?: string;
complete_arg?: string;
}name: string;Name of the command.
bang: boolean;The command accepts a ! modifier.
bar: boolean;The command supports a | separator.
register: boolean;The command accepts a register argument.
definition: string;Definition of the command.
count?: number | null;Count argument accepted by the command.
script_id: number;Id of the script that defines the command.
complete?: string;Completion type of the command.
nargs?: string;Number of arguments of the command.
range?: string;Range specification of the command.
complete_arg?: string;Completion argument of the command.
Interface exported by coc.nvim.
export interface NvimFloatOptions {
standalone?: boolean;
focusable?: boolean;
relative?: 'editor' | 'cursor' | 'win' | 'mouse';
anchor?: 'NW' | 'NE' | 'SW' | 'SE';
border?: 'none' | 'single' | 'double' | 'rounded' | 'solid' | 'shadow' | string[];
style?: 'minimal';
title?: string;
title_pos?: 'left' | 'center' | 'right';
footer?: string | [
string,
string
][];
footer_pos?: 'left' | 'center' | 'right';
noautocmd?: boolean;
fixed?: boolean;
hide?: boolean;
height: number;
width: number;
row: number;
col: number;
}standalone?: boolean;Keep the float window open when losing focus.
focusable?: boolean;Whether the float window is focusable, default to true.
relative?: 'editor' | 'cursor' | 'win' | 'mouse';Position relative to editor, cursor, window or mouse.
anchor?: 'NW' | 'NE' | 'SW' | 'SE';Anchor corner of the float window.
border?: 'none' | 'single' | 'double' | 'rounded' | 'solid' | 'shadow' | string[];Border style of the float window.
style?: 'minimal';Style of the float window.
title?: string;Title of the float window.
title_pos?: 'left' | 'center' | 'right';Position of the title.
footer?: string | [
string,
string
][];Footer of the float window.
footer_pos?: 'left' | 'center' | 'right';Position of the footer.
noautocmd?: boolean;Do not trigger autocommands for the float window.
fixed?: boolean;Do not change size or position when the parent changes.
hide?: boolean;Hide the float window instead of closing it.
height: number;Height of the float window.
width: number;Width of the float window.
row: number;Row of the float window.
col: number;Column of the float window.
Interface exported by coc.nvim.
export interface ExtmarkOptions {
id?: number;
end_line?: number;
end_col?: number;
hl_group?: string;
hl_mode?: 'replace' | 'combine' | 'blend';
hl_eol?: boolean;
virt_text?: [
string,
string | string[]
][];
virt_text_pos?: 'eol' | 'overlay' | 'right_align' | 'inline';
virt_text_win_col?: number;
virt_text_hide?: boolean;
virt_lines?: [
string,
string | string[]
][][];
virt_lines_above?: boolean;
virt_lines_leftcol?: boolean;
right_gravity?: boolean;
end_right_gravity?: boolean;
priority?: number;
}id?: number;Id of the extmark, used to update or remove it.
end_line?: number;End line, 0-based inclusive.
end_col?: number;End column, 0-based exclusive.
hl_group?: string;Name of the highlight group used to highlight this mark.
hl_mode?: 'replace' | 'combine' | 'blend';Highlight mode of the text.
hl_eol?: boolean;Highlight to end of line when true.
virt_text?: [
string,
string | string[]
][];A list of [text, highlight] tuples.
virt_text_pos?: 'eol' | 'overlay' | 'right_align' | 'inline';Position of virtual text.
virt_text_win_col?: number;Window column of virtual text, used with overlay position.
virt_text_hide?: boolean;Hide virtual text when the line is truncated.
virt_lines?: [
string,
string | string[]
][][];Virtual lines rendered below the mark.
virt_lines_above?: boolean;Render virtual lines above the mark when true.
virt_lines_leftcol?: boolean;Align virtual lines to the left.
right_gravity?: boolean;The extmark is right gravity when true.
end_right_gravity?: boolean;The end mark is right gravity when true.
priority?: number;Priority of the extmark, higher renders on top.
Interface exported by coc.nvim.
export interface ExtmarkDetails {
end_col: number;
end_row: number;
priority: number;
hl_group?: string;
virt_text?: [
string,
string
][];
virt_lines?: [
string,
string | string
][][];
}end_col: number;End column, 0-based exclusive.
end_row: number;End row of the extmark.
priority: number;Priority of the extmark.
hl_group?: string;Highlight group of the extmark.
virt_text?: [
string,
string
][];Virtual text of the extmark.
virt_lines?: [
string,
string | string
][][];Virtual lines of the extmark.
Interface exported by coc.nvim.
export interface NvimProc {
ppid: number;
name: string;
pid: number;
}ppid: number;Parent process id.
name: string;Name of the process.
pid: number;Process id.
Interface exported by coc.nvim.
export interface SignPlaceOption {
id?: number;
group?: string;
name: string;
lnum: number;
priority?: number;
}id?: number;Sign id, auto generated when omitted.
group?: string;Group of the sign.
name: string;Name of the defined sign.
lnum: number;Line number of the sign.
priority?: number;Priority of the sign.
Interface exported by coc.nvim.
export interface SignUnplaceOption {
group?: string;
id?: number;
}group?: string;Sign group, default to the unnamed group.
id?: number;Sign id, unplace all signs of the group when omitted.
Interface exported by coc.nvim.
export interface SignPlacedOption {
group?: string;
id?: number;
lnum?: number;
}group?: string;Use '*' for all group, default to '' as unnamed group.
id?: number;Sign id.
lnum?: number;Line number.
Interface exported by coc.nvim.
export interface SignItem {
group: string;
id: number;
lnum: number;
name: string;
priority: number;
}group: string;Group of the sign.
id: number;Id of the sign.
lnum: number;Line number of the sign.
name: string;Name of the sign.
priority: number;Priority of the sign.
Interface exported by coc.nvim.
export interface HighlightItem {
hlGroup: string;
lnum: number;
colStart: number;
colEnd: number;
}hlGroup: string;Highlight group name.
lnum: number;0 based
colStart: number;0 based
colEnd: number;0 based
Interface exported by coc.nvim.
export interface ExtendedHighlightItem extends HighlightItem {
combine?: boolean;
start_incl?: boolean;
end_incl?: boolean;
}combine?: boolean;Combine the highlight with the existing one.
start_incl?: boolean;Start column is inclusive.
end_incl?: boolean;End column is inclusive.
Interface exported by coc.nvim.
export interface HighlightOption {
start?: number;
end?: number;
priority?: number;
changedtick?: number;
}start?: number;0 based start line, default to 0.
end?: number;0 based end line, default to 0.
priority?: number;Default to 0 on vim8, 4096 on neovim
changedtick?: number;Buffer changedtick to match.
All values default to false, see :h :map-arguments
export interface BufferKeymapOption {
desc?: string;
noremap?: boolean;
nowait?: boolean;
silent?: boolean;
script?: boolean;
expr?: boolean;
unique?: boolean;
special?: boolean;
}desc?: string;Description of the keymap.
noremap?: boolean;Do not remap the keymap.
nowait?: boolean;Do not wait for more characters.
silent?: boolean;Do not echo the command.
script?: boolean;Remap script-local mappings.
expr?: boolean;The right hand side is an expression.
unique?: boolean;Fail when the keymap already exists.
special?: boolean;Allow special characters in the left hand side.
Interface exported by coc.nvim.
export interface InsertKeymapText {
text: string;
}text: string;Literal text to insert.
Interface exported by coc.nvim.
export interface InsertKeymapKey {
key: string;
}key: string;One special key in Vim key notation, for example <Left> or <C-G>.
Type alias exported by coc.nvim.
export type InsertKeymapResult = ReadonlyArray<InsertKeymapText | InsertKeymapKey>;Interface exported by coc.nvim.
export interface InsertKeymapOption {
buffer?: number | boolean;
arglist?: string[];
}buffer?: number | boolean;Buffer number, or current buffer with true or 0.
arglist?: string[];Vim expressions evaluated when the mapping is invoked.
Interface exported by coc.nvim.
export interface BufferHighlight {
hlGroup?: string;
srcId?: number;
line?: number;
colStart?: number;
colEnd?: number;
}hlGroup?: string;Name of the highlight group to use
srcId?: number;Namespace to use or -1 for ungrouped highlight
line?: number;Line to highlight (zero-indexed)
colStart?: number;Start of (byte-indexed) column range to highlight
colEnd?: number;End of (byte-indexed) column range to highlight, or -1 to highlight to end of line
Interface exported by coc.nvim.
export interface BufferClearHighlight {
srcId?: number;
lineStart?: number;
lineEnd?: number;
}srcId?: number;Namespace to clear or -1 for ungrouped highlights.
lineStart?: number;First line to clear.
lineEnd?: number;Last line to clear.
Interface exported by coc.nvim.
export interface VirtualTextOption {
col?: number;
indent?: boolean;
hl_mode?: 'combine' | 'replace' | 'blend';
text_align?: 'after' | 'right' | 'below' | 'above';
right_gravity?: boolean;
virt_text_win_col?: number;
text_wrap?: 'wrap' | 'truncate';
}col?: number;Used on vim9 and neovim >= 0.10.0.
indent?: boolean;Add line indent when text_align is below or above.
hl_mode?: 'combine' | 'replace' | 'blend';highlight mode, blend is neovim only (replace is used on vim when specified).
text_align?: 'after' | 'right' | 'below' | 'above';neovim and vim.
right_gravity?: boolean;neovim only, right_gravity of nvim_buf_set_extmark.
virt_text_win_col?: number;neovim only
text_wrap?: 'wrap' | 'truncate';vim9 only
Interface exported by coc.nvim.
export interface AugroupOption {
clear?: boolean;
}clear?: boolean;Clear the all autocmds before create autocmd group, default to true.
Interface exported by coc.nvim.
interface AutocmdOption {
group?: string | number;
pattern?: string | string[];
buffer?: number;
desc?: string;
command?: string;
once?: boolean;
nested?: boolean;
replace?: boolean;
}group?: string | number;Group name or group id from nvim.createAugroup(), see :h autocmd-groups.
pattern?: string | string[];Pattern to match, see :h autocmd-pattern.
buffer?: number;Buffer number for buflocal autocommand, see :h autocmd-buflocal.
desc?: string;Description test, not used on vim9.
command?: string;Vim command to run when trigger autocommand.
once?: boolean;See :h autocmd-once.
nested?: boolean;See :h autocmd-nested.
replace?: boolean;Vim9 only, see :h autocmd_add()
Interface exported by coc.nvim.
interface BaseApi<T> {
id: number;
equals(other: T): boolean;
request(name: string, args?: VimValue[]): Promise<any>;
notify(name: string, args?: VimValue[]): void;
getVar(name: string): Promise<VimValue | null>;
setVar(name: string, value: VimValue): Promise<void>;
setVar(name: string, value: VimValue, isNotify: true): void;
deleteVar(name: string): void;
getOption(name: string): Promise<VimValue>;
setOption(name: string, value: VimValue): Promise<void>;
setOption(name: string, value: VimValue, isNotify: true): void;
}id: number;unique identify number
equals(other: T): boolean;Check if same by compare id.
request(name: string, args?: VimValue[]): Promise<any>;Request to vim, name need to be nvim_ prefixed and supported by vim.
notify(name: string, args?: VimValue[]): void;Send notification to vim, name need to be nvim_ prefixed and supported by vim
getVar(name: string): Promise<VimValue | null>;Retrieves scoped variable, returns null when value doesn't exist.
setVar(name: string, value: VimValue): Promise<void>;Set scoped variable by request.
setVar(name: string, value: VimValue, isNotify: true): void;Set scoped variable by notification.
deleteVar(name: string): void;Delete scoped variable by notification.
getOption(name: string): Promise<VimValue>;Retrieves a scoped option, doesn't exist for tabpage.
Note: neovim returns true/false for boolean option, but it would be 0/1 on vim.
setOption(name: string, value: VimValue): Promise<void>;Set scoped option by request, doesn't exist for tabpage.
setOption(name: string, value: VimValue, isNotify: true): void;Set scoped variable by notification, doesn't exist for tabpage.
Interface exported by coc.nvim.
export interface Neovim extends BaseApi<Neovim> {
echoError(error: Error | string): void;
hasFunction(name: string): boolean;
channelId: Promise<number>;
createBuffer(id: number): Buffer;
createWindow(id: number): Window;
createTabpage(id: number): Tabpage;
pauseNotification(): void;
resumeNotification(redrawVim?: boolean): Promise<[
VimValue[],
[
string,
number,
string
] | null
]>;
resumeNotification(redrawVim: boolean, notify: true): void;
redrawVim(): void;
buffers: Promise<Buffer[]>;
buffer: Promise<Buffer>;
setBuffer(buffer: Buffer): Promise<void>;
tabpages: Promise<Tabpage[]>;
tabpage: Promise<Tabpage>;
setTabpage(tabpage: Tabpage): Promise<void>;
windows: Promise<Window[]>;
window: Promise<Window>;
setWindow(window: Window): Promise<void>;
chans: Promise<ChanInfo[]>;
getChanInfo(id: number): Promise<ChanInfo>;
createNamespace(name?: string): Promise<number>;
namespaces: Promise<{
[name: string]: number;
}>;
getCommands(opt?: {
builtin: boolean;
}): Promise<{
[name: string]: VimCommandDescription;
}>;
runtimePaths: Promise<string[]>;
setDirectory(dir: string): Promise<void>;
line: Promise<string>;
createNewBuffer(listed?: boolean, scratch?: boolean): Promise<Buffer>;
openFloatWindow(buffer: Buffer, enter: boolean, options: NvimFloatOptions): Promise<Window>;
setLine(line: string): Promise<void>;
getKeymap(mode: string): Promise<object[]>;
mode: Promise<{
mode: string;
blocking: boolean;
}>;
colorMap(): Promise<{
[name: string]: number;
}>;
getColorByName(name: string): Promise<number>;
getHighlight(nameOrId: string | number, isRgb?: boolean): Promise<object>;
getHighlightByName(name: string, isRgb?: boolean): Promise<object>;
getHighlightById(id: number, isRgb?: boolean): Promise<object>;
deleteCurrentLine(): Promise<void>;
eval(expr: string): Promise<VimValue>;
lua(code: string, args?: VimValue[]): Promise<object>;
callDictFunction(dict: object | string, fname: string, args: VimValue | VimValue[]): Promise<object>;
call(fname: string, args?: VimValue | VimValue[]): Promise<unknown>;
call(fname: string, args: VimValue | VimValue[], isNotify: true): void;
callVim(fname: string, args?: VimValue | VimValue[]): Promise<unknown>;
callVim(fname: string, args: VimValue | VimValue[], isNotify: true): void;
evalVim(expr: string): Promise<unknown>;
exVim(command: string): void;
callTimer(fname: string, args?: VimValue | VimValue[]): Promise<void>;
callTimer(fname: string, args: VimValue | VimValue[], isNotify: true): void;
callAsync(fname: string, args?: VimValue | VimValue[]): Promise<unknown>;
callAtomic(calls: [
string,
VimValue[]
][]): Promise<[
any[],
any[] | null
]>;
command(arg: string): Promise<void>;
command(arg: string, isNotify: true): void;
commandOutput(arg: string): Promise<string>;
exec(src: string, output?: boolean): Promise<string>;
getVvar(name: string): Promise<VimValue>;
feedKeys(keys: string, mode: string, escapeCsi: boolean): Promise<void>;
setKeymap(mode: string, lhs: string, rhs: string, opts?: BufferKeymapOption): void;
deleteKeymap(mode: string, lhs: string): void;
input(keys: string): Promise<number>;
parseExpression(expr: string, flags: string, highlight: boolean): Promise<object>;
getProc(pid: number): Promise<NvimProc>;
getProcChildren(pid: number): Promise<NvimProc[]>;
replaceTermcodes(str: string, fromPart: boolean, doIt: boolean, special: boolean): Promise<string>;
strWidth(str: string): Promise<number>;
createAugroup(name: string, option?: AugroupOption): Promise<number>;
createAugroup(name: string, option: AugroupOption, isNotify: true): void;
createAutocmd(event: string | string[], option?: AutocmdOption): Promise<number>;
createAutocmd(event: string | string[], option: AutocmdOption, isNotify: true): void;
deleteAutocmd(id: number): void;
uis: Promise<any[]>;
subscribe(event: string): Promise<void>;
unsubscribe(event: string): Promise<void>;
quit(): Promise<void>;
}echoError(error: Error | string): void;Echo error message to vim and log error stack.
hasFunction(name: string): boolean;Check if nvim_ function exists.
channelId: Promise<number>;Get channelid used by coc.nvim.
createBuffer(id: number): Buffer;Create buffer instance by id.
createWindow(id: number): Window;Create window instance by id.
createTabpage(id: number): Tabpage;Create tabpage instance by id.
pauseNotification(): void;Stop send subsequent notifications.
This method must be paired with nvim.resumeNotification in a sync manner.
resumeNotification(redrawVim?: boolean): Promise<[
VimValue[],
[
string,
number,
string
] | null
]>;Send paused notifications by nvim_call_atomic request
resumeNotification(redrawVim: boolean, notify: true): void;Send paused notifications by nvim_call_atomic notification
redrawVim(): void;Send redraw command to vim, does nothing on neovim since it's not necessary on most cases.
buffers: Promise<Buffer[]>;Get list of current buffers.
buffer: Promise<Buffer>;Get current buffer.
setBuffer(buffer: Buffer): Promise<void>;Set current buffer
tabpages: Promise<Tabpage[]>;Get list of current tabpages.
tabpage: Promise<Tabpage>;Get current tabpage.
setTabpage(tabpage: Tabpage): Promise<void>;Set current tabpage
windows: Promise<Window[]>;Get list of current windows.
window: Promise<Window>;Get current window.
setWindow(window: Window): Promise<void>;Set current window.
chans: Promise<ChanInfo[]>;Get information of all channels, Note: works on neovim only.
getChanInfo(id: number): Promise<ChanInfo>;Get information of channel by id, Note: works on neovim only.
createNamespace(name?: string): Promise<number>;Creates a new namespace, or gets an existing one.
:h nvim_create_namespace()
namespaces: Promise<{
[name: string]: number;
}>;Gets existing, non-anonymous namespaces. Note: works on neovim only.
getCommands(opt?: {
builtin: boolean;
}): Promise<{
[name: string]: VimCommandDescription;
}>;Gets a map of global (non-buffer-local) Ex commands.
runtimePaths: Promise<string[]>;Get list of all runtime paths
setDirectory(dir: string): Promise<void>;Set global working directory. Note: works on neovim only.
line: Promise<string>;Get current line.
createNewBuffer(listed?: boolean, scratch?: boolean): Promise<Buffer>;Creates a new, empty, unnamed buffer.
openFloatWindow(buffer: Buffer, enter: boolean, options: NvimFloatOptions): Promise<Window>;Create float window of neovim.
Note: works on neovim only, use high level api provided by window module is recommended.
setLine(line: string): Promise<void>;Set current line.
getKeymap(mode: string): Promise<object[]>;Gets a list of global (non-buffer-local) |mapping| definitions.
:h nvim_get_keymap
Note: works on neovim only.
mode: Promise<{
mode: string;
blocking: boolean;
}>;Gets the current mode. |mode()| "blocking" is true if Nvim is waiting for input.
Note: blocking would always be false when used with vim.
colorMap(): Promise<{
[name: string]: number;
}>;Returns a map of color names and RGB values.
Note: works on neovim only.
getColorByName(name: string): Promise<number>;Returns the 24-bit RGB value of a |nvim_get_color_map()| color name or "#rrggbb" hexadecimal string.
Note: works on neovim only.
getHighlight(nameOrId: string | number, isRgb?: boolean): Promise<object>;Gets a highlight definition by id. |hlID()|
Note: works on neovim only.
getHighlightByName(name: string, isRgb?: boolean): Promise<object>;Get a highlight by name, return rgb by default.
Note: works on neovim only.
getHighlightById(id: number, isRgb?: boolean): Promise<object>;Get a highlight by id, return rgb by default.
Note: works on neovim only.
deleteCurrentLine(): Promise<void>;Delete current line in buffer.
eval(expr: string): Promise<VimValue>;Evaluates a VimL expression (:help expression). Dictionaries and Lists are recursively expanded. On VimL error: Returns a generic error; v:errmsg is not updated.
lua(code: string, args?: VimValue[]): Promise<object>;Executes lua, it's possible neovim client does not support this
Note: works on neovim only.
callDictFunction(dict: object | string, fname: string, args: VimValue | VimValue[]): Promise<object>;Calls a VimL |Dictionary-function| with the given arguments.
call(fname: string, args: VimValue | VimValue[], isNotify: true): void;Call a vim function by notification.
callVim(fname: string, args?: VimValue | VimValue[]): Promise<unknown>;Use call command :h channel-commands to call function on vim9.
Warning: NodeJS side only get the 'ERROR' text on error, to get error message,
see :h coc-api-channel
callVim(fname: string, args: VimValue | VimValue[], isNotify: true): void;Use call command :h channel-commands to call function on vim9.
Warning: errors not exists on NodeJS side, see :h coc-api-channel
evalVim(expr: string): Promise<unknown>;Use expr command :h channel-commands to eval expression on vim9.
Warning: NodeJS side only get the 'ERROR' text on error, to get error message,
see :h coc-api-channel
exVim(command: string): void;Use ex command :h channel-commands to execute command on vim9.
Warning: errors not exists on NodeJS side, see :h coc-api-channel
callTimer(fname: string, args?: VimValue | VimValue[]): Promise<void>;Call a vim function with timer of timeout 0.
callTimer(fname: string, args: VimValue | VimValue[], isNotify: true): void;Call a vim function with timer of timeout 0 by notification.
callAsync(fname: string, args?: VimValue | VimValue[]): Promise<unknown>;Call async vim function that accept callback as argument by using notifications.
callAtomic(calls: [
string,
VimValue[]
][]): Promise<[
any[],
any[] | null
]>;Calls many API methods atomically.
command(arg: string): Promise<void>;Executes an ex-command by request.
command(arg: string, isNotify: true): void;Executes an ex-command by notification.
commandOutput(arg: string): Promise<string>;Runs a command and returns output.
exec(src: string, output?: boolean): Promise<string>;Executes Vimscript (multiline block of Ex-commands), like anonymous |:source|
getVvar(name: string): Promise<VimValue>;Gets a v: variable.
feedKeys(keys: string, mode: string, escapeCsi: boolean): Promise<void>;:h nvim_feedkeys
setKeymap(mode: string, lhs: string, rhs: string, opts?: BufferKeymapOption): void;Add global keymap by notification, :h nvim_set_keymap
deleteKeymap(mode: string, lhs: string): void;Delete global keymap, :h nvim_del_keymap
input(keys: string): Promise<number>;Queues raw user-input. Unlike |nvim_feedkeys()|, this uses a low-level input buffer and the call is non-blocking (input is processed asynchronously by the eventloop).
On execution error: does not fail, but updates v:errmsg.
Note: works on neovim only.
parseExpression(expr: string, flags: string, highlight: boolean): Promise<object>;Parse a VimL Expression.
getProc(pid: number): Promise<NvimProc>;Get process info, neovim only.
Note: works on neovim only.
getProcChildren(pid: number): Promise<NvimProc[]>;Gets the immediate children of process pid.
Note: works on neovim only.
replaceTermcodes(str: string, fromPart: boolean, doIt: boolean, special: boolean): Promise<string>;Replaces terminal codes and |keycodes| (<CR>, <Esc>, ...) in a string with the internal representation.
Note: works on neovim only.
strWidth(str: string): Promise<number>;Gets width(display cells) of string.
createAugroup(name: string, option?: AugroupOption): Promise<number>;Create autocmd group with {name} and {option}
createAugroup(name: string, option: AugroupOption, isNotify: true): void;Create autocmd group with {name} and {option}, use notification to vim.
createAutocmd(event: string | string[], option?: AutocmdOption): Promise<number>;Create autocmd with {event} and {option}
createAutocmd(event: string | string[], option: AutocmdOption, isNotify: true): void;Create autocmd with {event} and {option}
deleteAutocmd(id: number): void;Delete autocmd with {id} returned from nvim.createAutocmd()
Notice: vim9 can't support delete specific autocmd yet, autocmds which
have the same group event pattern are all cleared.
uis: Promise<any[]>;Gets a list of dictionaries representing attached UIs.
Note: works on neovim only.
subscribe(event: string): Promise<void>;Subscribe to nvim event broadcasts.
Note: works on neovim only.
unsubscribe(event: string): Promise<void>;Unsubscribe to nvim event broadcasts
Note: works on neovim only.
quit(): Promise<void>;Quit vim.
Interface exported by coc.nvim.
export interface Buffer extends BaseApi<Buffer> {
id: number;
length: Promise<number>;
lines: Promise<string[]>;
changedtick: Promise<number>;
setKeymap(mode: string, lhs: string, rhs: string, opts?: BufferKeymapOption): void;
deleteKeymap(mode: string, lhs: string): void;
deleteExtMark(ns_id: number, id: number): void;
getExtMarkById(ns_id: number, id: number, opts?: {
details?: boolean;
}): Promise<[
] | [
number,
number
] | [
number,
number,
ExtmarkDetails
]>;
getExtMarks(ns_id: number, start: [
number,
number
] | number, end: [
number,
number
] | number, opts?: {
details?: boolean;
limit?: number;
}): Promise<[
number,
number,
number,
ExtmarkDetails?
][]>;
setExtMark(ns_id: number, line: number, col: number, opts?: ExtmarkOptions): void;
placeSign(sign: SignPlaceOption): void;
unplaceSign(opts: SignUnplaceOption): void;
getSigns(opts: SignPlacedOption): Promise<SignItem[]>;
getHighlights(ns: string, start?: number, end?: number): Promise<HighlightItem[]>;
updateHighlights(ns: string, highlights: ExtendedHighlightItem[], opts?: HighlightOption): void;
getCommands(options?: {}): Promise<Object>;
getLines(opts?: {
start: number;
end: number;
strictIndexing?: boolean;
}): Promise<string[]>;
setLines(lines: string[], opts?: {
start: number;
end: number;
strictIndexing?: boolean;
}): Promise<void>;
setLines(lines: string[], opts: {
start: number;
end: number;
strictIndexing?: boolean;
}, isNotify: true): void;
setVirtualText(src_id: number, line: number, chunks: [
string,
string
][], opts?: VirtualTextOption): void;
append(lines: string[] | string): Promise<void>;
name: Promise<string>;
setName(name: string): Promise<void>;
valid: Promise<boolean>;
mark(name: string): Promise<[
number,
number
]>;
getKeymap(mode: string): Promise<object[]>;
loaded: Promise<boolean>;
getOffset(index: number): Promise<number>;
addHighlight(opts: BufferHighlight): Promise<number | null>;
clearHighlight(args?: BufferClearHighlight): void;
highlightRanges(srcId: string | number, hlGroup: string, ranges: Range[]): void;
clearNamespace(key: number | string, lineStart?: number, lineEnd?: number): void;
}id: number;Buffer number.
length: Promise<number>;Total number of lines in buffer
lines: Promise<string[]>;Get lines of buffer.
changedtick: Promise<number>;Get changedtick of buffer.
setKeymap(mode: string, lhs: string, rhs: string, opts?: BufferKeymapOption): void;Add buffer keymap by notification, :h nvim_buf_set_keymap
deleteKeymap(mode: string, lhs: string): void;Delete buffer keymap, :h nvim_buf_del_keymap
deleteExtMark(ns_id: number, id: number): void;Removes an ext mark by notification. Neovim only.
getExtMarkById(ns_id: number, id: number, opts?: {
details?: boolean;
}): Promise<[
] | [
number,
number
] | [
number,
number,
ExtmarkDetails
]>;Gets the position (0-indexed) of an extmark. Neovim only.
getExtMarks(ns_id: number, start: [
number,
number
] | number, end: [
number,
number
] | number, opts?: {
details?: boolean;
limit?: number;
}): Promise<[
number,
number,
number,
ExtmarkDetails?
][]>;Gets extmarks in "traversal order" from a |charwise| region defined by buffer positions (inclusive, 0-indexed |api-indexing|).
Region can be given as (row,col) tuples, or valid extmark ids (whose positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1) respectively, thus the following are equivalent:
nvim_buf_get_extmarks(0, my_ns, 0, -1, {})
nvim_buf_get_extmarks(0, my_ns, [0,0], [-1,-1], {})
setExtMark(ns_id: number, line: number, col: number, opts?: ExtmarkOptions): void;Creates or updates an extmark by notification, :h nvim_buf_set_extmark.
placeSign(sign: SignPlaceOption): void;Add sign to buffer by notification.
unplaceSign(opts: SignUnplaceOption): void;Unplace signs by notification
getSigns(opts: SignPlacedOption): Promise<SignItem[]>;Get signs by group name or id and lnum.
getHighlights(ns: string, start?: number, end?: number): Promise<HighlightItem[]>;Get highlight items by namespace (end inclusive).
updateHighlights(ns: string, highlights: ExtendedHighlightItem[], opts?: HighlightOption): void;Update namespaced highlights in range by notification. Priority default to 0 on vim and 4096 on neovim. Note: timer used for whole buffer highlights for better performance.
getCommands(options?: {}): Promise<Object>;Gets a map of buffer-local |user-commands|.
Note: works on neovim only.
getLines(opts?: {
start: number;
end: number;
strictIndexing?: boolean;
}): Promise<string[]>;Get lines of buffer, get all lines by default.
setLines(lines: string[], opts?: {
start: number;
end: number;
strictIndexing?: boolean;
}): Promise<void>;Set lines of buffer given indices use request.
setLines(lines: string[], opts: {
start: number;
end: number;
strictIndexing?: boolean;
}, isNotify: true): void;Set lines of buffer given indices use notification.
setVirtualText(src_id: number, line: number, chunks: [
string,
string
][], opts?: VirtualTextOption): void;Set virtual text for a line use notification, works on both neovim and vim9.
append(lines: string[] | string): Promise<void>;Append a string or list of lines to end of buffer
name: Promise<string>;Get buffer name.
setName(name: string): Promise<void>;Set buffer name.
valid: Promise<boolean>;Check if buffer valid.
mark(name: string): Promise<[
number,
number
]>;Get mark position given mark name
Note: works on neovim only.
getKeymap(mode: string): Promise<object[]>;Gets a list of buffer-local |mapping| definitions.
loaded: Promise<boolean>;Check if buffer loaded.
getOffset(index: number): Promise<number>;Returns the byte offset for a line.
Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is one byte. 'fileformat' and 'fileencoding' are ignored. The line index just after the last line gives the total byte-count of the buffer. A final EOL byte is counted if it would be written, see 'eol'.
Unlike |line2byte()|, throws error for out-of-bounds indexing. Returns -1 for unloaded buffer.
addHighlight(opts: BufferHighlight): Promise<number | null>;Adds a highlight to buffer, checkout |nvim_buf_add_highlight|.
Note: when srcId = 0, request is made for new srcId, otherwire, use notification.
Note: hlGroup as empty string is not supported.
clearHighlight(args?: BufferClearHighlight): void;Clear highlights of specified lines.
highlightRanges(srcId: string | number, hlGroup: string, ranges: Range[]): void;Add highlight to ranges by notification, works on both vim & neovim.
Works on neovim and workspace.isVim && workspace.env.textprop is true
clearNamespace(key: number | string, lineStart?: number, lineEnd?: number): void;Clear namespace by id or name by notification, works on both vim & neovim.
Works on neovim and workspace.isVim && workspace.env.textprop is true
Interface exported by coc.nvim.
export interface Window extends BaseApi<Window> {
id: number;
buffer: Promise<Buffer>;
tabpage: Promise<Tabpage>;
cursor: Promise<[
number,
number
]>;
height: Promise<number>;
width: Promise<number>;
setCursor(pos: [
number,
number
]): Promise<void>;
setCursor(pos: [
number,
number
], isNotify: true): void;
setHeight(height: number): Promise<void>;
setHeight(height: number, isNotify: true): void;
setWidth(width: number): Promise<void>;
setWidth(width: number, isNotify: true): void;
position: Promise<[
number,
number
]>;
row: Promise<number>;
col: Promise<number>;
valid: Promise<boolean>;
number: Promise<number>;
setConfig(options: NvimFloatOptions): Promise<void>;
setConfig(options: NvimFloatOptions, isNotify: true): void;
getConfig(): Promise<NvimFloatOptions>;
close(force: boolean): Promise<void>;
close(force: boolean, isNotify: true): void;
highlightRanges(hlGroup: string, ranges: Range[], priority?: number): Promise<number[]>;
highlightRanges(hlGroup: string, ranges: Range[], priority: number, isNotify: true): void;
clearMatchGroup(hlGroup: string): void;
clearMatches(ids: number[]): void;
}id: number;The windowid that not change within a Vim session
buffer: Promise<Buffer>;Buffer in window.
tabpage: Promise<Tabpage>;Tabpage contains window.
cursor: Promise<[
number,
number
]>;Cursor position as [line, col], 1 based.
height: Promise<number>;Window height.
width: Promise<number>;Window width.
setCursor(pos: [
number,
number
]): Promise<void>;Set cursor position by request.
setCursor(pos: [
number,
number
], isNotify: true): void;Set cursor position by notification.
setHeight(height: number): Promise<void>;Set height
setHeight(height: number, isNotify: true): void;Set height by notification.
setWidth(width: number): Promise<void>;Set width.
setWidth(width: number, isNotify: true): void;Set width by notification.
position: Promise<[
number,
number
]>;Get window position, not work with vim8's popup.
row: Promise<number>;0-indexed, on-screen window position(row) in display cells.
col: Promise<number>;0-indexed, on-screen window position(col) in display cells.
valid: Promise<boolean>;Check if window valid.
number: Promise<number>;Get window number, throws for invalid window.
setConfig(options: NvimFloatOptions): Promise<void>;Config float window with options.
Note: works on neovim only.
setConfig(options: NvimFloatOptions, isNotify: true): void;Config float window with options by send notification.
Note: works on neovim only.
getConfig(): Promise<NvimFloatOptions>;Gets window configuration.
Note: works on neovim only.
close(force: boolean): Promise<void>;Close window by send request.
close(force: boolean, isNotify: true): void;Close window by send notification.
highlightRanges(hlGroup: string, ranges: Range[], priority?: number): Promise<number[]>;Add highlight to ranges by request (matchaddpos is used)
highlightRanges(hlGroup: string, ranges: Range[], priority: number, isNotify: true): void;Add highlight to ranges by notification (matchaddpos is used)
clearMatchGroup(hlGroup: string): void;Clear match of highlight group by send notification.
clearMatches(ids: number[]): void;Clear match of match ids by send notification.
Interface exported by coc.nvim.
Interface exported by coc.nvim.
export interface UriComponents {
scheme: string;
authority: string;
path: string;
query: string;
fragment: string;
}scheme: string;The scheme of the URI, e.g. file.
authority: string;The authority of the URI.
path: string;The path of the URI.
query: string;The query of the URI.
fragment: string;The fragment of the URI.
Uniform Resource Identifier (URI) RFC 3986. This class is a simple parser which creates the basic component parts (RFC 3986) with minimal validation and encoding.
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| _____________________|__
/ \ / \
urn:example:animal:ferret:nose
export class Uri implements UriComponents {
static isUri(thing: any): thing is Uri;
readonly scheme: string;
readonly authority: string;
readonly path: string;
readonly query: string;
readonly fragment: string;
protected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);
protected constructor(components: UriComponents);
readonly fsPath: string;
with(change: {
scheme?: string;
authority?: string | null;
path?: string | null;
query?: string | null;
fragment?: string | null;
}): Uri;
static parse(value: string, _strict?: boolean): Uri;
static file(path: string): Uri;
static from(components: {
scheme: string;
authority?: string;
path?: string;
query?: string;
fragment?: string;
}): Uri;
toString(skipEncoding?: boolean): string;
toJSON(): UriComponents;
}static isUri(thing: any): thing is Uri;Checks whether the given value is a URI.
readonly scheme: string;scheme is the 'http' part of 'msft.com reference'. The part before the first colon.
readonly authority: string;authority is the 'www.msft.com' part of 'msft.com reference'. The part between the first double slashes and the next slash.
readonly path: string;path is the '/some/path' part of 'msft.com reference'.
readonly query: string;query is the 'query' part of 'msft.com reference'.
readonly fragment: string;fragment is the 'fragment' part of 'msft.com reference'.
protected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);protected constructor(components: UriComponents);readonly fsPath: string;Returns a string representing the corresponding file system path of this URI. Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the platform specific path separator.
The difference to URI#path is the use of the platform specific separator and the handling
of UNC paths. See the below sample of a file-uri with an authority (UNC path).
const u = URI.parse('file://server/c$/folder/file.txt')
u.authority === 'server'
u.path === '/shares/c$/file.txt'
u.fsPath === '\\server\c$\folder\file.txt'
Using URI#path to read a file (using fs-apis) would not be enough because parts of the path,
namely the server name, would be missing. Therefore URI#fsPath exists - it's sugar to ease working
with URIs that represent files on disk (file scheme).
with(change: {
scheme?: string;
authority?: string | null;
path?: string | null;
query?: string | null;
fragment?: string | null;
}): Uri;Returns a new URI with the changed components.
static parse(value: string, _strict?: boolean): Uri;Creates a new URI from a string, e.g. http://www.msft.com/some/path,
file:///usr/home, or scheme:with/path.
static file(path: string): Uri;Creates a new URI from a file system path, e.g. c:\my\files,
/usr/home, or \\server\share\some\path.
The difference between URI#parse and URI#file is that the latter treats the argument
as path, not as stringified-uri. E.g. URI.file(path) is not the same as
URI.parse('file://' + path) because the path might contain characters that are
interpreted (# and ?). See the following sample:
const good = URI.file('/coding/c#/project1');
good.scheme === 'file';
good.path === '/coding/c#/project1';
good.fragment === '';
const bad = URI.parse('file://' + '/coding/c#/project1');
bad.scheme === 'file';
bad.path === '/coding/c'; // path is now broken
bad.fragment === '/project1';static from(components: {
scheme: string;
authority?: string;
path?: string;
query?: string;
fragment?: string;
}): Uri;Creates a new URI from its components.
toString(skipEncoding?: boolean): string;Creates a string representation for this URI. It's guaranteed that calling
URI.parse with the result of this function creates an URI which is equal
to this URI.
toJSON(): UriComponents;Serialize the URI to its components.
See :h complete-items
export interface VimCompleteItem {
word: string;
abbr?: string;
menu?: string;
info?: string;
kind?: string;
icase?: number;
equal?: number;
dup?: number;
empty?: number;
user_data?: string;
deprecated?: boolean;
labelDetails?: CompletionItemLabelDetails;
sortText?: string;
filterText?: string;
insertText?: string;
isSnippet?: boolean;
documentation?: Documentation[];
}word: string;The word to be inserted.
abbr?: string;Abbreviated word shown in the menu.
menu?: string;Description shown in the menu.
info?: string;kind?: string;Kind of the item.
icase?: number;Ignore case when comparing.
equal?: number;Match when the word is equal.
dup?: number;Duplicate the item in the list.
empty?: number;Accept an empty word.
user_data?: string;Custom data of the item.
deprecated?: boolean;The same as deprecated tag.
labelDetails?: CompletionItemLabelDetails;Additional details for a completion item label.
sortText?: string;A string that should be used when comparing this item
with other items. When falsy the word
is used.
filterText?: string;A string that should be used when filtering a set of
completion items. When falsy the word
is used.
insertText?: string;Text to insert, could be snippet text.
isSnippet?: boolean;When true and onCompleteDone handler not exists on source, the snippet
would be expanded after confirm completion.
documentation?: Documentation[];Docs to shown in detail window.
Interface exported by coc.nvim.
export interface CompleteDoneItem {
readonly word: string;
readonly abbr?: string;
readonly source: string;
readonly isSnippet: boolean;
readonly kind?: string | CompletionItemKind;
readonly menu?: string;
}readonly word: string;The word of the completed item.
readonly abbr?: string;Abbreviated word of the item.
readonly source: string;Name of the completion source.
readonly isSnippet: boolean;Whether the item is a snippet.
readonly kind?: string | CompletionItemKind;Kind of the item.
readonly menu?: string;Description shown in the menu.
Interface exported by coc.nvim.
export interface LocationListItem {
bufnr: number;
lnum: number;
end_lnum: number;
col: number;
end_col: number;
text: string;
type: string;
}bufnr: number;Buffer number of the item.
lnum: number;Start line, 1 based.
end_lnum: number;End line, 1 based.
col: number;Start column, 1 based.
end_col: number;End column, 1 based.
text: string;Text of the line.
type: string;Type of the item, like E, W or I.
Interface exported by coc.nvim.
export interface QuickfixItem {
uri?: string;
module?: string;
range?: Range;
text?: string;
type?: string;
filename?: string;
bufnr?: number;
lnum?: number;
end_lnum?: number;
col?: number;
end_col?: number;
valid?: boolean;
nr?: number;
}uri?: string;Uri of the file.
module?: string;Module name of the item.
range?: Range;Range of the item.
text?: string;Text of the item.
type?: string;Type of the item.
filename?: string;Filename of the item.
bufnr?: number;Buffer number of the item.
lnum?: number;Start line, 1 based.
end_lnum?: number;End line, 1 based.
col?: number;Start column, 1 based.
end_col?: number;End column, 1 based.
valid?: boolean;Whether the item is valid.
nr?: number;Number of the item.
A provider result represents the values a provider, like the HoverProvider,
may return. For once this is the actual result type T, like Hover, or a thenable that resolves
to that type T. In addition, null and undefined can be returned - either directly or from a
thenable.
The snippets below are all valid implementations of the HoverProvider:
let a: HoverProvider = {
provideHover(doc, pos, token): ProviderResult<Hover> {
return new Hover('Hello World')
}
}
let b: HoverProvider = {
provideHover(doc, pos, token): ProviderResult<Hover> {
return new Promise(resolve => {
resolve(new Hover('Hello World'))
})
}
}
let c: HoverProvider = {
provideHover(doc, pos, token): ProviderResult<Hover> {
return; // undefined
}
}export type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;Supported provider names.
export enum ProviderName {
FormatOnType = 'formatOnType',
Rename = 'rename',
OnTypeEdit = 'onTypeEdit',
DocumentLink = 'documentLink',
DocumentColor = 'documentColor',
FoldingRange = 'foldingRange',
Format = 'format',
CodeAction = 'codeAction',
FormatRange = 'formatRange',
Hover = 'hover',
Signature = 'signature',
WorkspaceSymbols = 'workspaceSymbols',
DocumentSymbol = 'documentSymbol',
DocumentHighlight = 'documentHighlight',
Definition = 'definition',
Declaration = 'declaration',
TypeDefinition = 'typeDefinition',
Reference = 'reference',
Implementation = 'implementation',
CodeLens = 'codeLens',
SelectionRange = 'selectionRange',
CallHierarchy = 'callHierarchy',
SemanticTokens = 'semanticTokens',
SemanticTokensRange = 'semanticTokensRange',
LinkedEditing = 'linkedEditing',
InlayHint = 'inlayHint',
InlineValue = 'inlineValue',
InlineCompletion = 'inlineCompletion',
NextEdit = 'nextEdit',
TypeHierarchy = 'typeHierarchy'
}FormatOnType = 'formatOnType'Rename = 'rename'OnTypeEdit = 'onTypeEdit'DocumentLink = 'documentLink'DocumentColor = 'documentColor'FoldingRange = 'foldingRange'Format = 'format'CodeAction = 'codeAction'FormatRange = 'formatRange'Hover = 'hover'Signature = 'signature'WorkspaceSymbols = 'workspaceSymbols'DocumentSymbol = 'documentSymbol'DocumentHighlight = 'documentHighlight'Definition = 'definition'Declaration = 'declaration'TypeDefinition = 'typeDefinition'Reference = 'reference'Implementation = 'implementation'CodeLens = 'codeLens'SelectionRange = 'selectionRange'CallHierarchy = 'callHierarchy'SemanticTokens = 'semanticTokens'SemanticTokensRange = 'semanticTokensRange'LinkedEditing = 'linkedEditing'InlayHint = 'inlayHint'InlineValue = 'inlineValue'InlineCompletion = 'inlineCompletion'NextEdit = 'nextEdit'TypeHierarchy = 'typeHierarchy'The completion item provider interface defines the contract between extensions and IntelliSense.
Providers can delay the computation of the detail
and documentation properties by implementing the
resolveCompletionItem-function. However, properties that
are needed for the initial sorting and filtering, like sortText, filterText, insertText, and range, must
not be changed during resolve.
Providers are asked for completions either explicitly by a user gesture or -depending on the configuration- implicitly when typing words or trigger characters.
export interface CompletionItemProvider {
provideCompletionItems(document: LinesTextDocument, position: Position, token: CancellationToken, context?: CompletionContext): ProviderResult<CompletionItem[] | CompletionList>;
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
}provideCompletionItems(document: LinesTextDocument, position: Position, token: CancellationToken, context?: CompletionContext): ProviderResult<CompletionItem[] | CompletionList>;Provide completion items for the given position and document.
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;Given a completion item fill in more data, like doc-comment or details.
The editor will only resolve a completion item once.
export interface HoverProvider {
provideHover(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Hover>;
}provideHover(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Hover>;Provide a hover for the given position and document. Multiple hovers at the same position will be merged by the editor. A hover can have a range which defaults to the word range at the position when omitted.
The definition provider interface defines the contract between extensions and the go to definition and peek definition features.
export interface DefinitionProvider {
provideDefinition(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}provideDefinition(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;Provide the definition of the symbol at the given position and document.
The definition provider interface defines the contract between extensions and the go to definition and peek definition features.
export interface DeclarationProvider {
provideDeclaration(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}provideDeclaration(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;Provide the declaration of the symbol at the given position and document.
The signature help provider interface defines the contract between extensions and the parameter hints-feature.
export interface SignatureHelpProvider {
provideSignatureHelp(document: LinesTextDocument, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;
}provideSignatureHelp(document: LinesTextDocument, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;Provide help for the signature at the given position and document.
The type definition provider defines the contract between extensions and the go to type definition feature.
export interface TypeDefinitionProvider {
provideTypeDefinition(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}provideTypeDefinition(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;Provide the type definition of the symbol at the given position and document.
The reference provider interface defines the contract between extensions and the find references-feature.
export interface ReferenceProvider {
provideReferences(document: LinesTextDocument, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;
}provideReferences(document: LinesTextDocument, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;Provide a set of project-wide references for the given position and document.
Folding context (for future use)
export interface FoldingContext {
}export interface FoldingRangeProvider {
onDidChangeFoldingRanges?: Event<void>;
provideFoldingRanges(document: LinesTextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;
}onDidChangeFoldingRanges?: Event<void>;An optional event to signal that the folding ranges from this provider have changed.
provideFoldingRanges(document: LinesTextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;Returns a list of folding ranges or null and undefined if the provider does not want to participate or was cancelled.
The document symbol provider interface defines the contract between extensions and the go to symbol-feature.
export interface DocumentSymbolProvider {
provideDocumentSymbols(document: LinesTextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
}provideDocumentSymbols(document: LinesTextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;Provide symbol information for the given document.
The implementation provider interface defines the contract between extensions and the go to implementation feature.
export interface ImplementationProvider {
provideImplementation(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}provideImplementation(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;Provide the implementations of the symbol at the given position and document.
The workspace symbol provider interface defines the contract between extensions and the symbol search-feature.
export interface WorkspaceSymbolProvider {
provideWorkspaceSymbols(query: string, token: CancellationToken): ProviderResult<WorkspaceSymbol[]>;
resolveWorkspaceSymbol?(symbol: WorkspaceSymbol, token: CancellationToken): ProviderResult<WorkspaceSymbol>;
}provideWorkspaceSymbols(query: string, token: CancellationToken): ProviderResult<WorkspaceSymbol[]>;Project-wide search for a symbol matching the given query string. It is up to the provider
how to search given the query string, like substring, indexOf etc. To improve performance implementors can
skip the location of symbols and implement resolveWorkspaceSymbol to do that
later.
The query-parameter should be interpreted in a relaxed way as the editor will apply its own highlighting
and scoring on the results. A good rule of thumb is to match case-insensitive and to simply check that the
characters of query appear in their order in a candidate symbol. Don't use prefix, substring, or similar
strict matching.
resolveWorkspaceSymbol?(symbol: WorkspaceSymbol, token: CancellationToken): ProviderResult<WorkspaceSymbol>;Given a symbol fill in its location. This method is called whenever a symbol
is selected in the UI. Providers can implement this method and return incomplete symbols from
provideWorkspaceSymbols which often helps to improve
performance.
export interface RenameProvider {
provideRenameEdits(document: LinesTextDocument, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit>;
prepareRename?(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Range | {
range: Range;
placeholder: string;
}>;
}provideRenameEdits(document: LinesTextDocument, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit>;Provide an edit that describes changes that have to be made to one or many resources to rename a symbol to a different name.
prepareRename?(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Range | {
range: Range;
placeholder: string;
}>;Optional function for resolving and validating a position before running rename. The result can be a range or a range and a placeholder text. The placeholder text should be the identifier of the symbol which is being renamed - when omitted the text in the returned range is used.
The document formatting provider interface defines the contract between extensions and the formatting-feature.
export interface DocumentFormattingEditProvider {
provideDocumentFormattingEdits(document: LinesTextDocument, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}provideDocumentFormattingEdits(document: LinesTextDocument, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;Provide formatting edits for a whole document.
The document formatting provider interface defines the contract between extensions and the formatting-feature.
export interface DocumentRangeFormattingEditProvider {
provideDocumentRangeFormattingEdits(document: LinesTextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
provideDocumentRangesFormattingEdits?(document: LinesTextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}provideDocumentRangeFormattingEdits(document: LinesTextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;Provide formatting edits for a range in a document.
The given range is a hint and providers can decide to format a smaller or larger range. Often this is done by adjusting the start and end of the range to full syntax nodes.
provideDocumentRangesFormattingEdits?(document: LinesTextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;Provide formatting edits for multiple ranges in a document.
The code action interface defines the contract between extensions and the light bulb feature.
A code action can be any command that is known to the system.
export interface CodeActionProvider<T extends CodeAction = CodeAction> {
provideCodeActions(document: LinesTextDocument, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>;
}provideCodeActions(document: LinesTextDocument, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;Provide commands for the given document and range.
resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>;Given a code action fill in its edit-property. Changes to
all other properties, like title, are ignored. A code action that has an edit
will not be resolved.
Metadata about the type of code actions that a CodeActionProvider providers
export interface CodeActionProviderMetadata {
readonly providedCodeActionKinds?: ReadonlyArray<string>;
}readonly providedCodeActionKinds?: ReadonlyArray<string>;CodeActionKinds that this provider may return.
The list of kinds may be generic, such as CodeActionKind.Refactor, or the provider
may list our every specific kind they provide, such as CodeActionKind.Refactor.Extract.append('function)`
The document highlight provider interface defines the contract between extensions and the word-highlight-feature.
export interface DocumentHighlightProvider {
provideDocumentHighlights(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
}provideDocumentHighlights(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;Provide a set of document highlights, like all occurrences of a variable or all exit-points of a function.
The document link provider defines the contract between extensions and feature of showing links in the editor.
export interface DocumentLinkProvider {
provideDocumentLinks(document: LinesTextDocument, token: CancellationToken): ProviderResult<DocumentLink[]>;
resolveDocumentLink?(link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;
}provideDocumentLinks(document: LinesTextDocument, token: CancellationToken): ProviderResult<DocumentLink[]>;Provide links for the given document. Note that the editor ships with a default provider that detects
http(s) and file links.
resolveDocumentLink?(link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;Given a link fill in its target. This method is called when an incomplete
link is selected in the UI. Providers can implement this method and return incomple links
(without target) from the provideDocumentLinks method which
often helps to improve performance.
export interface CodeLensProvider {
provideCodeLenses(document: LinesTextDocument, token: CancellationToken): ProviderResult<CodeLens[]>;
resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
}provideCodeLenses(document: LinesTextDocument, token: CancellationToken): ProviderResult<CodeLens[]>;resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;This function will be called for each visible code lens, usually when scrolling and after calls to compute-lenses.
The document formatting provider interface defines the contract between extensions and the formatting-feature.
export interface OnTypeFormattingEditProvider {
provideOnTypeFormattingEdits(document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}provideOnTypeFormattingEdits(document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;Provide formatting edits after a character has been typed.
The given position and character should hint to the provider
what range the position to expand to, like find the matching {
when } has been entered.
The document color provider defines the contract between extensions and feature of picking and modifying colors in the editor.
export interface DocumentColorProvider {
provideDocumentColors(document: LinesTextDocument, token: CancellationToken): ProviderResult<ColorInformation[]>;
provideColorPresentations(color: Color, context: {
document: LinesTextDocument;
range: Range;
}, token: CancellationToken): ProviderResult<ColorPresentation[]>;
}provideDocumentColors(document: LinesTextDocument, token: CancellationToken): ProviderResult<ColorInformation[]>;Provide colors for the given document.
provideColorPresentations(color: Color, context: {
document: LinesTextDocument;
range: Range;
}, token: CancellationToken): ProviderResult<ColorPresentation[]>;Provide representations for a color.
Interface exported by coc.nvim.
export interface TextDocumentContentProvider {
onDidChange?: Event<Uri>;
provideTextDocumentContent(uri: Uri, token: CancellationToken): ProviderResult<string>;
}provideTextDocumentContent(uri: Uri, token: CancellationToken): ProviderResult<string>;Interface exported by coc.nvim.
export interface SelectionRangeProvider {
provideSelectionRanges(document: LinesTextDocument, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[]>;
}provideSelectionRanges(document: LinesTextDocument, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[]>;Provide selection ranges starting at a given position. The first range must contain position and subsequent ranges must contain the previous range.
The call hierarchy provider interface describes the contract between extensions and the call hierarchy feature which allows to browse calls and caller of function, methods, constructor etc.
export interface CallHierarchyProvider {
prepareCallHierarchy(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<CallHierarchyItem | CallHierarchyItem[]>;
provideCallHierarchyIncomingCalls(item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyIncomingCall[]>;
provideCallHierarchyOutgoingCalls(item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyOutgoingCall[]>;
}prepareCallHierarchy(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<CallHierarchyItem | CallHierarchyItem[]>;Bootstraps call hierarchy by returning the item that is denoted by the given document
and position. This item will be used as entry into the call graph. Providers should
return undefined or null when there is no item at the given location.
provideCallHierarchyIncomingCalls(item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyIncomingCall[]>;Provide all incoming calls for an item, e.g all callers for a method. In graph terms this describes directed and annotated edges inside the call graph, e.g the given item is the starting node and the result is the nodes that can be reached.
provideCallHierarchyOutgoingCalls(item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyOutgoingCall[]>;Provide all outgoing calls for an item, e.g call calls to functions, methods, or constructors from the given item. In graph terms this describes directed and annotated edges inside the call graph, e.g the given item is the starting node and the result is the nodes that can be reached.
The document semantic tokens provider interface defines the contract between extensions and semantic tokens.
export interface DocumentSemanticTokensProvider {
onDidChangeSemanticTokens?: Event<void>;
provideDocumentSemanticTokens(document: LinesTextDocument, token: CancellationToken): ProviderResult<SemanticTokens>;
provideDocumentSemanticTokensEdits?(document: LinesTextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensDelta>;
}onDidChangeSemanticTokens?: Event<void>;An optional event to signal that the semantic tokens from this provider have changed.
provideDocumentSemanticTokens(document: LinesTextDocument, token: CancellationToken): ProviderResult<SemanticTokens>;Tokens in a file are represented as an array of integers. The position of each token is expressed relative to the token before it, because most tokens remain stable relative to each other when edits are made in a file.
In short, each token takes 5 integers to represent, so a specific token i in the file consists of the following array indices:
5*i - deltaLine: token line number, relative to the previous token5*i+1 - deltaStart: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line)5*i+2 - length: the length of the token. A token cannot be multiline.5*i+3 - tokenType: will be looked up in SemanticTokensLegend.tokenTypes. We currently ask that tokenType < 65536.5*i+4 - tokenModifiers: each set bit will be looked up in SemanticTokensLegend.tokenModifiersHere is an example for encoding a file with 3 tokens in a uint32 array:
{ line: 2, startChar: 5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] },
{ line: 2, startChar: 10, length: 4, tokenType: "type", tokenModifiers: [] },
{ line: 5, startChar: 2, length: 7, tokenType: "class", tokenModifiers: [] }
tokenTypes: ['property', 'type', 'class'],
tokenModifiers: ['private', 'static']
tokenType and tokenModifiers as integers using the legend. Token types are looked
up by index, so a tokenType value of 1 means tokenTypes[1]. Multiple token modifiers can be set by using bit flags,
so a tokenModifier value of 3 is first viewed as binary 0b00000011, which means [tokenModifiers[0], tokenModifiers[1]] because
bits 0 and 1 are set. Using this legend, the tokens now are: { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 },
{ line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 },
{ line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 }
startChar of the second token is made relative to the startChar
of the first token, so it will be 10 - 5. The third token is on a different line than the second token, so the
startChar of the third token will not be altered: { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 },
{ deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 },
{ deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 }
// 1st token, 2nd token, 3rd token
[ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ]
provideDocumentSemanticTokensEdits?(document: LinesTextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensDelta>;Instead of always returning all the tokens in a file, it is possible for a DocumentSemanticTokensProvider to implement
this method (provideDocumentSemanticTokensEdits) and then return incremental updates to the previously provided semantic tokens.
Suppose that provideDocumentSemanticTokens has previously returned the following semantic tokens:
// 1st token, 2nd token, 3rd token
[ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ]
Also suppose that after some edits, the new semantic tokens in a file are:
// 1st token, 2nd token, 3rd token
[ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ]
It is possible to express these new tokens in terms of an edit applied to the previous tokens:
[ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] // old tokens
[ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] // new tokens
edit: { start: 0, deleteCount: 1, data: [3] } // replace integer at offset 0 with 3
NOTE: If the provider cannot compute SemanticTokensEdits, it can "give up" and return all the tokens in the document again.
NOTE: All edits in SemanticTokensEdits contain indices in the old integers array, so they all refer to the previous result state.
The document range semantic tokens provider interface defines the contract between extensions and semantic tokens.
export interface DocumentRangeSemanticTokensProvider {
provideDocumentRangeSemanticTokens(document: LinesTextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
}provideDocumentRangeSemanticTokens(document: LinesTextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;Interface exported by coc.nvim.
export interface LinkedEditingRangeProvider {
provideLinkedEditingRanges(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
}provideLinkedEditingRanges(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;For a given position in a document, returns the range of the symbol at the position and all ranges that have the same content. A change to one of the ranges can be applied to all other ranges if the new content is valid. An optional word pattern can be returned with the result to describe valid contents. If no result-specific word pattern is provided, the word pattern from the language configuration is used.
The inlay hints provider interface defines the contract between extensions and the inlay hints feature.
export interface InlayHintsProvider<T extends InlayHint = InlayHint> {
onDidChangeInlayHints?: Event<void>;
provideInlayHints(document: LinesTextDocument, range: Range, token: CancellationToken): ProviderResult<T[]>;
resolveInlayHint?(hint: T, token: CancellationToken): ProviderResult<T>;
}onDidChangeInlayHints?: Event<void>;An optional event to signal that inlay hints from this provider have changed.
provideInlayHints(document: LinesTextDocument, range: Range, token: CancellationToken): ProviderResult<T[]>;Provide inlay hints for the given range and document.
Note that inlay hints that are not contained by the given range are ignored.
resolveInlayHint?(hint: T, token: CancellationToken): ProviderResult<T>;Given an inlay hint fill in tooltip, text edits, or complete label parts.
Note that the editor will resolve an inlay hint at most once.
The type hierarchy provider interface describes the contract between extensions and the type hierarchy feature.
export interface TypeHierarchyProvider {
prepareTypeHierarchy(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
provideTypeHierarchySupertypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
provideTypeHierarchySubtypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
}prepareTypeHierarchy(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;Bootstraps type hierarchy by returning the item that is denoted by the given document
and position. This item will be used as entry into the type graph. Providers should
return undefined or null when there is no item at the given location.
provideTypeHierarchySupertypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;Provide all supertypes for an item, e.g all types from which a type is derived/inherited. In graph terms this describes directed and annotated edges inside the type graph, e.g the given item is the starting node and the result is the nodes that can be reached.
provideTypeHierarchySubtypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;Provide all subtypes for an item, e.g all types which are derived/inherited from the given item. In graph terms this describes directed and annotated edges inside the type graph, e.g the given item is the starting node and the result is the nodes that can be reached.
The inline values provider interface defines the contract between extensions and the editor's debugger inline values feature. In this contract the provider returns inline value information for a given document range and the editor shows this information in the editor at the end of lines.
export interface InlineValuesProvider {
onDidChangeInlineValues?: Event<void> | undefined;
provideInlineValues(document: TextDocument, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]>;
}onDidChangeInlineValues?: Event<void> | undefined;An optional event to signal that inline values have changed.
provideInlineValues(document: TextDocument, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]>;Provide "inline value" information for a given document and range. The editor calls this method whenever debugging stops in the given document. The returned inline values information is rendered in the editor at the end of lines.
Interface exported by coc.nvim.
export interface DiagnosticProvider {
onDidChangeDiagnostics: Event<void> | undefined;
provideDiagnostics(document: TextDocument | Uri, previousResultId: string | undefined, token: CancellationToken): ProviderResult<DocumentDiagnosticReport>;
provideWorkspaceDiagnostics?(resultIds: PreviousResultId[], token: CancellationToken, resultReporter: ResultReporter): ProviderResult<WorkspaceDiagnosticReport>;
}onDidChangeDiagnostics: Event<void> | undefined;Event fired when diagnostics of a document change.
provideDiagnostics(document: TextDocument | Uri, previousResultId: string | undefined, token: CancellationToken): ProviderResult<DocumentDiagnosticReport>;Provide diagnostics for the given document.
provideWorkspaceDiagnostics?(resultIds: PreviousResultId[], token: CancellationToken, resultReporter: ResultReporter): ProviderResult<WorkspaceDiagnosticReport>;Provide workspace diagnostics.
The inline completion item provider interface defines the contract between extensions and the inline completion feature.
Providers are asked for completions either explicitly by a user gesture or implicitly when typing.
export interface InlineCompletionItemProvider {
provideInlineCompletionItems(document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<InlineCompletionItem[] | InlineCompletionList>;
}provideInlineCompletionItems(document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<InlineCompletionItem[] | InlineCompletionList>;Provides inline completion items for the given position and document.
If inline completions are enabled, this method will be called whenever the user stopped typing.
It will also be called when the user explicitly triggers inline completions or explicitly asks for the next or previous inline completion.
In that case, all available inline completions should be returned.
context.triggerKind can be used to distinguish between these scenarios.
Interface exported by coc.nvim.
export interface NextEditItem {
textDocument: VersionedTextDocumentIdentifier;
range: Range;
newText: string;
command?: Command;
}textDocument: VersionedTextDocumentIdentifier;Target document and the exact version used to compute this edit.
range: Range;newText: string;command?: Command;Interface exported by coc.nvim.
export interface NextEditList {
items: NextEditItem[];
}items: NextEditItem[];Interface exported by coc.nvim.
export interface NextEditContext {
triggerKind: InlineCompletionTriggerKind;
}triggerKind: InlineCompletionTriggerKind;Provider contract for returning Next Edit candidates and receiving notifications when a candidate is shown.
export interface NextEditProvider {
provideNextEdits(document: TextDocument, position: Position, context: NextEditContext, token: CancellationToken): ProviderResult<NextEditItem[] | NextEditList>;
handleDidShowNextEdit?(item: NextEditItem): void | Thenable<void>;
}provideNextEdits(document: TextDocument, position: Position, context: NextEditContext, token: CancellationToken): ProviderResult<NextEditItem[] | NextEditList>;handleDidShowNextEdit?(item: NextEditItem): void | Thenable<void>;import {
ExtensionContext,
languages,
NextEditProvider,
Range,
} from 'coc.nvim'
export function activate(context: ExtensionContext): void {
const provider: NextEditProvider = {
provideNextEdits(document, position, _nextEditContext, token) {
if (token.isCancellationRequested) return null
return [{
textDocument: { uri: document.uri, version: document.version },
range: Range.create(position, position),
newText: 'generatedText',
}]
},
}
context.subscriptions.push(
languages.registerNextEditProvider([{ language: 'typescript' }], provider),
)
}An error type that should be used to signal cancellation of an operation.
This type can be used in response to a cancellation token being cancelled or when an operation is being cancelled by the executor of that operation.
export class CancellationError extends Error {
constructor();
}constructor();Creates a new cancellation error.
A semantic tokens builder can help with creating a SemanticTokens instance
which contains delta encoded semantic tokens.
export class SemanticTokensBuilder {
constructor(legend?: SemanticTokensLegend);
push(line: number, char: number, length: number, tokenType: number, tokenModifiers?: number): void;
push(range: Range, tokenType: string, tokenModifiers?: string[]): void;
build(resultId?: string): SemanticTokens;
}constructor(legend?: SemanticTokensLegend);push(line: number, char: number, length: number, tokenType: number, tokenModifiers?: number): void;Add another token.
push(range: Range, tokenType: string, tokenModifiers?: string[]): void;Add another token. Use only when providing a legend.
build(resultId?: string): SemanticTokens;Finish and create a SemanticTokens instance.
Interface exported by coc.nvim.
export interface Document {
readonly buffer: Buffer;
readonly attached: boolean;
readonly isCommandLine: boolean;
readonly buftype: string;
readonly textDocument: LinesTextDocument;
readonly onDocumentChange: Event<DidChangeTextDocumentParams>;
readonly changedtick: number;
readonly schema: string;
readonly lineCount: number;
readonly winid: number;
readonly previewwindow: boolean;
readonly dirty: boolean;
readonly bufnr: number;
readonly content: string;
readonly filetype: string;
readonly languageId: string;
readonly uri: string;
readonly version: number;
readonly lines: ReadonlyArray<string>;
applyEdits(edits: TextEdit[], joinUndo?: boolean, move?: boolean | Position): Promise<void>;
synchronize(): Promise<void>;
changeLines(lines: [
number,
string
][]): Promise<void>;
getOffset(lnum: number, col: number): number;
isWord(word: string): boolean;
getWordRangeAtPosition(position: Position, extraChars?: string, current?: boolean): Range | null;
getSymbolRanges(word: string): Range[];
getline(line: number, current?: boolean): string;
getLines(start?: number, end?: number): string[];
getVar<T>(key: string, defaultValue?: T): T;
getPosition(lnum: number, col: number): Position;
fixStartcol(position: Position, valids: string[]): number;
getDocumentContent(): string;
}readonly buffer: Buffer;Buffer of the document.
readonly attached: boolean;Document is attached to vim.
readonly isCommandLine: boolean;Is command line document.
readonly buftype: string;buftype option of buffer.
readonly textDocument: LinesTextDocument;Text document that synchronized.
readonly onDocumentChange: Event<DidChangeTextDocumentParams>;Fired when document change.
readonly changedtick: number;Get current buffer changedtick.
readonly schema: string;Scheme of document.
readonly lineCount: number;Line count of current buffer.
readonly winid: number;Window ID when buffer create, could be -1 when no window associated.
readonly previewwindow: boolean;Returns if current document is opened with previewwindow
readonly dirty: boolean;Check if document changed after last synchronize
readonly bufnr: number;Buffer number
readonly content: string;Content of textDocument.
readonly filetype: string;Converted filetype.
readonly languageId: string;Main filetype of buffer, first part when buffer filetype contains dots. Same as filetype most of the time.
readonly uri: string;Uri of the document.
readonly version: number;Version of the document.
readonly lines: ReadonlyArray<string>;Current lines of buffer
applyEdits(edits: TextEdit[], joinUndo?: boolean, move?: boolean | Position): Promise<void>;Apply text edits to document. nvim_buf_set_text() is used when possible
synchronize(): Promise<void>;Synchronize latest buffer lines to vim. This method is needed after applyEdits to wait for buffer synchronize with changed lines.
changeLines(lines: [
number,
string
][]): Promise<void>;Change individual lines.
getOffset(lnum: number, col: number): number;Get offset from lnum & col
isWord(word: string): boolean;Check string is word.
getWordRangeAtPosition(position: Position, extraChars?: string, current?: boolean): Range | null;Word range at position.
getSymbolRanges(word: string): Range[];Get ranges of word in textDocument.
getline(line: number, current?: boolean): string;Get line for buffer
getLines(start?: number, end?: number): string[];Get range of current lines, zero indexed, end exclude.
getVar<T>(key: string, defaultValue?: T): T;Get variable value by key, defined by b:coc_{key}
getPosition(lnum: number, col: number): Position;Get position from lnum & col
fixStartcol(position: Position, valids: string[]): number;Adjust col with new valid character before position.
getDocumentContent(): string;Get current content text, consider eol option.
Represents a text editor's options.
export interface TextEditorOptions {
tabSize: number;
insertSpaces: boolean;
trimTrailingWhitespace?: boolean;
insertFinalNewline?: boolean;
trimFinalNewlines?: boolean;
}tabSize: number;The size in spaces a tab takes. This is used for two purposes:
When getting a text editor's options, this property will always be a number (resolved).
insertSpaces: boolean;When pressing Tab insert n spaces. When getting a text editor's options, this property will always be a boolean (resolved).
trimTrailingWhitespace?: boolean;Trim trailing whitespace on a line.
insertFinalNewline?: boolean;Insert a newline character at the end of the file if one does not exist.
trimFinalNewlines?: boolean;Trim all newlines after the final newline at the end of the file.
Represents an editor that is attached to a document.
export interface TextEditor {
readonly tabpageid: number;
readonly winid: number;
readonly winnr: number;
readonly document: Document;
readonly visibleRanges: readonly Range[];
readonly options: TextEditorOptions;
}readonly tabpageid: number;The tabpageid of current editor.
readonly winid: number;The window id of current editor.
readonly winnr: number;The window number of current editor.
readonly document: Document;The document associated with this text editor. The document will be the same for the entire lifetime of this text editor.
readonly visibleRanges: readonly Range[];The current visible ranges in the editor (vertically). This accounts only for vertical scrolling, and not for horizontal scrolling.
readonly options: TextEditorOptions;Text editor options.
Interface exported by coc.nvim.
export interface Documentation {
filetype: string;
content: string;
active?: [
number,
number
];
highlights?: HighlightItem[];
}filetype: string;Filetype used for highlight, markdown is supported.
content: string;Content of document.
active?: [
number,
number
];Byte offset (0 based) that should be undelined.
highlights?: HighlightItem[];Highlights of the document.
A file glob pattern to match file paths against. This can either be a glob pattern string
(like **/*.{ts,js} or *.{ts,js}) or a relative pattern.
Glob patterns can have the following syntax:
* to match one or more characters in a path segment? to match on one character in a path segment** to match any number of path segments, including none{} to group conditions (e.g. **/*.{ts,js} matches all TypeScript and JavaScript files)[] to declare a range of characters to match in a path segment (e.g., example.[0-9] to match on example.0, example.1, …)[!...] to negate a range of characters to match in a path segment (e.g., example.[!0-9] to match on example.a, example.b, but not example.0)Note: a backslash (\) is not valid within a glob pattern. If you have an existing file
path to match against, consider to use the relative pattern support
that takes care of converting any backslash into slash. Otherwise, make sure to convert
any backslash to slash when creating the glob pattern.
export type GlobPattern = string | RelativePattern;A relative pattern is a helper to construct glob patterns that are matched relatively to a base file path. The base path can either be an absolute file path as string or uri or a workspace folder, which is the preferred way of creating the relative pattern.
export class RelativePattern {
baseUri: Uri;
pattern: string;
constructor(base: WorkspaceFolder | Uri | string, pattern: string);
toJSON(): {
pattern: string;
baseUri: UriComponents;
};
}baseUri: Uri;A base file path to which this pattern will be matched against relatively.
pattern: string;A file glob pattern like *.{ts,js} that will be matched on file paths
relative to the base path.
Example: Given a base of /home/work/folder and a file path of /home/work/folder/index.js,
the file glob pattern will match on index.js.
constructor(base: WorkspaceFolder | Uri | string, pattern: string);Creates a new relative pattern object with a base file path and pattern to match. This pattern will be matched on file paths relative to the base.
Example:
const folder = vscode.workspace.workspaceFolders?.[0];
if (folder) {
// Match any TypeScript file in the root of this workspace folder
const pattern1 = new vscode.RelativePattern(folder, '*.ts');
// Match any TypeScript file in `someFolder` inside this workspace folder
const pattern2 = new vscode.RelativePattern(folder, 'someFolder/*.ts');
}toJSON(): {
pattern: string;
baseUri: UriComponents;
};Serialize to a JSON object with pattern and baseUri components.
Build buffer with lines and highlights
export class Highlighter {
addLine(line: string, hlGroup?: string): void;
addLines(lines: string[]): void;
addTexts(items: {
text: string;
hlGroup?: string;
}[]): void;
addText(text: string, hlGroup?: string): void;
get length(): number;
getline(line: number): string;
get highlights(): ReadonlyArray<HighlightItem>;
get content(): string;
render(buffer: Buffer, start?: number, end?: number): void;
}addLine(line: string, hlGroup?: string): void;Add a line with highlight group.
addLines(lines: string[]): void;Add lines without highlights.
addTexts(items: {
text: string;
hlGroup?: string;
}[]): void;Add texts to new lines, each text may have its own highlight group.
addText(text: string, hlGroup?: string): void;Add text with highlight.
get length(): number;Get line count
getline(line: number): string;Get content of specific line.
get highlights(): ReadonlyArray<HighlightItem>;Highlights of the buffer.
get content(): string;Content of all lines joined by newline.
render(buffer: Buffer, start?: number, end?: number): void;Render lines to buffer at specified range.
Since notifications is used, use nvim.pauseNotification & nvim.resumeNotification
when you need to wait for the request finish.
Build line with content and highlights.
export class LineBuilder {
constructor(addSpace?: boolean);
append(text: string, hlGroup?: string, nested?: {
offset: number;
length: number;
hlGroup: string;
}[]): void;
appendBuilder(builder: LineBuilder): void;
get label(): string;
get highlights(): AnsiHighlight[];
}constructor(addSpace?: boolean);append(text: string, hlGroup?: string, nested?: {
offset: number;
length: number;
hlGroup: string;
}[]): void;Append text with optional highlight group and nested highlights.
appendBuilder(builder: LineBuilder): void;Append another builder to this one.
get label(): string;Content of the line.
get highlights(): AnsiHighlight[];Highlights of the line.
Interface exported by coc.nvim.
export interface ListConfiguration {
get<T>(key: string, defaultValue?: T): T;
previousKey(): string;
nextKey(): string;
dispose(): void;
}get<T>(key: string, defaultValue?: T): T;Get value of configuration key.
previousKey(): string;Get previous key of configuration.
nextKey(): string;Get next key of configuration.
dispose(): void;Dispose the configuration watcher.
Interface exported by coc.nvim.
export interface ListActionOptions {
persist?: boolean;
reload?: boolean;
parallel?: boolean;
tabPersist?: boolean;
}persist?: boolean;No prompt stop and window switch when invoked.
reload?: boolean;Reload list after action invoked.
parallel?: boolean;Support multiple items as execute argument.
tabPersist?: boolean;Tab positioned list should be persisted (no window switch) on action invoke.
Interface exported by coc.nvim.
export interface CommandTaskOption {
cmd: string;
args: string[];
cwd?: string;
env?: NodeJS.ProcessEnv;
onLine: (line: string) => ListItem | undefined;
}cmd: string;Command to run.
args: string[];Arguments of command.
cwd?: string;Current working directory.
env?: NodeJS.ProcessEnv;Environment variables of the command.
onLine: (line: string) => ListItem | undefined;Runs for each line, return undefined for invalid item.
Class exported by coc.nvim.
export abstract class BasicList implements IList {
name: string;
defaultAction: string;
readonly actions: ListAction[];
options: ListArgument[];
protected nvim: Neovim;
protected disposables: Disposable[];
public config: ListConfiguration;
constructor();
get alignColumns(): boolean;
protected get floatPreview(): boolean;
protected get hlGroup(): string;
protected get previewHeight(): number;
protected get splitRight(): boolean;
protected get toplineStyle(): string;
protected get toplineOffset(): number;
public parseArguments(args: string[]): {
[key: string]: string | boolean;
};
protected getConfig(): WorkspaceConfiguration;
protected addAction(name: string, fn: (item: ListItem, context: ListContext) => ProviderResult<void>, options?: ListActionOptions): void;
protected addMultipleAction(name: string, fn: (item: ListItem[], context: ListContext) => ProviderResult<void>, options?: ListActionOptions): void;
protected createCommandTask(opt: CommandTaskOption): ListTask;
public addLocationActions(): void;
public convertLocation(location: LocationWithTarget | LocationWithLine | string): Promise<LocationWithTarget>;
public jumpTo(location: Location | LocationWithLine | string, command?: string, context?: ListContext): Promise<void>;
public createAction(action: ListAction): void;
protected previewLocation(location: LocationWithTarget, context: ListContext): Promise<void>;
public preview(options: PreviewOptions, context: ListContext): Promise<void>;
doHighlight(): void;
abstract loadItems(context: ListContext, token?: CancellationToken): Promise<ListItem[] | ListTask | null | undefined>;
dispose(): void;
}name: string;Unique name, must be provided by implementation class.
defaultAction: string;Default action name invoked by <cr> by default, must be provided by implementation class.
readonly actions: ListAction[];Registered actions.
options: ListArgument[];Arguments configuration of list.
protected nvim: Neovim;protected disposables: Disposable[];public config: ListConfiguration;Configuration of the current list.
constructor();get alignColumns(): boolean;Should align columns when true.
protected get floatPreview(): boolean;protected get hlGroup(): string;protected get previewHeight(): number;protected get splitRight(): boolean;protected get toplineStyle(): string;protected get toplineOffset(): number;public parseArguments(args: string[]): {
[key: string]: string | boolean;
};Parse argument string array for argument object from this.options.
Could be used inside this.loadItems()
protected getConfig(): WorkspaceConfiguration;Get configurations of current list
protected addAction(name: string, fn: (item: ListItem, context: ListContext) => ProviderResult<void>, options?: ListActionOptions): void;Add an action
protected addMultipleAction(name: string, fn: (item: ListItem[], context: ListContext) => ProviderResult<void>, options?: ListActionOptions): void;Add action that support multiple selection.
protected createCommandTask(opt: CommandTaskOption): ListTask;Create task from command task option.
public addLocationActions(): void;Add location related actions, should be called in constructor.
public convertLocation(location: LocationWithTarget | LocationWithLine | string): Promise<LocationWithTarget>;Convert location to a Location object.
public jumpTo(location: Location | LocationWithLine | string, command?: string, context?: ListContext): Promise<void>;Jump to location
public createAction(action: ListAction): void;Add an action to this list.
protected previewLocation(location: LocationWithTarget, context: ListContext): Promise<void>;Preview location.
public preview(options: PreviewOptions, context: ListContext): Promise<void>;Preview lines.
doHighlight(): void;Use for syntax highlights, invoked after buffer loaded.
abstract loadItems(context: ListContext, token?: CancellationToken): Promise<ListItem[] | ListTask | null | undefined>;Invoked for listItems or listTask, could throw error when failed to load.
dispose(): void;Dispose the list, dispose registered disposables.
Class exported by coc.nvim.
export class Mutex {
get busy(): boolean;
acquire(): Promise<() => void>;
use<T>(f: () => Promise<T>): Promise<T>;
reset(): void;
}get busy(): boolean;Returns true when task is running.
acquire(): Promise<() => void>;Resolved release function that must be called after task finish.
use<T>(f: () => Promise<T>): Promise<T>;Captrue the async task function that ensures to be executed one by one.
reset(): void;Reset the mutex, clear pending tasks.
Interface exported by coc.nvim.
export interface AnsiItem {
foreground?: string;
background?: string;
bold?: boolean;
italic?: boolean;
underline?: boolean;
text: string;
}foreground?: string;Foreground color of the text.
background?: string;Background color of the text.
bold?: boolean;Text is bold when true.
italic?: boolean;Text is italic when true.
underline?: boolean;Text is underlined when true.
text: string;The text content.
Interface exported by coc.nvim.
export interface ParsedUrlQueryInput {
[key: string]: unknown;
}[key: string]: unknown;Interface exported by coc.nvim.
export interface FetchOptions {
method?: string;
timeout?: number;
buffer?: boolean;
data?: string | {
[key: string]: any;
} | Buffer;
query?: ParsedUrlQueryInput;
headers?: Record<string, string>;
user?: string;
password?: string;
maxResponseSize?: number;
}method?: string;Default to 'GET'
timeout?: number;Default no timeout
buffer?: boolean;Always return buffer instead of parsed response.
data?: string | {
[key: string]: any;
} | Buffer;Data send to server.
query?: ParsedUrlQueryInput;Plain object added as query of url
headers?: Record<string, string>;Headers of the request.
user?: string;User for http basic auth, should use with password
password?: string;Password for http basic auth, should use with user
maxResponseSize?: number;Maximum decompressed response size in bytes. Defaults to 128 MiB.
Interface exported by coc.nvim.
export interface DownloadOptions extends Omit<FetchOptions, 'buffer' | 'maxResponseSize'> {
dest: string;
strip?: number;
etagAlgorithm?: string;
extract?: boolean | 'untar' | 'unzip';
onProgress?: (percent: string) => void;
maxDownloadSize?: number;
maxExtractSize?: number;
maxArchiveEntries?: number;
}dest: string;Folder that contains downloaded file or extracted files by untar or unzip
strip?: number;Remove the specified number of leading path elements for untar only, default to 1.
etagAlgorithm?: string;algorithm for check etag header with response data, used by crypto.createHash().
extract?: boolean | 'untar' | 'unzip';If true, use untar for .tar.gz filename
onProgress?: (percent: string) => void;Callback invoked with the download progress percent.
maxDownloadSize?: number;Maximum number of compressed bytes accepted from the network. Defaults to 512 MiB.
maxExtractSize?: number;Maximum total uncompressed archive size. Defaults to 1 GiB.
maxArchiveEntries?: number;Maximum number of archive entries. Defaults to 100000.
Type alias exported by coc.nvim.
export type ResponseResult = string | Buffer | {
[name: string]: any;
};Interface exported by coc.nvim.
interface ExecOptions {
cwd?: string;
env?: NodeJS.ProcessEnv;
shell?: string;
timeout?: number;
maxBuffer?: number;
killSignal?: string;
uid?: number;
gid?: number;
windowsHide?: boolean;
encoding?: string;
}cwd?: string;Current working directory of the process.
env?: NodeJS.ProcessEnv;Environment variables of the process.
shell?: string;Shell used to run the command.
timeout?: number;Timeout in milliseconds.
maxBuffer?: number;Max buffer size of stdout.
killSignal?: string;Signal used to kill the process on timeout.
uid?: number;User id of the process.
gid?: number;Group id of the process.
windowsHide?: boolean;Hide the window on Windows when true.
encoding?: string;Encoding used to decode stdout, default to 'utf8'.
Type of a file or directory.
export enum FileType {
Unknown = 0,
File = 1,
Directory = 2,
SymbolicLink = 64
}Unknown = 0The file type is unknown.
File = 1A regular file.
Directory = 2A directory.
SymbolicLink = 64A symbolic link to a file.
Interface exported by coc.nvim.
export interface CommandItem {
id: string;
internal?: boolean;
execute(...args: any[]): any;
}id: string;Unique id of the command.
internal?: boolean;Internal command, not shown in lists.
execute(...args: any[]): any;Execute the command handler.
Type alias exported by coc.nvim.
type EventResult = void | Promise<void>;Type alias exported by coc.nvim.
type MoveEvents = 'CursorMoved' | 'CursorMovedI';Type alias exported by coc.nvim.
type HoldEvents = 'CursorHold' | 'CursorHoldI';Type alias exported by coc.nvim.
type BufEvents = 'BufHidden' | 'BufEnter' | 'BufWritePost' | 'InsertLeave' | 'TermOpen' | 'InsertEnter' | 'BufCreate' | 'BufUnload' | 'BufWritePre' | 'Enter';Type alias exported by coc.nvim.
type EmptyEvents = 'FocusGained' | 'FocusLost' | 'InsertSnippet';Type alias exported by coc.nvim.
type InsertChangeEvents = 'TextChangedP' | 'TextChangedI';Type alias exported by coc.nvim.
type TaskEvents = 'TaskExit' | 'TaskStderr' | 'TaskStdout';Type alias exported by coc.nvim.
type WindowEvents = 'WinLeave' | 'WinEnter' | 'WinClosed';Type alias exported by coc.nvim.
type AllEvents = BufEvents | EmptyEvents | HoldEvents | MoveEvents | TaskEvents | WindowEvents | InsertChangeEvents | 'CompleteDone' | 'TextChanged' | 'MenuPopupChanged' | 'InsertCharPre' | 'FileType' | 'BufWinEnter' | 'BufWinLeave' | 'VimResized' | 'DirChanged' | 'OptionSet' | 'Command' | 'BufReadCmd' | 'GlobalChange' | 'InputChar' | 'WinLeave' | 'MenuInput' | 'PromptInsert' | 'FloatBtnClick' | 'InsertSnippet' | 'PromptKeyPress' | 'WinScrolled' | 'WindowVisible';Type alias exported by coc.nvim.
type OptionValue = string | number | boolean;Type alias exported by coc.nvim.
type PromptWidowKeys = 'C-j' | 'C-k' | 'C-n' | 'C-p' | 'up' | 'down';Interface exported by coc.nvim.
export interface CursorPosition {
readonly bufnr: number;
readonly lnum: number;
readonly col: number;
readonly insert: boolean;
}readonly bufnr: number;Buffer number.
readonly lnum: number;Line number, 1 based.
readonly col: number;Column number, 1 based.
readonly insert: boolean;Whether the cursor is in insert mode.
Interface exported by coc.nvim.
export interface InsertChange {
readonly lnum: number;
readonly col: number;
readonly pre: string;
readonly insertChar: string | undefined;
readonly changedtick: number;
}readonly lnum: number;1 based line number
readonly col: number;1 based column number
readonly pre: string;Text before cursor.
readonly insertChar: string | undefined;Insert character that cause change of this time.
readonly changedtick: number;Changedtick of the buffer.
Interface exported by coc.nvim.
export interface PopupChangeEvent {
readonly index: number;
readonly word: string;
readonly height: number;
readonly width: number;
readonly row: number;
readonly col: number;
readonly size: number;
readonly scrollbar: boolean;
readonly inserted: boolean;
readonly move: boolean;
}readonly index: number;0 based index of item in the list.
readonly word: string;Word of item.
readonly height: number;Height of pum.
readonly width: number;Width of pum.
readonly row: number;Screen row of pum.
readonly col: number;Screen col of pum.
readonly size: number;Total length of completion list.
readonly scrollbar: boolean;Scollbar in the pum.
readonly inserted: boolean;Word is inserted.
readonly move: boolean;Caused by selection change (not initial or completed)
Interface exported by coc.nvim.
export interface VisibleEvent {
winid: number;
bufnr: number;
region: [
number,
number
];
}winid: number;Window id.
bufnr: number;Buffer number.
region: [
number,
number
];1 based, end inclusive topline, botline
An event that is fired after files are created.
export interface FileCreateEvent {
readonly files: ReadonlyArray<Uri>;
}readonly files: ReadonlyArray<Uri>;The files that got created.
An event that is fired when files are going to be created.
To make modifications to the workspace before the files are created, call the `waitUntil-function with a thenable that resolves to a workspace edit.
export interface FileWillCreateEvent {
readonly token: CancellationToken;
readonly files: ReadonlyArray<Uri>;
waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;
}readonly token: CancellationToken;A cancellation token.
readonly files: ReadonlyArray<Uri>;The files that are going to be created.
waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;Allows to pause the event and to apply a workspace edit.
Note: This function can only be called during event dispatch and not in an asynchronous manner:
workspace.onWillCreateFiles(event => {
// async, will *throw* an error
setTimeout(() => event.waitUntil(promise));
// sync, OK
event.waitUntil(promise);
})An event that is fired when files are going to be deleted.
To make modifications to the workspace before the files are deleted, call the `waitUntil-function with a thenable that resolves to a workspace edit.
export interface FileWillDeleteEvent {
readonly files: ReadonlyArray<Uri>;
waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;
}readonly files: ReadonlyArray<Uri>;The files that are going to be deleted.
waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;Allows to pause the event and to apply a workspace edit.
Note: This function can only be called during event dispatch and not in an asynchronous manner:
workspace.onWillCreateFiles(event => {
// async, will *throw* an error
setTimeout(() => event.waitUntil(promise));
// sync, OK
event.waitUntil(promise);
})An event that is fired after files are deleted.
export interface FileDeleteEvent {
readonly files: ReadonlyArray<Uri>;
}readonly files: ReadonlyArray<Uri>;The files that got deleted.
An event that is fired after files are renamed.
export interface FileRenameEvent {
readonly files: ReadonlyArray<{
oldUri: Uri;
newUri: Uri;
}>;
}An event that is fired when files are going to be renamed.
To make modifications to the workspace before the files are renamed, call the `waitUntil-function with a thenable that resolves to a workspace edit.
export interface FileWillRenameEvent {
readonly files: ReadonlyArray<{
oldUri: Uri;
newUri: Uri;
}>;
waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;
}readonly files: ReadonlyArray<{
oldUri: Uri;
newUri: Uri;
}>;The files that are going to be renamed.
waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;Allows to pause the event and to apply a workspace edit.
Note: This function can only be called during event dispatch and not in an asynchronous manner:
workspace.onWillCreateFiles(event => {
// async, will *throw* an error
setTimeout(() => event.waitUntil(promise));
// sync, OK
event.waitUntil(promise);
})Interface exported by coc.nvim.
export interface DocumentSymbolProviderMetadata {
label?: string;
}label?: string;A human-readable string that is shown when multiple outlines trees show for one document.
Enum exported by coc.nvim.
export enum ServiceStat {
Initial,
Starting,
StartFailed,
Running,
Stopping,
Stopped
}InitialStartingStartFailedRunningStoppingStoppedInterface exported by coc.nvim.
export interface IServiceProvider {
id: string;
name: string;
client?: LanguageClient;
selector: DocumentSelector;
state: ServiceStat;
start(): Promise<void>;
dispose(): void;
stop(): Promise<void> | void;
restart(): Promise<void> | void;
onServiceReady: Event<void>;
}id: string;Unique service id.
name: string;Name of the service.
client?: LanguageClient;Language client of the service.
selector: DocumentSelector;Document selector of the service.
state: ServiceStat;Current state of the service.
start(): Promise<void>;Start the service.
dispose(): void;Dispose the service.
stop(): Promise<void> | void;Stop the service.
restart(): Promise<void> | void;Restart the service.
onServiceReady: Event<void>;Fired when the service is ready.
Source options to create source that could respect configuration from coc.source.{name}
export interface SourceConfig {
name: string;
triggerOnly?: boolean;
isSnippet?: boolean;
sourceType?: SourceType;
filepath?: string;
documentSelector?: DocumentSelector;
firstMatch?: boolean;
refresh?(): Promise<void>;
toggle?(): void;
onEnter?(bufnr: number): void;
shouldComplete?(opt: CompleteOption): ProviderResult<boolean>;
doComplete(opt: CompleteOption, token: CancellationToken): ProviderResult<CompleteResult>;
onCompleteResolve?(item: VimCompleteItem, opt: CompleteOption, token: CancellationToken): ProviderResult<void>;
onCompleteDone?(item: VimCompleteItem, opt: CompleteOption, snippetsSupport?: boolean): ProviderResult<void>;
shouldCommit?(item: VimCompleteItem, character: string): boolean;
}name: string;Unique name of the source.
triggerOnly?: boolean;Only complete when triggered.
isSnippet?: boolean;Items of the source are snippets.
sourceType?: SourceType;Type of the source.
filepath?: string;Filepath of the source script.
documentSelector?: DocumentSelector;Document selector of the source.
firstMatch?: boolean;Only the first match should be used.
refresh?(): Promise<void>;Refresh the source.
toggle?(): void;Toggle the source.
onEnter?(bufnr: number): void;Called on buffer enter.
shouldComplete?(opt: CompleteOption): ProviderResult<boolean>;Check whether the source should complete.
doComplete(opt: CompleteOption, token: CancellationToken): ProviderResult<CompleteResult>;Invoke completion of the source.
onCompleteResolve?(item: VimCompleteItem, opt: CompleteOption, token: CancellationToken): ProviderResult<void>;Called when a completion item is resolved.
onCompleteDone?(item: VimCompleteItem, opt: CompleteOption, snippetsSupport?: boolean): ProviderResult<void>;Called when a completion item is confirmed.
shouldCommit?(item: VimCompleteItem, character: string): boolean;Check whether completion should commit with the character.
Interface exported by coc.nvim.
export interface SourceStat {
name: string;
priority: number;
triggerCharacters: string[];
type: 'native' | 'remote' | 'service';
shortcut: string;
filepath: string;
disabled: boolean;
filetypes: string[];
}name: string;Name of the source.
priority: number;Priority of the source.
triggerCharacters: string[];Trigger characters of the source.
type: 'native' | 'remote' | 'service';Type of the source.
shortcut: string;Shortcut of the source.
filepath: string;Filepath of the source.
disabled: boolean;Whether the source is disabled.
filetypes: string[];Filetypes the source works on.
Enum exported by coc.nvim.
export enum SourceType {
Native,
Remote,
Service
}NativeRemoteServiceInterface exported by coc.nvim.
export interface CompleteResult {
items: ReadonlyArray<VimCompleteItem>;
isIncomplete?: boolean;
startcol?: number;
}items: ReadonlyArray<VimCompleteItem>;List of completion items.
isIncomplete?: boolean;The completion list is incomplete when true.
startcol?: number;Start column of the completion, 0 based.
Interface exported by coc.nvim.
export interface CompleteOption {
readonly bufnr: number;
readonly line: string;
readonly col: number;
readonly input: string;
readonly filetype: string;
readonly filepath: string;
readonly word: string;
readonly triggerCharacter?: string;
readonly colnr: number;
readonly linenr: number;
readonly position: Position;
readonly synname: string;
readonly changedtick: number;
readonly triggerForInComplete?: boolean;
}readonly bufnr: number;Current buffer number.
readonly line: string;Current line.
readonly col: number;Column to start completion, determined by iskeyword options of buffer.
readonly input: string;Input text.
readonly filetype: string;Filetype of the current buffer.
readonly filepath: string;Filepath of the current buffer.
readonly word: string;Word under cursor.
readonly triggerCharacter?: string;Trigger character, could be undefined.
readonly colnr: number;Col of cursor, 1 based.
readonly linenr: number;Line number of the cursor, 1 based.
readonly position: Position;Position of cursor when trigger completion
readonly synname: string;Syntax name at the cursor position.
readonly changedtick: number;Buffer changetick
readonly triggerForInComplete?: boolean;Is trigger for in complete completion.
Interface exported by coc.nvim.
export interface ISource {
name: string;
filetypes?: string[];
documentSelector?: DocumentSelector;
enable?: boolean;
shortcut?: string;
priority?: number;
sourceType?: SourceType;
triggerOnly?: boolean;
triggerCharacters?: string[];
triggerPatterns?: RegExp[];
disableSyntaxes?: string[];
filepath?: string;
firstMatch?: boolean;
refresh?(): Promise<void>;
toggle?(): void;
onEnter?(bufnr: number): void;
shouldComplete?(opt: CompleteOption): ProviderResult<boolean>;
doComplete(opt: CompleteOption, token: CancellationToken): ProviderResult<CompleteResult>;
onCompleteResolve?(item: VimCompleteItem, token: CancellationToken): ProviderResult<void>;
onCompleteDone?(item: VimCompleteItem, opt: CompleteOption): ProviderResult<void>;
shouldCommit?(item: VimCompleteItem, character: string): boolean;
}name: string;Identifier name
filetypes?: string[];documentSelector?: DocumentSelector;Filters of document.
enable?: boolean;Whether the source is enabled, default to true.
shortcut?: string;Shortcut shown in the completion menu.
priority?: number;Priority of the source.
sourceType?: SourceType;Type of the source.
triggerOnly?: boolean;Should only be used when completion is triggered, requires triggerPatterns or triggerCharacters defined.
triggerCharacters?: string[];Trigger completion when the user types one of the characters.
triggerPatterns?: RegExp[];Regex to detect trigger completion, ignored when triggerCharacters exists.
disableSyntaxes?: string[];Syntaxes that disable the source.
filepath?: string;Filepath of the source.
firstMatch?: boolean;Whether the first character should always match.
refresh?(): Promise<void>;Refresh the source.
toggle?(): void;For disable/enable
onEnter?(bufnr: number): void;Triggered on BufEnter, used for cache normally
shouldComplete?(opt: CompleteOption): ProviderResult<boolean>;Check if this source should doComplete
doComplete(opt: CompleteOption, token: CancellationToken): ProviderResult<CompleteResult>;Invoke completion
onCompleteResolve?(item: VimCompleteItem, token: CancellationToken): ProviderResult<void>;Action for complete item on complete item selected
onCompleteDone?(item: VimCompleteItem, opt: CompleteOption): ProviderResult<void>;Action for complete item on complete done
shouldCommit?(item: VimCompleteItem, character: string): boolean;Check whether completion should commit with the character.
Interface exported by coc.nvim.
export interface TreeItemLabel {
label: string;
highlights?: [
number,
number
][];
}label: string;Text of the label.
highlights?: [
number,
number
][];Ranges of highlights, 0 based.
Interface exported by coc.nvim.
export interface TreeItemIcon {
text: string;
hlGroup: string;
}text: string;Text of the icon.
hlGroup: string;Highlight group of the icon.
Collapsible state of the tree item
export enum TreeItemCollapsibleState {
None = 0,
Collapsed = 1,
Expanded = 2
}None = 0Determines an item can be neither collapsed nor expanded. Implies it has no children.
Collapsed = 1Determines an item is collapsed
Expanded = 2Determines an item is expanded
Class exported by coc.nvim.
export class TreeItem {
label: string | TreeItemLabel;
description?: string;
icon?: TreeItemIcon;
id?: string;
resourceUri?: Uri;
tooltip?: string | MarkupContent;
command?: Command;
deprecated?: boolean;
collapsibleState?: TreeItemCollapsibleState;
constructor(label: string | TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);
constructor(resourceUri: Uri, collapsibleState?: TreeItemCollapsibleState);
}label: string | TreeItemLabel;A human-readable string describing this item. When falsy, it is derived from resourceUri.
description?: string;Description rendered less prominently after label.
icon?: TreeItemIcon;The icon path or theme icon for the tree item.
When falsy, the folder theme icon is assigned if the item is collapsible, otherwise the file theme icon.
When a file or folder theme icon is specified, the icon is derived from the current file icon theme using resourceUri (if provided).
id?: string;Optional id for the tree item that has to be unique across tree. The id is used to preserve the selection and expansion state of the tree item.
If not provided, an id is generated using the tree item's resourceUri when exists. Note that when labels change, ids will change and that selection and expansion state cannot be kept stable anymore.
resourceUri?: Uri;The of the resource representing this item.
Will be used to derive the label, when it is not provided. Will be used to derive the icon from the current file icon theme, when icon has a theme icon value.
tooltip?: string | MarkupContent;The tooltip text when you hover over this item.
command?: Command;The that should be executed when the tree item is selected.
Please use vscode.open or vscode.diff as command IDs when the tree item is opening
something in the editor. Using these commands ensures that the resulting editor will
appear consistent with how other built-in trees open editors.
deprecated?: boolean;Whether the tree item is deprecated.
collapsibleState?: TreeItemCollapsibleState;of the tree item.
constructor(label: string | TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);constructor(resourceUri: Uri, collapsibleState?: TreeItemCollapsibleState);Action resolved by
export interface TreeItemAction<T> {
title: string;
handler: (item: T) => ProviderResult<void>;
}title: string;Label text in menu.
handler: (item: T) => ProviderResult<void>;Handler of the action.
Options for creating a
export interface TreeViewOptions<T> {
bufhidden?: 'hide' | 'unload' | 'delete' | 'wipe';
winfixwidth?: boolean;
enableFilter?: boolean;
disableLeafIndent?: boolean;
treeDataProvider: TreeDataProvider<T>;
canSelectMany?: boolean;
}bufhidden?: 'hide' | 'unload' | 'delete' | 'wipe';bufhidden option for TreeView, default to 'wipe'
winfixwidth?: boolean;Fixed width for window, default to true
enableFilter?: boolean;Enable filter feature, default to false
disableLeafIndent?: boolean;Disable indent of leaves without children, default to false
treeDataProvider: TreeDataProvider<T>;A data provider that provides tree data.
canSelectMany?: boolean;Whether the tree supports multi-select. When the tree supports multi-select and a command is executed from the tree, the first argument to the command is the tree item that the command was executed on and the second argument is an array containing all selected tree items.
The event that is fired when an element in the is expanded or collapsed
export interface TreeViewExpansionEvent<T> {
readonly element: T;
}readonly element: T;Element that is expanded or collapsed.
The event that is fired when there is a change in tree view's selection
export interface TreeViewSelectionChangeEvent<T> {
readonly selection: T[];
}readonly selection: T[];Selected elements.
The event that is fired when there is a change in tree view's visibility
export interface TreeViewVisibilityChangeEvent {
readonly visible: boolean;
}readonly visible: boolean;true if the tree view is visible otherwise false.
Represents a Tree view
export interface TreeView<T> extends Disposable {
readonly onDidExpandElement: Event<TreeViewExpansionEvent<T>>;
readonly onDidCollapseElement: Event<TreeViewExpansionEvent<T>>;
readonly selection: T[];
readonly onDidChangeSelection: Event<TreeViewSelectionChangeEvent<T>>;
readonly onDidChangeVisibility: Event<TreeViewVisibilityChangeEvent>;
readonly visible: boolean;
readonly windowId: number | undefined;
message?: string;
title?: string;
description?: string;
reveal(element: T, options?: {
select?: boolean;
focus?: boolean;
expand?: boolean | number;
}): Thenable<void>;
show(splitCommand?: string): Promise<boolean>;
}readonly onDidExpandElement: Event<TreeViewExpansionEvent<T>>;Event that is fired when an element is expanded
readonly onDidCollapseElement: Event<TreeViewExpansionEvent<T>>;Event that is fired when an element is collapsed
readonly selection: T[];Currently selected elements.
readonly onDidChangeSelection: Event<TreeViewSelectionChangeEvent<T>>;Event that is fired when the selection has changed
readonly onDidChangeVisibility: Event<TreeViewVisibilityChangeEvent>;Event that is fired when visibility has changed
readonly visible: boolean;true if the tree view is visible otherwise false.
NOTE: is true when TreeView visible on other tab.
readonly windowId: number | undefined;Window id used by TreeView.
message?: string;An optional human-readable message that will be rendered in the view. Setting the message to null, undefined, or empty string will remove the message from the view.
title?: string;The tree view title is initially taken from viewId of TreeView Changes to the title property will be properly reflected in the UI in the title of the view.
description?: string;An optional human-readable description which is rendered less prominently in the title of the view. Setting the title description to null, undefined, or empty string will remove the description from the view.
reveal(element: T, options?: {
select?: boolean;
focus?: boolean;
expand?: boolean | number;
}): Thenable<void>;Reveals the given element in the tree view. If the tree view is not visible then the tree view is shown and element is revealed.
By default revealed element is selected.
In order to not to select, set the option select to false.
In order to focus, set the option focus to true.
In order to expand the revealed element, set the option expand to true. To expand recursively set expand to the number of levels to expand.
NOTE: You can expand only to 3 levels maximum.
NOTE: The that the TreeView is registered with with must implement getParent method to access this API.
show(splitCommand?: string): Promise<boolean>;Create tree view in new window.
NOTE: TreeView with same viewId in current tab would be disposed.
A data provider that provides tree data
export interface TreeDataProvider<T> {
onDidChangeTreeData?: Event<T | undefined | null | void>;
getTreeItem(element: T): TreeItem | Thenable<TreeItem>;
getChildren(element?: T): ProviderResult<T[]>;
getParent?(element: T): ProviderResult<T>;
resolveTreeItem?(item: TreeItem, element: T, token: CancellationToken): ProviderResult<TreeItem>;
resolveActions?(item: TreeItem, element: T): ProviderResult<TreeItemAction<T>[]>;
}onDidChangeTreeData?: Event<T | undefined | null | void>;An optional event to signal that an element or root has changed.
This will trigger the view to update the changed element/root and its children recursively (if shown).
To signal that root has changed, do not pass any argument or pass undefined or null.
getChildren(element?: T): ProviderResult<T[]>;Get the children of element or root if no element is passed.
getParent?(element: T): ProviderResult<T>;Optional method to return the parent of element.
Return null or undefined if element is a child of root.
NOTE: This method should be implemented in order to access reveal API.
resolveTreeItem?(item: TreeItem, element: T, token: CancellationToken): ProviderResult<TreeItem>;Called on hover to resolve the TreeItem property if it is undefined.
Called on tree item click/open to resolve the TreeItem property if it is undefined.
Only properties that were undefined can be resolved in resolveTreeItem.
Functionality may be expanded later to include being called to resolve other missing
properties on selection and/or on open.
Will only ever be called once per TreeItem.
onDidChangeTreeData should not be triggered from within resolveTreeItem.
Note that this function is called when tree items are already showing in the UI. Because of that, no property that changes the presentation (label, description, etc.) can be changed.
resolveActions?(item: TreeItem, element: T): ProviderResult<TreeItemAction<T>[]>;Called with current element to resolve actions. Called when user press 'actions' key.
An event describing the change in Configuration
export interface ConfigurationChangeEvent {
affectsConfiguration(section: string, scope?: ConfigurationScope): boolean;
}affectsConfiguration(section: string, scope?: ConfigurationScope): boolean;Returns true if the given section for the given resource (if provided) is affected.
Interface exported by coc.nvim.
export interface WillSaveEvent extends TextDocumentWillSaveEvent {
waitUntil(thenable: Thenable<TextEdit[] | any>): void;
}waitUntil(thenable: Thenable<TextEdit[] | any>): void;Allows to pause the event loop and to apply pre-save-edits. Edits of subsequent calls to this function will be applied in order. The edits will be ignored if concurrent modifications of the document happened.
Note: This function can only be called during event dispatch and not in an asynchronous manner:
workspace.onWillSaveTextDocument(event => {
// async, will *throw* an error
setTimeout(() => event.waitUntil(promise));
// sync, OK
event.waitUntil(promise);
})Interface exported by coc.nvim.
export interface KeymapOption {
cmd?: boolean;
sync?: boolean;
cancel?: boolean;
silent?: boolean;
repeat?: boolean;
special?: boolean;
}cmd?: boolean;Use <Cmd> as rhs command prefix, ignored on insert mode (<expr> is used on insert mode), see :h map-cmd.
sync?: boolean;When invoke the callback, send request to NodeJS instead of notification, default true.
cancel?: boolean;Cancel completion before invoke callback, default true, insert mode only.
silent?: boolean;Use <silent> for keymap, default true.
repeat?: boolean;Enable repeat support for repeat.vim, default false.
special?: boolean;Use <special> map argument, see :h :map-special, vim9 only.
Interface exported by coc.nvim.
export interface DidChangeTextDocumentParams {
readonly textDocument: {
version: number;
uri: string;
};
readonly document: LinesTextDocument;
readonly contentChanges: ReadonlyArray<TextDocumentContentChange>;
readonly bufnr: number;
readonly original: string;
readonly originalLines: ReadonlyArray<string>;
}readonly textDocument: {
version: number;
uri: string;
};The document that did change. The version number points to the version after all provided content changes have been applied.
readonly document: LinesTextDocument;The affected document.
readonly contentChanges: ReadonlyArray<TextDocumentContentChange>;The actual content changes. The content changes describe single state changes to the document. So if there are two content changes c1 (at array index 0) and c2 (at array index 1) for a document in state S then c1 moves the document from S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed on the state S'.
readonly bufnr: number;Buffer number of document.
readonly original: string;Original content before change
readonly originalLines: ReadonlyArray<string>;Original lines before change
Interface exported by coc.nvim.
export interface EditerState {
document: LinesTextDocument;
position: Position;
}document: LinesTextDocument;Document of the editor.
position: Position;Cursor position of the editor.
Type alias exported by coc.nvim.
export type MapMode = 'n' | 'i' | 'v' | 'x' | 's' | 'o' | '!' | 't' | 'c' | 'l';Interface exported by coc.nvim.
export interface Autocmd {
event: string | string[];
callback: (...args: any[]) => void | Promise<void>;
pattern?: string | string[];
arglist?: string[];
buffer?: number;
once?: boolean;
nested?: boolean;
request?: boolean;
thisArg?: any;
}event: string | string[];Vim event or event set.
callback: (...args: any[]) => void | Promise<void>;Callback functions that called with evaled arglist as arguments.
pattern?: string | string[];Match pattern, default to *.
arglist?: string[];Vim expression that eval to arguments of callback, default to []
buffer?: number;buffer number for buffer-local autocommand.
once?: boolean;the command is executed once when true, see :h autocmd-once
nested?: boolean;allow nested autocmd when true, see :h autocmd-nested
request?: boolean;Use request when true, use notification by default.
thisArg?: any;this of callback.
Interface exported by coc.nvim.
export interface Env {
readonly runtimepath: string;
readonly virtualText: boolean;
readonly guicursor: string;
readonly floating: boolean;
readonly sign: boolean;
readonly extensionRoot: string;
readonly pid: number;
readonly columns: number;
readonly lines: number;
readonly pumevent: boolean;
readonly cmdheight: number;
readonly filetypeMap: {
[index: string]: string;
};
readonly isVim: boolean;
readonly isCygwin: boolean;
readonly isMacvim: boolean;
readonly isiTerm: boolean;
readonly version: string;
readonly progpath: string;
readonly dialog: boolean;
readonly terminal: boolean;
readonly textprop: boolean;
}readonly runtimepath: string;|runtimepath| option of (neo)vim.
readonly virtualText: boolean;|virtualText| support in (neo)vim
readonly guicursor: string;|guicursor| option of (neo)vim
readonly floating: boolean;Could use float window on neovim, always false on vim.
readonly sign: boolean;|sign_place()| and |sign_unplace()| can be used when true.
readonly extensionRoot: string;Root directory of extensions.
readonly pid: number;Process id of (neo)vim.
readonly columns: number;Total columns of screen.
readonly lines: number;Total lines of screen.
readonly pumevent: boolean;Is true when |CompleteChanged| event is supported.
readonly cmdheight: number;|cmdheight| option of (neo)vim.
readonly filetypeMap: {
[index: string]: string;
};Value of |g:coc_filetype_map|
readonly isVim: boolean;Is true when not using neovim.
readonly isCygwin: boolean;Is cygvim when true.
readonly isMacvim: boolean;Is macvim when true.
readonly isiTerm: boolean;Is true when iTerm.app is used on mac.
readonly version: string;version of (neo)vim, on vim it's like: 8020750, on neoivm it's like
readonly progpath: string;|v:progpath| value, could be empty.
readonly dialog: boolean;Is true when dialog feature is supported
readonly terminal: boolean;Is true when terminal feature is supported
readonly textprop: boolean;Is true when vim's textprop is supported.
Store & retrieve most recent used items.
export class Mru {
constructor(name: string, base?: string, maximum?: number);
load(): Promise<string[]>;
loadSync(): string[];
add(item: string): Promise<void>;
remove(item: string): Promise<void>;
clean(): Promise<void>;
}constructor(name: string, base?: string, maximum?: number);load(): Promise<string[]>;Load iems from mru file
loadSync(): string[];Load lines from mru file synchronously.
add(item: string): Promise<void>;Add item to mru file.
remove(item: string): Promise<void>;Remove item from mru file.
clean(): Promise<void>;Remove the data file.
Option to create task that runs in (neo)vim.
export interface TaskOptions {
cmd: string;
args?: string[];
cwd?: string;
env?: {
[key: string]: string;
};
pty?: boolean;
detach?: boolean;
}cmd: string;The command to run, without arguments
args?: string[];Arguments of command.
cwd?: string;Current working directory of the task, Default to current vim's cwd.
env?: {
[key: string]: string;
};Additional environment key-value pairs.
pty?: boolean;Use pty when true.
detach?: boolean;Detach child process when true.
Controls long running task started by (neo)vim. Useful to keep the task running after CocRestart.
export interface Task extends Disposable {
onExit: Event<number>;
onStdout: Event<string[]>;
onStderr: Event<string[]>;
start(opts: TaskOptions): Promise<boolean>;
stop(): Promise<void>;
running: Promise<boolean>;
}onExit: Event<number>;Fired on task exit with exit code.
onStdout: Event<string[]>;Fired with lines on stdout received.
onStderr: Event<string[]>;Fired with lines on stderr received.
start(opts: TaskOptions): Promise<boolean>;Start task, task will be restarted when already running.
stop(): Promise<void>;Stop task by SIGTERM or SIGKILL
running: Promise<boolean>;Check if the task is running.
A simple json database.
export interface JsonDB {
filepath: string;
fetch(key: string): any;
exists(key: string): boolean;
delete(key: string): void;
push(key: string, data: number | null | boolean | string | {
[index: string]: any;
}): void;
clear(): void;
destroy(): void;
}filepath: string;Filepath of the database file.
fetch(key: string): any;Get data by key.
exists(key: string): boolean;Check if key exists
delete(key: string): void;Delete data by key
push(key: string, data: number | null | boolean | string | {
[index: string]: any;
}): void;Save data with key
clear(): void;Empty db file.
destroy(): void;Remove db file.
Interface exported by coc.nvim.
export interface RenameEvent {
oldUri: Uri;
newUri: Uri;
}Interface exported by coc.nvim.
export interface FileSystemWatcher {
readonly ignoreCreateEvents: boolean;
readonly ignoreChangeEvents: boolean;
readonly ignoreDeleteEvents: boolean;
readonly onDidCreate: Event<Uri>;
readonly onDidChange: Event<Uri>;
readonly onDidDelete: Event<Uri>;
readonly onDidRename: Event<RenameEvent>;
dispose(): void;
}readonly ignoreCreateEvents: boolean;Ignore create events when true.
readonly ignoreChangeEvents: boolean;Ignore change events when true.
readonly ignoreDeleteEvents: boolean;Ignore delete events when true.
readonly onDidRename: Event<RenameEvent>;Fired when a file is renamed.
dispose(): void;Dispose the watcher.
Type alias exported by coc.nvim.
export type ConfigurationScope = string | null | Uri | TextDocument | WorkspaceFolder | {
uri?: string;
languageId?: string;
};Interface exported by coc.nvim.
export interface ConfigurationInspect<T> {
key: string;
defaultValue?: T;
globalValue?: T;
workspaceValue?: T;
workspaceFolderValue?: T;
}key: string;Key of the configuration.
defaultValue?: T;Default value of the configuration.
globalValue?: T;Global value of the configuration.
workspaceValue?: T;Workspace value of the configuration.
workspaceFolderValue?: T;Workspace folder value of the configuration.
Enum exported by coc.nvim.
export enum ConfigurationTarget {
Global = 1,
Workspace = 2,
WorkspaceFolder = 3
}Global = 1Workspace = 2Not exists with coc.nvim yet.
WorkspaceFolder = 3Interface exported by coc.nvim.
export interface WorkspaceConfiguration {
get<T>(section: string): T | undefined;
get<T>(section: string, defaultValue: T): T;
has(section: string): boolean;
inspect<T>(section: string): ConfigurationInspect<T> | undefined;
update(section: string, value: any, updateTarget?: ConfigurationTarget | boolean): Thenable<void>;
readonly [key: string]: any;
}get<T>(section: string): T | undefined;Return a value from this configuration.
get<T>(section: string, defaultValue: T): T;Return a value from this configuration.
has(section: string): boolean;Check if this configuration has a certain value.
inspect<T>(section: string): ConfigurationInspect<T> | undefined;Retrieve all information about a configuration setting. A configuration value often consists of a default value, a global or installation-wide value, a workspace-specific value
Note: The configuration name must denote a leaf in the configuration tree
(editor.fontSize vs editor) otherwise no result is returned.
update(section: string, value: any, updateTarget?: ConfigurationTarget | boolean): Thenable<void>;Update a configuration value. The updated configuration values are persisted to configuration file.
readonly [key: string]: any;Readable dictionary that backs this configuration.
Interface exported by coc.nvim.
export interface BufferSyncItem {
dispose: () => void;
onChange?(e: DidChangeTextDocumentParams): void;
onTextChange?(): void;
onVisible?(winid: number, region: Readonly<[
number,
number
]>): void;
}dispose: () => void;Called on buffer unload.
onChange?(e: DidChangeTextDocumentParams): void;Called on buffer content change.
onTextChange?(): void;Called when NodeJS client receive lines change event, could be before or
after TextChangedI and TextChangedP events, but always before
TextDocumentContentChange event.
onVisible?(winid: number, region: Readonly<[
number,
number
]>): void;Called on WindowVisible event when exists.
region contains, 1 based, end inclusive topline, botline
Interface exported by coc.nvim.
export interface BufferSync<T extends BufferSyncItem> {
readonly items: Iterable<T>;
getItem(uri: string): T | undefined;
getItem(bufnr: number): T | undefined;
dispose: () => void;
}readonly items: Iterable<T>;Current items.
getItem(uri: string): T | undefined;Get created item by uri
getItem(bufnr: number): T | undefined;Get created item by bufnr
dispose: () => void;Dispose all items.
Interface exported by coc.nvim.
export interface FuzzyMatchResult {
score: number;
positions: Uint32Array;
}score: number;Score of the match, higher is better.
positions: Uint32Array;Matched character positions.
Interface exported by coc.nvim.
export interface FuzzyMatchHighlights {
score: number;
highlights: AnsiHighlight[];
}score: number;Score of the match, higher is better.
highlights: AnsiHighlight[];Highlights of the match.
An array representing a fuzzy match.
<match_pos_N><match_pos_1><match_pos_0> etcexport type FuzzyScore = [
score: number,
wordStart: number,
...matches: number[]
];Interface exported by coc.nvim.
export interface FuzzyScoreOptions {
readonly boostFullMatch: boolean;
readonly firstMatchCanBeWeak: boolean;
}readonly boostFullMatch: boolean;Boost the score of full matches.
readonly firstMatchCanBeWeak: boolean;Allows first match to be a weak match
Match kinds could be:
export type FuzzyKind = 'normal' | 'aggressive' | 'any';Type alias exported by coc.nvim.
export type ScoreFunction = (word: string, wordPos?: number) => FuzzyScore | undefined;Interface exported by coc.nvim.
export interface FuzzyMatch {
matchScoreSpans(text: string, score: FuzzyScore): Iterable<[
number,
number
]>;
createScoreFunction(pattern: string, patternPos: number, options?: FuzzyScoreOptions, kind?: FuzzyKind): ScoreFunction;
setPattern(pattern: string, matchSeq?: boolean): void;
match(text: string): FuzzyMatchResult | undefined;
matchSpans(text: string, positions: ArrayLike<number>, max?: number): Iterable<[
number,
number
]>;
matchHighlights(text: string, hlGroup: string): FuzzyMatchHighlights | undefined;
}matchScoreSpans(text: string, score: FuzzyScore): Iterable<[
number,
number
]>;Create 0 index byte spans from matched text and FuzzyScore. Mostly used for create highlight items.
createScoreFunction(pattern: string, patternPos: number, options?: FuzzyScoreOptions, kind?: FuzzyKind): ScoreFunction;Create a score function
setPattern(pattern: string, matchSeq?: boolean): void;Initialize match by set the match pattern and matchSeq.
match(text: string): FuzzyMatchResult | undefined;Get the match result of text including score and character index positions, return undefined when no match found.
matchSpans(text: string, positions: ArrayLike<number>, max?: number): Iterable<[
number,
number
]>;Match character positions to column spans. Better than matchHighlights method by reduce iteration.
matchHighlights(text: string, hlGroup: string): FuzzyMatchHighlights | undefined;Get the match highlights result, including score and highlight items. Return undefined when no match found.
Interface exported by coc.nvim.
export interface TextDocumentMatch {
readonly uri: string;
readonly languageId: string;
}readonly uri: string;Uri of the document.
readonly languageId: string;Language id of the document.
Type of pattern used by workspace folder.
export enum PatternType {
Buffer,
LanguageServer,
Global
}LanguageServerGlobalRepresents how a terminal exited.
export interface TerminalExitStatus {
readonly code: number | undefined;
}readonly code: number | undefined;The exit code that a terminal exited with, it can have the following values:
undefined: the user forcibly closed the terminal or a custom execution exited
without providing an exit code.Interface exported by coc.nvim.
export interface TerminalOptions {
name?: string;
shellPath?: string;
shellArgs?: string[];
cwd?: string;
env?: {
[key: string]: string | null;
};
strictEnv?: boolean;
}name?: string;A human-readable string which will be used to represent the terminal in the UI.
shellPath?: string;A path to a custom shell executable to be used in the terminal.
shellArgs?: string[];Args for the custom shell executable, this does not work on Windows (see #8429)
cwd?: string;A path or URI for the current working directory to be used for the terminal.
env?: {
[key: string]: string | null;
};Object with environment variables that will be added to the VS Code process.
strictEnv?: boolean;Whether the terminal process environment should be exactly as provided in
TerminalOptions.env. When this is false (default), the environment will be based on the
window's environment and also apply configured platform settings like
terminal.integrated.windows.env on top. When this is true, the complete environment
must be provided as nothing will be inherited from the process or any configuration.
Neovim only.
An individual terminal instance within the integrated terminal.
export interface Terminal {
readonly bufnr: number;
readonly name: string;
readonly processId: Promise<number>;
readonly exitStatus: TerminalExitStatus | undefined;
sendText(text: string, addNewLine?: boolean): void;
show(preserveFocus?: boolean): Promise<boolean>;
hide(): void;
dispose(): void;
}readonly bufnr: number;The bufnr of terminal buffer.
readonly name: string;The name of the terminal.
readonly processId: Promise<number>;The process ID of the shell process.
readonly exitStatus: TerminalExitStatus | undefined;The exit status of the terminal, this will be undefined while the terminal is active.
Example: Show a notification with the exit code when the terminal exists with a non-zero exit code.
window.onDidCloseTerminal(t => {
if (t.exitStatus && t.exitStatus.code) {
vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
}
});sendText(text: string, addNewLine?: boolean): void;Send text to the terminal. The text is written to the stdin of the underlying pty process (shell) of the terminal.
show(preserveFocus?: boolean): Promise<boolean>;Show the terminal panel and reveal this terminal in the UI, return false when failed.
hide(): void;Hide the terminal panel if this terminal is currently showing.
dispose(): void;Dispose and free associated resources.
Option for create status item.
export interface StatusItemOption {
progress?: boolean;
}progress?: boolean;Show the item as a progress indicator.
Status item that included in g:coc_status
export interface StatusBarItem {
readonly priority: number;
isProgress: boolean;
text: string;
show(): void;
hide(): void;
dispose(): void;
}readonly priority: number;The priority of this item. Higher value means the item should be shown more to the left.
isProgress: boolean;Whether the item is a progress indicator.
text: string;The text to show for the entry. You can embed icons in the text by leveraging the syntax:
My text $(icon-name) contains icons like $(icon-name) this one.
Where the icon-name is taken from the octicon icon set, e.g.
light-bulb, thumbsup, zap etc.
show(): void;Shows the entry in the status bar.
hide(): void;Hide the entry in the status bar.
dispose(): void;Dispose and free associated resources. Call hide.
Value-object describing where and how progress should show.
export interface ProgressOptions {
title?: string;
cancellable?: boolean;
}title?: string;A human-readable string which will be used to describe the operation.
cancellable?: boolean;Controls if a cancel button should show to allow the user to cancel the long running operation.
Defines a generalized way of reporting progress updates.
export interface Progress<T> {
report(value: T): void;
}report(value: T): void;Report a progress update.
Represents an action that is shown with an information, warning, or error message.
export interface MessageItem {
title: string;
isCloseAffordance?: boolean;
}title: string;A short title like 'Retry', 'Open Log' etc.
isCloseAffordance?: boolean;A hint for modal dialogs that the item should be triggered when the user cancels the dialog (e.g. by pressing the ESC key).
Note: this option is ignored for non-modal messages. Note: not used by coc.nvim for now.
Interface exported by coc.nvim.
export interface DialogButton {
index: number;
text: string;
disabled?: boolean;
}index: number;Use by callback, should >= 0
text: string;Text of the button.
disabled?: boolean;Not shown when true
Interface exported by coc.nvim.
export interface DialogConfig {
content: string;
title?: string;
close?: boolean;
highlight?: string;
highlights?: ReadonlyArray<HighlightItem>;
borderhighlight?: string;
buttons?: DialogButton[];
callback?: (index: number) => void;
}content: string;Content shown in window.
title?: string;Optional title text.
close?: boolean;show close button, default to true when not specified.
highlight?: string;highlight group for dialog window, default to "dialog.floatHighlight" or 'CocFlating'
highlights?: ReadonlyArray<HighlightItem>;highlight items of content.
borderhighlight?: string;highlight groups for border, default to "dialog.borderhighlight" or 'CocFlating'
buttons?: DialogButton[];Buttons as bottom of dialog.
callback?: (index: number) => void;index is -1 for window close without button click
Type alias exported by coc.nvim.
export type NotificationKind = 'error' | 'info' | 'warning' | 'progress';Interface exported by coc.nvim.
export interface NotificationConfig {
kind?: NotificationKind;
content?: string;
title?: string;
buttons?: DialogButton[];
callback?: (index: number) => void;
}kind?: NotificationKind;Kind of the notification.
content?: string;Content of the notification.
title?: string;Optional title text.
buttons?: DialogButton[];Buttons as bottom of dialog.
callback?: (index: number) => void;index is -1 for window close without button click
Options to configure the behavior of the quick pick UI.
export interface QuickPickOptions {
title?: string;
placeHolder?: string;
matchOnDescription?: boolean;
canPickMany?: boolean;
placeholder?: string;
}title?: string;An optional string that represents the title of the quick pick.
placeHolder?: string;Placeholder text that shown when input value is empty.
matchOnDescription?: boolean;An optional flag to include the description when filtering the picks.
canPickMany?: boolean;An optional flag to make the picker accept multiple selections, if true the result is an array of picks.
placeholder?: string;Represents an item that can be selected from a list of items.
export interface QuickPickItem {
label: string;
description?: string;
picked?: boolean;
}label: string;A human-readable string which is rendered prominent
description?: string;A human-readable string which is rendered less prominent in the same line
picked?: boolean;Optional flag indicating if this item is picked initially.
Interface exported by coc.nvim.
export interface QuickPickConfig<T extends QuickPickItem> {
title?: string;
placeholder?: string;
items: readonly T[];
value?: string;
canSelectMany?: boolean;
matchOnDescription: boolean;
}title?: string;An optional title.
placeholder?: string;Placeholder text that shown when input value is empty.
items: readonly T[];Items to pick from.
value?: string;Initial value of the filter text.
canSelectMany?: boolean;If multiple items can be selected at the same time. Defaults to false.
matchOnDescription: boolean;If the filter text should also be matched against the description of the items. Defaults to false.
Interface exported by coc.nvim.
export interface QuickPick<T extends QuickPickItem> {
value: string;
title: string | undefined;
placeholder: string | undefined;
loading: boolean;
items: readonly T[];
activeItems: readonly T[];
matchOnDescription: boolean;
canSelectMany: boolean;
maxHeight: number;
width: number | undefined;
readonly inputBox: InputBox | undefined;
readonly currIndex: number;
readonly buffer: number;
readonly winid: number | undefined;
readonly onDidFinish: Event<T[] | null>;
readonly onDidChangeValue: Event<string>;
readonly onDidChangeSelection: Event<readonly T[]>;
show(): Promise<void>;
}value: string;Set or get current input value.
title: string | undefined;An optional title.
placeholder: string | undefined;An optional placeholder text.
loading: boolean;If the UI should show a progress indicator. Defaults to false.
Change this to true, e.g., while loading more data or validating user input.
items: readonly T[];Items to pick from. This can be read and updated by the extension.
activeItems: readonly T[];Active items. This can be read and updated by the extension.
matchOnDescription: boolean;If the filter text should also be matched against the description of the items. Defaults to false.
canSelectMany: boolean;If multiple items can be selected at the same time. Defaults to false.
maxHeight: number;Max height of list, ``
width: number | undefined;Width of window, limited by dialog.maxWidth configuration and vim's 'columns'.
Undefined by default, which means the width is dynamically calculated.
readonly inputBox: InputBox | undefined;Represents the input prompt box field of the quickpick element
readonly currIndex: number;The current selection index, can be used to act on an item with onDidFinish, even if the item is not selected. The index corresponds to the .items or .activeItems arrays, and can be used to index into them
readonly buffer: number;The buffer for the popup element of the quick pick containing the .items to be selected
readonly winid: number | undefined;The window for the popup element of the quick pick containing the .items to be selected
readonly onDidFinish: Event<T[] | null>;An event signaling when QuickPick closed, fired with selected items or null when canceled.
readonly onDidChangeValue: Event<string>;An event signaling when the value of the filter text has changed.
readonly onDidChangeSelection: Event<readonly T[]>;An event signaling when the selected items have changed.
show(): Promise<void>;Makes the input UI visible in its current configuration.
Interface exported by coc.nvim.
export interface ScreenPosition {
row: number;
col: number;
}row: number;Screen row, 1 based.
col: number;Screen column, 1 based.
Type alias exported by coc.nvim.
export type MsgTypes = 'error' | 'warning' | 'more';Interface exported by coc.nvim.
export interface OpenTerminalOption {
cwd?: string;
autoclose?: boolean;
keepfocus?: boolean;
position?: 'bottom' | 'right';
}cwd?: string;Cwd of terminal, default to result of |getcwd()|
autoclose?: boolean;Close terminal on job finish, default to true.
keepfocus?: boolean;Keep focus current window, default to false.
position?: 'bottom' | 'right';Position of terminal window, default to 'right'.
An output channel is a container for readonly textual information.
To get an instance of an OutputChannel use
createOutputChannel.
export interface OutputChannel {
readonly name: string;
readonly content: string;
append(value: string): void;
appendLine(value: string): void;
clear(keep?: number): void;
show(preserveFocus?: boolean): void;
hide(): void;
dispose(): void;
}readonly name: string;The human-readable name of this output channel.
readonly content: string;Current content of the channel.
append(value: string): void;Append the given value to the channel.
appendLine(value: string): void;Append the given value and a line feed character to the channel.
clear(keep?: number): void;Removes output from the channel. Latest keep lines will be remained.
show(preserveFocus?: boolean): void;Reveal this channel in the UI.
hide(): void;Hide this channel from the UI.
dispose(): void;Dispose and free associated resources.
Interface exported by coc.nvim.
export interface TerminalResult {
bufnr: number;
success: boolean;
content?: string;
}bufnr: number;Buffer number of the terminal.
success: boolean;Whether the command finished successfully.
content?: string;Output content of the terminal.
Interface exported by coc.nvim.
export interface Dialog {
bufnr: number;
winid: Promise<number | null>;
dispose: () => void;
}bufnr: number;Buffer number of dialog.
winid: Promise<number | null>;Window id of dialog.
dispose: () => void;Dispose the dialog.
Type alias exported by coc.nvim.
export type HighlightItemDef = [
string,
number,
number,
number,
number?,
number?,
number?
];Interface exported by coc.nvim.
export interface HighlightDiff {
remove: number[];
removeMarkers: number[];
add: HighlightItemDef[];
}remove: number[];Namespaces to remove.
removeMarkers: number[];Marker namespaces to remove.
add: HighlightItemDef[];Highlights to add.
Interface exported by coc.nvim.
export interface MenuItem {
text: string;
disabled?: boolean | {
reason: string;
};
}text: string;Text of the menu item.
disabled?: boolean | {
reason: string;
};Disable the item when true or with a reason.
Interface exported by coc.nvim.
export interface MenuOption {
title?: string;
content?: string;
shortcuts?: boolean;
position?: 'center' | 'cursor';
}title?: string;Title in menu window.
content?: string;Content in menu window as normal text.
shortcuts?: boolean;Create and highlight shortcut characters.
position?: 'center' | 'cursor';Position of menu, default to 'cursor'
Interface exported by coc.nvim.
export interface InputOptions {
placeholder?: string;
position?: 'cursor' | 'center';
marginTop?: number;
borderhighlight?: string;
list?: boolean;
}placeholder?: string;Placeholder text that shown when input value is empty.
position?: 'cursor' | 'center';Position to show input, default to 'cursor'
marginTop?: number;Margin top editor when position is 'center'
borderhighlight?: string;Border highlight of float window/popup, configuration dialog.borderhighlight used as default.
list?: boolean;Create key-mappings for quickpick list.
Interface exported by coc.nvim.
export interface InputPreference extends InputOptions {
border?: [
0 | 1,
0 | 1,
0 | 1,
0 | 1
];
rounded?: boolean;
minWidth?: number;
maxWidth?: number;
}border?: [
0 | 1,
0 | 1,
0 | 1,
0 | 1
];Top, right, bottom, left border existence, default to [1,1,1,1]
rounded?: boolean;Rounded border, default to true, configuration dialog.rounded used as default.
minWidth?: number;Minimal window width, g:coc_prompt_win_width or 32 used as default.
maxWidth?: number;Maximum window width, configuration dialog.maxWidth used as default.
Interface exported by coc.nvim.
export interface InputDimension {
readonly width: number;
readonly height: number;
readonly row: number;
readonly col: number;
}readonly width: number;Width of the input window.
readonly height: number;Height of the input window.
readonly row: number;0 based screen row
readonly col: number;O based screen col
Interface exported by coc.nvim.
export interface InputBox {
value: string;
title: string;
loading: boolean;
borderhighlight: string;
readonly dimension: InputDimension;
readonly bufnr: number;
readonly onDidChange: Event<string>;
readonly onDidFinish: Event<string | null>;
}value: string;Current input text, could be changed.
title: string;Change or get title of input box.
loading: boolean;Change or get loading state of input box.
borderhighlight: string;Change or get borderhighlight of input box.
readonly dimension: InputDimension;Dimension of float window/popup
readonly bufnr: number;Buffer number of float window/popup
readonly onDidChange: Event<string>;An event signaling when the value has changed.
readonly onDidFinish: Event<string | null>;An event signaling input finished, emit input value or null when canceled.
FloatWinConfig.
export interface FloatWinConfig {
border?: boolean | [
number,
number,
number,
number
];
rounded?: boolean;
highlight?: string;
title?: string;
borderhighlight?: string;
close?: boolean;
maxHeight?: number;
maxWidth?: number;
winblend?: number;
focusable?: boolean;
shadow?: boolean;
preferTop?: boolean;
autoHide?: boolean;
offsetX?: number;
cursorline?: boolean;
modes?: string[];
excludeImages?: boolean;
position?: "fixed" | "auto";
top?: number;
bottom?: number;
left?: number;
right?: number;
}border?: boolean | [
number,
number,
number,
number
];Show border of the window.
rounded?: boolean;Use rounded border.
highlight?: string;Highlight group of the window.
title?: string;Title of the window.
borderhighlight?: string;Highlight group of the border.
close?: boolean;Show close button.
maxHeight?: number;Max height of the window.
maxWidth?: number;Max width of the window.
winblend?: number;Blend of the window, works on neovim.
focusable?: boolean;Whether the window is focusable.
shadow?: boolean;Show shadow, works on neovim.
preferTop?: boolean;Prefer show the window above the cursor.
autoHide?: boolean;Hide the window when cursor moved.
offsetX?: number;Offset x of the window from the cursor.
cursorline?: boolean;Show cursorline in the window.
modes?: string[];Modes the window is shown in.
excludeImages?: boolean;Exclude image links in markdown content.
position?: "fixed" | "auto";Position of the window.
top?: number;Top position of the window.
bottom?: number;Bottom position of the window.
left?: number;Left position of the window.
right?: number;Right position of the window.
Class exported by coc.nvim.
export class FloatFactory {
constructor(nvim: Neovim);
show: (docs: Documentation[], options?: FloatWinConfig) => Promise<void>;
close: () => void;
activated: () => Promise<boolean>;
dispose: () => void;
}constructor(nvim: Neovim);show: (docs: Documentation[], options?: FloatWinConfig) => Promise<void>;Show documentations in float window/popup. Window and buffer are reused when possible.
close: () => void;Close the float window created by this float factory.
activated: () => Promise<boolean>;Check if float window is shown.
dispose: () => void;Unbind events
Extension-scoped logger with trace, debug, info, warning, error, fatal, and mark methods.
export interface Logger {
readonly category: string;
log(...args: any[]): void;
trace(message: any, ...args: any[]): void;
debug(message: any, ...args: any[]): void;
info(message: any, ...args: any[]): void;
warn(message: any, ...args: any[]): void;
error(message: any, ...args: any[]): void;
fatal(message: any, ...args: any[]): void;
mark(message: any, ...args: any[]): void;
}readonly category: string;Category of the logger.
log(...args: any[]): void;Log a message.
trace(message: any, ...args: any[]): void;Log a trace message.
debug(message: any, ...args: any[]): void;Log a debug message.
info(message: any, ...args: any[]): void;Log an info message.
warn(message: any, ...args: any[]): void;Log a warning message.
error(message: any, ...args: any[]): void;Log an error message.
fatal(message: any, ...args: any[]): void;Log a fatal message.
mark(message: any, ...args: any[]): void;Log a mark message.
import { ExtensionContext } from 'coc.nvim'
export function activate(context: ExtensionContext): void {
const { logger } = context
logger.info('Extension activated')
try {
// Extension work
} catch (error) {
logger.error('Extension failed:', error)
}
}A memento represents a storage utility. It can store and retrieve values.
export interface Memento {
get<T>(key: string): T | undefined;
get<T>(key: string, defaultValue: T): T;
update(key: string, value: any): Promise<void>;
}get<T>(key: string): T | undefined;Return a value.
get<T>(key: string, defaultValue: T): T;Return a value.
update(key: string, value: any): Promise<void>;Store a value. The value must be JSON-stringifyable.
Type alias exported by coc.nvim.
export type ExtensionState = 'disabled' | 'loaded' | 'activated' | 'unknown';Enum exported by coc.nvim.
export enum ExtensionType {
Global,
Local,
SingleFile,
Internal
}GlobalLocalSingleFileInternalInterface exported by coc.nvim.
export interface ExtensionJson {
name: string;
main?: string;
engines: {
[key: string]: string;
};
version?: string;
[key: string]: any;
}name: string;Name of the extension.
main?: string;Entry file of the extension.
engines: {
[key: string]: string;
};Engines required by the extension.
version?: string;Version of the extension.
[key: string]: any;Interface exported by coc.nvim.
export interface ExtensionInfo {
id: string;
version: string;
description: string;
root: string;
exotic: boolean;
uri?: string;
state: ExtensionState;
isLocal: boolean;
packageJSON: Readonly<ExtensionJson>;
}id: string;Full identifier of the extension.
version: string;Version of the extension.
description: string;Description of the extension.
root: string;Root directory of the extension.
exotic: boolean;Whether the extension is exotic.
uri?: string;Uri of the extension.
state: ExtensionState;State of the extension.
isLocal: boolean;Whether the extension is local.
packageJSON: Readonly<ExtensionJson>;Parsed package.json of the extension.
Represents an extension.
To get an instance of an Extension use getExtension.
export interface Extension<T> {
readonly id: string;
readonly extensionPath: string;
readonly extensionUri: Uri;
readonly isActive: boolean;
readonly packageJSON: any;
readonly exports: T;
activate(): Promise<T>;
}readonly id: string;The canonical extension identifier in the form of: publisher.name.
readonly extensionPath: string;The absolute file path of the directory containing this extension.
readonly extensionUri: Uri;The uri of the directory containing the extension.
readonly isActive: boolean;true if the extension has been activated.
readonly packageJSON: any;The parsed contents of the extension's package.json.
readonly exports: T;The public API exported by this extension (return value of activate).
It is an invalid action to access this field before this extension has been activated.
activate(): Promise<T>;Activates this extension and returns its public API.
Utilities and lifecycle state provided to an extension activation function, including subscriptions, storage paths, state, and logging.
export interface ExtensionContext {
subscriptions: Disposable[];
extensionPath: string;
asAbsolutePath(relativePath: string): string;
storagePath: string;
workspaceState: Memento;
globalState: Memento;
logger: Logger;
}subscriptions: Disposable[];An array to which disposables can be added. When this extension is deactivated the disposables will be disposed.
extensionPath: string;The absolute file path of the directory containing the extension.
asAbsolutePath(relativePath: string): string;Get the absolute path of a resource contained in the extension.
storagePath: string;The absolute directory path for extension to download persist data. The directory might not exist.
workspaceState: Memento;A memento object that stores state in the context of the currently opened workspace.
globalState: Memento;A memento object that stores state independent of the current opened workspace.
logger: Logger;Logger of the extension.
import { commands, ExtensionContext } from 'coc.nvim'
export function activate(context: ExtensionContext): void {
const disposable = commands.registerCommand('demo.showPath', () => {
context.logger.info('Extension path:', context.extensionPath)
})
context.subscriptions.push(disposable)
const runs = context.globalState.get<number>('runs', 0)
void context.globalState.update('runs', runs + 1)
}Interface exported by coc.nvim.
export interface PropertyScheme {
type: string;
default: any;
description: string;
enum?: string[];
items?: any;
[key: string]: any;
}type: string;Type of the property.
default: any;Default value of the property.
description: string;Description of the property.
enum?: string[];Enum values of the property.
items?: any;Items of the property when it is an array.
[key: string]: any;Interface exported by coc.nvim.
export interface LocationWithTarget extends Location {
targetRange?: Range;
}targetRange?: Range;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.
Interface exported by coc.nvim.
export interface LocationWithLine {
uri: string;
line: string;
text?: string;
}uri: string;Uri of the location.
line: string;Match text of line.
text?: string;Highlight text in line.
Interface exported by coc.nvim.
export interface AnsiHighlight {
span: [
number,
number
];
hlGroup: string;
}span: [
number,
number
];Byte indexes, 0 based.
hlGroup: string;Highlight group of the span.
Interface exported by coc.nvim.
export interface ListItem {
label: string;
preselect?: boolean;
filterText?: string;
sortText?: string;
location?: LocationWithTarget | LocationWithLine | string;
data?: any;
ansiHighlights?: AnsiHighlight[];
resolved?: boolean;
converted?: boolean;
}label: string;Label of the item.
preselect?: boolean;Select the item by default.
filterText?: string;Text used for filtering.
sortText?: string;A string that should be used when comparing this item with other items, only used for fuzzy filter.
location?: LocationWithTarget | LocationWithLine | string;Location of the item.
data?: any;Custom data of the item.
ansiHighlights?: AnsiHighlight[];Ansi highlights of the label.
resolved?: boolean;Whether the item is resolved.
converted?: boolean;Whether the location of the item has been converted.
Type alias exported by coc.nvim.
export type ListMode = 'normal' | 'insert';Type alias exported by coc.nvim.
export type ListMatcher = 'strict' | 'fuzzy' | 'regex';Interface exported by coc.nvim.
export interface ListOptions {
position: string;
reverse: boolean;
input: string;
ignorecase: boolean;
interactive: boolean;
sort: boolean;
mode: ListMode;
matcher: ListMatcher;
autoPreview: boolean;
numberSelect: boolean;
noQuit: boolean;
first: boolean;
}position: string;Position of the list window.
reverse: boolean;Reverse the list when true.
input: string;Initial input of the list.
ignorecase: boolean;Ignore case when filtering.
interactive: boolean;Interactive mode of the list.
sort: boolean;Sort the items when true.
mode: ListMode;Mode of the list.
matcher: ListMatcher;Matcher of the list.
autoPreview: boolean;Auto preview of the list.
numberSelect: boolean;Number select of the list.
noQuit: boolean;Do not quit after action.
first: boolean;Select the first item by default.
Interface exported by coc.nvim.
export interface ListContext {
input: string;
cwd: string;
options: ListOptions;
args: string[];
window: Window;
buffer: Buffer;
listWindow: Window | null;
}input: string;Input on list activated.
cwd: string;Current work directory on activated.
options: ListOptions;Options of list.
args: string[];Arguments passed to list.
window: Window;Original window on list invoke.
buffer: Buffer;Original buffer on list invoke.
listWindow: Window | null;Window of the list, null when not created.
Interface exported by coc.nvim.
export interface ListAction {
name: string;
persist?: boolean;
reload?: boolean;
parallel?: boolean;
multiple?: boolean;
tabPersist?: boolean;
execute: (item: ListItem | ListItem[], context: ListContext) => ProviderResult<void>;
}name: string;Action name
persist?: boolean;Should persist list window on invoke.
reload?: boolean;Should reload list after invoke.
parallel?: boolean;Invoke all selected items in parallel.
multiple?: boolean;Support handle multiple items at once.
tabPersist?: boolean;Tab positioned list should be persisted (no window switch) on action invoke.
execute: (item: ListItem | ListItem[], context: ListContext) => ProviderResult<void>;Item is array of selected items when multiple is true.
Interface exported by coc.nvim.
export interface MultipleListAction extends Omit<ListAction, 'execute'> {
multiple: true;
execute: (item: ListItem[], context: ListContext) => ProviderResult<void>;
}multiple: true;The action handles multiple items.
execute: (item: ListItem[], context: ListContext) => ProviderResult<void>;Handler invoked with all selected items.
Interface exported by coc.nvim.
export interface ListTask {
on(event: 'data', callback: (item: ListItem) => void): void;
on(event: 'end', callback: () => void): void;
on(event: 'error', callback: (msg: string | Error) => void): void;
dispose(): void;
}on(event: 'data', callback: (item: ListItem) => void): void;Listen to data events.
on(event: 'end', callback: () => void): void;Listen to end events.
on(event: 'error', callback: (msg: string | Error) => void): void;Listen to error events.
dispose(): void;Dispose the task.
Interface exported by coc.nvim.
export interface ListArgument {
key?: string;
hasValue?: boolean;
name: string;
description: string;
}key?: string;Key of the argument.
hasValue?: boolean;Whether the argument has a value.
name: string;Name of the argument.
description: string;Description of the argument.
Interface exported by coc.nvim.
export interface IList {
name: string;
defaultAction: string;
actions: ListAction[];
loadItems(context: ListContext, token: CancellationToken): Promise<ListItem[] | ListTask | null | undefined>;
interactive?: boolean;
description?: string;
detail?: string;
options?: ListArgument[];
resolveItem?(item: ListItem): Promise<ListItem | null>;
doHighlight?(): void;
dispose?(): void;
}name: string;Unique name of list.
defaultAction: string;Default action name.
actions: ListAction[];Action list.
loadItems(context: ListContext, token: CancellationToken): Promise<ListItem[] | ListTask | null | undefined>;Load list items.
interactive?: boolean;Should be true when interactive is supported.
description?: string;Description of list.
detail?: string;Detail description, shown in help.
options?: ListArgument[];Options supported by list.
doHighlight?(): void;Highlight buffer by vim's syntax commands.
dispose?(): void;Called on list unregistered.
Interface exported by coc.nvim.
export interface PreviewOptions {
bufname?: string;
lines: string[];
filetype?: string;
lnum?: number;
range?: Range;
sketch?: boolean;
}bufname?: string;Buffer name of the preview window.
lines: string[];Lines to preview.
filetype?: string;Filetype of the preview window.
lnum?: number;Line number to place the cursor on.
range?: Range;Range to highlight in the preview window.
sketch?: boolean;Interface exported by coc.nvim.
export interface SnippetSession {
isActive: boolean;
}isActive: boolean;Whether the snippet session is active.
Interface exported by coc.nvim.
export interface SnippetEdit {
range: Range;
snippet: string | SnippetString | StringValue;
}range: Range;Range to replace.
snippet: string | SnippetString | StringValue;Snippet text of the edit.
Interface exported by coc.nvim.
export interface UltiSnipsActions {
preExpand?: string;
postExpand?: string;
postJump?: string;
}preExpand?: string;Code executed before expansion.
postExpand?: string;Code executed after expansion.
postJump?: string;Code executed after jump.
Interface exported by coc.nvim.
export interface UltiSnippetOption {
regex?: string;
context?: string;
noExpand?: boolean;
trimTrailingWhitespace?: boolean;
removeWhiteSpace?: boolean;
actions: UltiSnipsActions;
}regex?: string;Regex text for regex snippet.
context?: string;Context code to execute.
noExpand?: boolean;Do not expand tabs.
trimTrailingWhitespace?: boolean;Trim all whitespaces from right side of snippet lines.
removeWhiteSpace?: boolean;Remove whitespace immediately before the cursor at the end of a line before jumping to the next tabstop
actions: UltiSnipsActions;UltiSnips action codes of the snippet.
A snippet string is a template which allows to insert text and to control the editor cursor when insertion happens.
A snippet can define tab stops and placeholders with $1, $2
and ${3:foo}. $0 defines the final tab stop, it defaults to
the end of the snippet. Variables are defined with $name and
${name:default value}. The full snippet syntax is documented
here.
export class SnippetString {
value: string;
constructor(value?: string);
appendText(string: string): SnippetString;
appendTabstop(number?: number): SnippetString;
appendPlaceholder(value: string | ((snippet: SnippetString) => any), number?: number): SnippetString;
appendChoice(values: string[], number?: number): SnippetString;
appendVariable(name: string, defaultValue?: string | ((snippet: SnippetString) => any)): SnippetString;
}value: string;The snippet string.
constructor(value?: string);appendText(string: string): SnippetString;Builder-function that appends the given string to
the value of this snippet string.
appendTabstop(number?: number): SnippetString;Builder-function that appends a tabstop ($1, $2 etc) to
the value of this snippet string.
appendPlaceholder(value: string | ((snippet: SnippetString) => any), number?: number): SnippetString;Builder-function that appends a placeholder (${1:value}) to
the value of this snippet string.
appendChoice(values: string[], number?: number): SnippetString;Builder-function that appends a choice (${1|a,b,c|}) to
the value of this snippet string.
appendVariable(name: string, defaultValue?: string | ((snippet: SnippetString) => any)): SnippetString;Builder-function that appends a variable (${VAR}) to
the value of this snippet string.
Interface exported by coc.nvim.
export interface DiagnosticItem {
file: string;
lnum: number;
col: number;
source: string;
code: string | number;
message: string;
severity: string;
level: number;
location: Location;
}file: string;Filepath of the diagnostic.
lnum: number;Line number, 1 based.
col: number;Column number, 1 based.
source: string;Source of the diagnostic.
code: string | number;Code of the diagnostic.
message: string;Message of the diagnostic.
severity: string;Severity of the diagnostic.
level: number;Level of the diagnostic, 1 for error, 2 for warning, 3 for info, 4 for hint.
location: Location;Location of the diagnostic.
A diagnostics collection is a container that manages a set of diagnostics. Diagnostics are always scopes to a diagnostics collection and a resource.
To get an instance of a DiagnosticCollection use
createDiagnosticCollection.
export interface DiagnosticCollection {
readonly name: string;
set(uri: string, diagnostics: Diagnostic[] | null): void;
set(entries: [
string,
Diagnostic[] | null
][] | string, diagnostics?: Diagnostic[]): void;
delete(uri: string): void;
clear(): void;
forEach(callback: (uri: string, diagnostics: Diagnostic[], collection: DiagnosticCollection) => any, thisArg?: any): void;
get(uri: string): Diagnostic[] | undefined;
has(uri: string): boolean;
dispose(): void;
}readonly name: string;The name of this diagnostic collection, for instance typescript. Every diagnostic
from this collection will be associated with this name. Also, the task framework uses this
name when defining problem matchers.
set(uri: string, diagnostics: Diagnostic[] | null): void;Assign diagnostics for given resource. Will replace existing diagnostics for that resource.
set(entries: [
string,
Diagnostic[] | null
][] | string, diagnostics?: Diagnostic[]): void;Replace all entries in this collection.
Diagnostics of multiple tuples of the same uri will be merged, e.g
[[file1, [d1]], [file1, [d2]]] is equivalent to [[file1, [d1, d2]]].
If a diagnostics item is undefined as in [file1, undefined]
all previous but not subsequent diagnostics are removed.
delete(uri: string): void;Remove all diagnostics from this collection that belong
to the provided uri. The same as #set(uri, undefined).
clear(): void;Remove all diagnostics from this collection. The same
as calling #set(undefined)
forEach(callback: (uri: string, diagnostics: Diagnostic[], collection: DiagnosticCollection) => any, thisArg?: any): void;Iterate over each entry in this collection.
get(uri: string): Diagnostic[] | undefined;Get the diagnostics for a given resource. Note that you cannot modify the diagnostics-array returned from this call.
has(uri: string): boolean;Check if this collection contains diagnostics for a given resource.
dispose(): void;Dispose and free associated resources. Calls clear.
Interface exported by coc.nvim.
export interface DiagnosticEventParams {
bufnr: number;
uri: string;
diagnostics: ReadonlyArray<Diagnostic>;
}bufnr: number;Buffer number of the diagnostics.
uri: string;Uri of the document.
diagnostics: ReadonlyArray<Diagnostic>;Diagnostics of the document.
Type alias exported by coc.nvim.
export type ProgressToken = number | string;Interface exported by coc.nvim.
export interface WorkDoneProgressBegin {
kind: 'begin';
title: string;
cancellable?: boolean;
message?: string;
percentage?: number;
}kind: 'begin';Progress kind, always begin.
title: string;Mandatory title of the progress operation. Used to briefly inform about the kind of operation being performed.
Examples: "Indexing" or "Linking dependencies".
cancellable?: boolean;Controls if a cancel button should show to allow the user to cancel the long running operation. Clients that don't support cancellation are allowed to ignore the setting.
message?: string;Optional, more detailed associated progress message. Contains
complementary information to the title.
Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". If unset, the previous progress message (if any) is still valid.
percentage?: number;Optional progress percentage to display (value 100 is considered 100%).
If not provided infinite progress is assumed and clients are allowed
to ignore the percentage value in subsequent in report notifications.
The value should be steadily rising. Clients are free to ignore values that are not following this rule.
Interface exported by coc.nvim.
export interface WorkDoneProgressReport {
kind: 'report';
cancellable?: boolean;
message?: string;
percentage?: number;
}kind: 'report';Progress kind, always report.
cancellable?: boolean;Controls enablement state of a cancel button. This property is only valid if a cancel
button got requested in the WorkDoneProgressStart payload.
Clients that don't support cancellation or don't support control the button's enablement state are allowed to ignore the setting.
message?: string;Optional, more detailed associated progress message. Contains
complementary information to the title.
Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". If unset, the previous progress message (if any) is still valid.
percentage?: number;Optional progress percentage to display (value 100 is considered 100%).
If not provided infinite progress is assumed and clients are allowed
to ignore the percentage value in subsequent in report notifications.
The value should be steadily rising. Clients are free to ignore values that are not following this rule.
Interface exported by coc.nvim.
export interface WorkDoneProgressEnd {
kind: 'end';
message?: string;
}kind: 'end';Progress kind, always end.
message?: string;Optional, a final message indicating to for example indicate the outcome of the operation.
Type alias exported by coc.nvim.
export type FileChangeType = 1 | 2 | 3;An event describing a file change.
export interface FileEvent {
uri: string;
type: FileChangeType;
}uri: string;The file's uri.
type: FileChangeType;The change type.
An action to be performed when the connection is producing errors.
export enum ErrorAction {
Continue = 1,
Shutdown = 2
}Continue = 1Continue running the server.
Shutdown = 2Shutdown the server.
An action to be performed when the connection to a server got closed.
export enum CloseAction {
DoNotRestart = 1,
Restart = 2
}DoNotRestart = 1Don't restart the server. The connection stays closed.
Restart = 2Restart the server.
Interface exported by coc.nvim.
export interface CloseHandlerResult {
action: CloseAction;
message?: string;
handled?: boolean;
}action: CloseAction;The action to take.
message?: string;An optional message to be presented to the user.
handled?: boolean;If set to true the client assumes that the corresponding close handler has presented an appropriate message to the user and the message will only be log to the client's output channel.
Interface exported by coc.nvim.
export interface ErrorHandlerResult {
action: ErrorAction;
message?: string;
handled?: boolean;
}action: ErrorAction;The action to take.
message?: string;An optional message to be presented to the user.
handled?: boolean;If set to true the client assumes that the corresponding error handler has presented an appropriate message to the user and the message will only be log to the client's output channel.
A pluggable error handler that is invoked when the connection is either producing errors or got closed.
export interface ErrorHandler {
error(error: Error, message: {
jsonrpc: string;
}, count: number): ErrorAction | ErrorHandlerResult | Promise<ErrorHandlerResult>;
closed(): CloseAction | CloseHandlerResult | Promise<CloseHandlerResult>;
}error(error: Error, message: {
jsonrpc: string;
}, count: number): ErrorAction | ErrorHandlerResult | Promise<ErrorHandlerResult>;An error has occurred while writing or reading from the connection.
closed(): CloseAction | CloseHandlerResult | Promise<CloseHandlerResult>;The connection to the server got closed. Use CloseHandlerResult should be preferred.
Interface exported by coc.nvim.
export interface InitializationFailedHandler {
(error: Error | any): boolean;
}(error: Error | any): boolean;Interface exported by coc.nvim.
export interface SynchronizeOptions {
configurationSection?: string | string[];
fileEvents?: FileSystemWatcher | FileSystemWatcher[];
}configurationSection?: string | string[];fileEvents?: FileSystemWatcher | FileSystemWatcher[];File system watchers for synchronization.
Enum exported by coc.nvim.
export enum RevealOutputChannelOn {
Debug = 0,
Info = 1,
Warn = 2,
Error = 3,
Never = 4
}Debug = 0Info = 1Warn = 2Error = 3Never = 4Interface exported by coc.nvim.
export interface ConfigurationItem {
scopeUri?: string;
section?: string;
}scopeUri?: string;The scope to get the configuration section for.
section?: string;The configuration section asked for.
Type alias exported by coc.nvim.
export type HandlerResult<R, E> = R | ResponseError<E> | Thenable<R> | Thenable<ResponseError<E>> | Thenable<R | ResponseError<E>>;Interface exported by coc.nvim.
export interface RequestHandler<P, R, E> {
(params: P, token: CancellationToken): HandlerResult<R, E>;
}(params: P, token: CancellationToken): HandlerResult<R, E>;Interface exported by coc.nvim.
export interface RequestHandler0<R, E> {
(token: CancellationToken): HandlerResult<R, E>;
}(token: CancellationToken): HandlerResult<R, E>;The parameters of a configuration request.
export interface ConfigurationParams {
items: ConfigurationItem[];
}items: ConfigurationItem[];Configuration items requested.
Interface exported by coc.nvim.
export interface ConfigurationWorkspaceMiddleware {
configuration?: (params: ConfigurationParams, token: CancellationToken, next: RequestHandler<ConfigurationParams, any[], void>) => HandlerResult<any[], void>;
}configuration?: (params: ConfigurationParams, token: CancellationToken, next: RequestHandler<ConfigurationParams, any[], void>) => HandlerResult<any[], void>;Middleware for the workspace configuration request.
Interface exported by coc.nvim.
export interface WorkspaceFolderWorkspaceMiddleware {
workspaceFolders?: (token: CancellationToken, next: RequestHandler0<WorkspaceFolder[] | null, void>) => HandlerResult<WorkspaceFolder[] | null, void>;
didChangeWorkspaceFolders?: NextSignature<WorkspaceFoldersChangeEvent, Promise<void>>;
}workspaceFolders?: (token: CancellationToken, next: RequestHandler0<WorkspaceFolder[] | null, void>) => HandlerResult<WorkspaceFolder[] | null, void>;Middleware for the workspace folders request.
didChangeWorkspaceFolders?: NextSignature<WorkspaceFoldersChangeEvent, Promise<void>>;Middleware for workspace folder change events.
Interface exported by coc.nvim.
export interface ProvideTypeDefinitionSignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;Interface exported by coc.nvim.
export interface TypeDefinitionMiddleware {
provideTypeDefinition?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideTypeDefinitionSignature) => ProviderResult<Definition | DefinitionLink[]>;
}provideTypeDefinition?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideTypeDefinitionSignature) => ProviderResult<Definition | DefinitionLink[]>;Middleware for providing type definitions.
Interface exported by coc.nvim.
export interface ProvideImplementationSignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;Interface exported by coc.nvim.
export interface ImplementationMiddleware {
provideImplementation?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideImplementationSignature) => ProviderResult<Definition | DefinitionLink[]>;
}provideImplementation?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideImplementationSignature) => ProviderResult<Definition | DefinitionLink[]>;Middleware for providing implementations.
Type alias exported by coc.nvim.
export type ProvideDocumentColorsSignature = (document: LinesTextDocument, token: CancellationToken) => ProviderResult<ColorInformation[]>;Type alias exported by coc.nvim.
export type ProvideColorPresentationSignature = (color: Color, context: {
document: LinesTextDocument;
range: Range;
}, token: CancellationToken) => ProviderResult<ColorPresentation[]>;Interface exported by coc.nvim.
export interface ColorProviderMiddleware {
provideDocumentColors?: (this: void, document: LinesTextDocument, token: CancellationToken, next: ProvideDocumentColorsSignature) => ProviderResult<ColorInformation[]>;
provideColorPresentations?: (this: void, color: Color, context: {
document: LinesTextDocument;
range: Range;
}, token: CancellationToken, next: ProvideColorPresentationSignature) => ProviderResult<ColorPresentation[]>;
}provideDocumentColors?: (this: void, document: LinesTextDocument, token: CancellationToken, next: ProvideDocumentColorsSignature) => ProviderResult<ColorInformation[]>;Middleware for providing document colors.
provideColorPresentations?: (this: void, color: Color, context: {
document: LinesTextDocument;
range: Range;
}, token: CancellationToken, next: ProvideColorPresentationSignature) => ProviderResult<ColorPresentation[]>;Middleware for providing color presentations.
Interface exported by coc.nvim.
export interface ProvideDeclarationSignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Declaration | DeclarationLink[]>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Declaration | DeclarationLink[]>;Interface exported by coc.nvim.
export interface DeclarationMiddleware {
provideDeclaration?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideDeclarationSignature) => ProviderResult<Declaration | DeclarationLink[]>;
}provideDeclaration?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideDeclarationSignature) => ProviderResult<Declaration | DeclarationLink[]>;Middleware for providing declarations.
Type alias exported by coc.nvim.
export type ProvideFoldingRangeSignature = (this: void, document: LinesTextDocument, context: FoldingContext, token: CancellationToken) => ProviderResult<FoldingRange[]>;Interface exported by coc.nvim.
export interface FoldingRangeProviderMiddleware {
provideFoldingRanges?: (this: void, document: LinesTextDocument, context: FoldingContext, token: CancellationToken, next: ProvideFoldingRangeSignature) => ProviderResult<FoldingRange[]>;
}provideFoldingRanges?: (this: void, document: LinesTextDocument, context: FoldingContext, token: CancellationToken, next: ProvideFoldingRangeSignature) => ProviderResult<FoldingRange[]>;Middleware for providing folding ranges.
Interface exported by coc.nvim.
export interface PrepareCallHierarchySignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<CallHierarchyItem | CallHierarchyItem[]>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<CallHierarchyItem | CallHierarchyItem[]>;Interface exported by coc.nvim.
export interface CallHierarchyIncomingCallsSignature {
(this: void, item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyIncomingCall[]>;
}(this: void, item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyIncomingCall[]>;Interface exported by coc.nvim.
export interface CallHierarchyOutgoingCallsSignature {
(this: void, item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyOutgoingCall[]>;
}(this: void, item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyOutgoingCall[]>;Interface exported by coc.nvim.
export interface CallHierarchyMiddleware {
prepareCallHierarchy?: (this: void, document: LinesTextDocument, positions: Position, token: CancellationToken, next: PrepareCallHierarchySignature) => ProviderResult<CallHierarchyItem | CallHierarchyItem[]>;
provideCallHierarchyIncomingCalls?: (this: void, item: CallHierarchyItem, token: CancellationToken, next: CallHierarchyIncomingCallsSignature) => ProviderResult<CallHierarchyIncomingCall[]>;
provideCallHierarchyOutgoingCalls?: (this: void, item: CallHierarchyItem, token: CancellationToken, next: CallHierarchyOutgoingCallsSignature) => ProviderResult<CallHierarchyOutgoingCall[]>;
}prepareCallHierarchy?: (this: void, document: LinesTextDocument, positions: Position, token: CancellationToken, next: PrepareCallHierarchySignature) => ProviderResult<CallHierarchyItem | CallHierarchyItem[]>;Middleware for preparing call hierarchies.
provideCallHierarchyIncomingCalls?: (this: void, item: CallHierarchyItem, token: CancellationToken, next: CallHierarchyIncomingCallsSignature) => ProviderResult<CallHierarchyIncomingCall[]>;Middleware for providing incoming calls.
provideCallHierarchyOutgoingCalls?: (this: void, item: CallHierarchyItem, token: CancellationToken, next: CallHierarchyOutgoingCallsSignature) => ProviderResult<CallHierarchyOutgoingCall[]>;Middleware for providing outgoing calls.
Interface exported by coc.nvim.
export interface DocumentSemanticsTokensSignature {
(this: void, document: LinesTextDocument, token: CancellationToken): ProviderResult<SemanticTokens>;
}(this: void, document: LinesTextDocument, token: CancellationToken): ProviderResult<SemanticTokens>;Interface exported by coc.nvim.
export interface DocumentSemanticsTokensEditsSignature {
(this: void, document: LinesTextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensDelta>;
}(this: void, document: LinesTextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensDelta>;Interface exported by coc.nvim.
export interface DocumentRangeSemanticTokensSignature {
(this: void, document: LinesTextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
}(this: void, document: LinesTextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;Interface exported by coc.nvim.
export interface SemanticTokensMiddleware {
provideDocumentSemanticTokens?: (this: void, document: LinesTextDocument, token: CancellationToken, next: DocumentSemanticsTokensSignature) => ProviderResult<SemanticTokens>;
provideDocumentSemanticTokensEdits?: (this: void, document: LinesTextDocument, previousResultId: string, token: CancellationToken, next: DocumentSemanticsTokensEditsSignature) => ProviderResult<SemanticTokens | SemanticTokensDelta>;
provideDocumentRangeSemanticTokens?: (this: void, document: LinesTextDocument, range: Range, token: CancellationToken, next: DocumentRangeSemanticTokensSignature) => ProviderResult<SemanticTokens>;
}provideDocumentSemanticTokens?: (this: void, document: LinesTextDocument, token: CancellationToken, next: DocumentSemanticsTokensSignature) => ProviderResult<SemanticTokens>;Middleware for providing document semantic tokens.
provideDocumentSemanticTokensEdits?: (this: void, document: LinesTextDocument, previousResultId: string, token: CancellationToken, next: DocumentSemanticsTokensEditsSignature) => ProviderResult<SemanticTokens | SemanticTokensDelta>;Middleware for providing semantic token edits.
provideDocumentRangeSemanticTokens?: (this: void, document: LinesTextDocument, range: Range, token: CancellationToken, next: DocumentRangeSemanticTokensSignature) => ProviderResult<SemanticTokens>;Middleware for providing range semantic tokens.
Interface exported by coc.nvim.
export interface FileOperationsMiddleware {
didCreateFiles?: NextSignature<FileCreateEvent, Promise<void>>;
willCreateFiles?: NextSignature<FileWillCreateEvent, Thenable<WorkspaceEdit | null | undefined>>;
didRenameFiles?: NextSignature<FileRenameEvent, Promise<void>>;
willRenameFiles?: NextSignature<FileWillRenameEvent, Thenable<WorkspaceEdit | null | undefined>>;
didDeleteFiles?: NextSignature<FileDeleteEvent, Promise<void>>;
willDeleteFiles?: NextSignature<FileWillDeleteEvent, Thenable<WorkspaceEdit | null | undefined>>;
}didCreateFiles?: NextSignature<FileCreateEvent, Promise<void>>;Middleware for file create events.
willCreateFiles?: NextSignature<FileWillCreateEvent, Thenable<WorkspaceEdit | null | undefined>>;Middleware for file will-create events.
didRenameFiles?: NextSignature<FileRenameEvent, Promise<void>>;Middleware for file rename events.
willRenameFiles?: NextSignature<FileWillRenameEvent, Thenable<WorkspaceEdit | null | undefined>>;Middleware for file will-rename events.
didDeleteFiles?: NextSignature<FileDeleteEvent, Promise<void>>;Middleware for file delete events.
willDeleteFiles?: NextSignature<FileWillDeleteEvent, Thenable<WorkspaceEdit | null | undefined>>;Middleware for file will-delete events.
Interface exported by coc.nvim.
export interface ProvideLinkedEditingRangeSignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;Interface exported by coc.nvim.
export interface LinkedEditingRangeMiddleware {
provideLinkedEditingRange?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideLinkedEditingRangeSignature) => ProviderResult<LinkedEditingRanges>;
}provideLinkedEditingRange?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideLinkedEditingRangeSignature) => ProviderResult<LinkedEditingRanges>;Middleware for providing linked editing ranges.
Interface exported by coc.nvim.
export interface ProvideSelectionRangeSignature {
(this: void, document: LinesTextDocument, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[]>;
}(this: void, document: LinesTextDocument, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[]>;Interface exported by coc.nvim.
export interface SelectionRangeProviderMiddleware {
provideSelectionRanges?: (this: void, document: LinesTextDocument, positions: Position[], token: CancellationToken, next: ProvideSelectionRangeSignature) => ProviderResult<SelectionRange[]>;
}provideSelectionRanges?: (this: void, document: LinesTextDocument, positions: Position[], token: CancellationToken, next: ProvideSelectionRangeSignature) => ProviderResult<SelectionRange[]>;Middleware for providing selection ranges.
Type alias exported by coc.nvim.
export type ProvideDiagnosticSignature = (this: void, document: TextDocument, previousResultId: string | undefined, token: CancellationToken) => ProviderResult<DocumentDiagnosticReport>;Type alias exported by coc.nvim.
export type ProvideWorkspaceDiagnosticSignature = (this: void, resultIds: PreviousResultId[], token: CancellationToken, resultReporter: ResultReporter) => ProviderResult<WorkspaceDiagnosticReport>;Interface exported by coc.nvim.
export interface DiagnosticProviderMiddleware {
provideDiagnostics?: (this: void, document: TextDocument, previousResultId: string | undefined, token: CancellationToken, next: ProvideDiagnosticSignature) => ProviderResult<DocumentDiagnosticReport>;
provideWorkspaceDiagnostics?: (this: void, resultIds: PreviousResultId[], token: CancellationToken, resultReporter: ResultReporter, next: ProvideWorkspaceDiagnosticSignature) => ProviderResult<WorkspaceDiagnosticReport>;
}provideDiagnostics?: (this: void, document: TextDocument, previousResultId: string | undefined, token: CancellationToken, next: ProvideDiagnosticSignature) => ProviderResult<DocumentDiagnosticReport>;Middleware for providing document diagnostics.
provideWorkspaceDiagnostics?: (this: void, resultIds: PreviousResultId[], token: CancellationToken, resultReporter: ResultReporter, next: ProvideWorkspaceDiagnosticSignature) => ProviderResult<WorkspaceDiagnosticReport>;Middleware for providing workspace diagnostics.
Interface exported by coc.nvim.
export interface HandleWorkDoneProgressSignature {
(this: void, token: ProgressToken, params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd): void;
}(this: void, token: ProgressToken, params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd): void;Interface exported by coc.nvim.
export interface HandleDiagnosticsSignature {
(this: void, uri: string, diagnostics: Diagnostic[]): void;
}(this: void, uri: string, diagnostics: Diagnostic[]): void;Interface exported by coc.nvim.
export interface ProvideCompletionItemsSignature {
(this: void, document: LinesTextDocument, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionItem[] | CompletionList | null>;
}(this: void, document: LinesTextDocument, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionItem[] | CompletionList | null>;Interface exported by coc.nvim.
export interface ResolveCompletionItemSignature {
(this: void, item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
}(this: void, item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;Interface exported by coc.nvim.
export interface ProvideHoverSignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Hover>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Hover>;Interface exported by coc.nvim.
export interface ProvideSignatureHelpSignature {
(this: void, document: LinesTextDocument, position: Position, context: SignatureHelpContext, token: CancellationToken): ProviderResult<SignatureHelp>;
}(this: void, document: LinesTextDocument, position: Position, context: SignatureHelpContext, token: CancellationToken): ProviderResult<SignatureHelp>;Interface exported by coc.nvim.
export interface ProvideDefinitionSignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;Interface exported by coc.nvim.
export interface ProvideReferencesSignature {
(this: void, document: LinesTextDocument, position: Position, options: {
includeDeclaration: boolean;
}, token: CancellationToken): ProviderResult<Location[]>;
}(this: void, document: LinesTextDocument, position: Position, options: {
includeDeclaration: boolean;
}, token: CancellationToken): ProviderResult<Location[]>;Interface exported by coc.nvim.
export interface ProvideDocumentHighlightsSignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;Interface exported by coc.nvim.
export interface ProvideDocumentSymbolsSignature {
(this: void, document: LinesTextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
}(this: void, document: LinesTextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;Interface exported by coc.nvim.
export interface ProvideWorkspaceSymbolsSignature {
(this: void, query: string, token: CancellationToken): ProviderResult<WorkspaceSymbol[]>;
}(this: void, query: string, token: CancellationToken): ProviderResult<WorkspaceSymbol[]>;Interface exported by coc.nvim.
export interface ProvideCodeActionsSignature {
(this: void, document: LinesTextDocument, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
}(this: void, document: LinesTextDocument, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;Interface exported by coc.nvim.
export interface ResolveCodeActionSignature {
(this: void, item: CodeAction, token: CancellationToken): ProviderResult<CodeAction>;
}(this: void, item: CodeAction, token: CancellationToken): ProviderResult<CodeAction>;Interface exported by coc.nvim.
export interface ProvideCodeLensesSignature {
(this: void, document: LinesTextDocument, token: CancellationToken): ProviderResult<CodeLens[]>;
}(this: void, document: LinesTextDocument, token: CancellationToken): ProviderResult<CodeLens[]>;Interface exported by coc.nvim.
export interface ResolveCodeLensSignature {
(this: void, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
}(this: void, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;Interface exported by coc.nvim.
export interface ProvideDocumentFormattingEditsSignature {
(this: void, document: LinesTextDocument, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}(this: void, document: LinesTextDocument, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;Interface exported by coc.nvim.
export interface ProvideDocumentRangeFormattingEditsSignature {
(this: void, document: LinesTextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}(this: void, document: LinesTextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;Interface exported by coc.nvim.
export interface ProvideDocumentRangesFormattingEditsSignature {
(this: void, document: LinesTextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}(this: void, document: LinesTextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;Interface exported by coc.nvim.
export interface ProvideOnTypeFormattingEditsSignature {
(this: void, document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}(this: void, document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;Interface exported by coc.nvim.
export interface PrepareRenameSignature {
(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Range | {
range: Range;
placeholder: string;
}>;
}(this: void, document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Range | {
range: Range;
placeholder: string;
}>;Interface exported by coc.nvim.
export interface ProvideRenameEditsSignature {
(this: void, document: LinesTextDocument, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit>;
}(this: void, document: LinesTextDocument, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit>;Interface exported by coc.nvim.
export interface ProvideDocumentLinksSignature {
(this: void, document: LinesTextDocument, token: CancellationToken): ProviderResult<DocumentLink[]>;
}(this: void, document: LinesTextDocument, token: CancellationToken): ProviderResult<DocumentLink[]>;Interface exported by coc.nvim.
export interface ResolveDocumentLinkSignature {
(this: void, link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;
}(this: void, link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;Interface exported by coc.nvim.
export interface ExecuteCommandSignature {
(this: void, command: string, args: any[]): ProviderResult<any>;
}(this: void, command: string, args: any[]): ProviderResult<any>;Interface exported by coc.nvim.
export interface NextSignature<P, R> {
(this: void, data: P, next: (data: P) => R): R;
}(this: void, data: P, next: (data: P) => R): R;Interface exported by coc.nvim.
export interface DidChangeConfigurationSignature {
(this: void, sections: string[] | undefined): void;
}(this: void, sections: string[] | undefined): void;Interface exported by coc.nvim.
export interface DidChangeWatchedFileSignature {
(this: void, event: FileEvent): void;
}(this: void, event: FileEvent): void;Interface exported by coc.nvim.
export interface ProvideInlineCompletionItemsSignature {
(this: void, document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<InlineCompletionItem[] | InlineCompletionList>;
}(this: void, document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<InlineCompletionItem[] | InlineCompletionList>;Interface exported by coc.nvim.
export interface _WorkspaceMiddleware {
didChangeConfiguration?: (this: void, sections: string[] | undefined, next: DidChangeConfigurationSignature) => Promise<void>;
didChangeWatchedFile?: (this: void, event: FileEvent, next: DidChangeWatchedFileSignature) => void;
handleApplyEdit?: (this: void, params: ApplyWorkspaceEditParams, next: RequestHandler<ApplyWorkspaceEditParams, ApplyWorkspaceEditResult, void>) => HandlerResult<ApplyWorkspaceEditResult, void>;
}didChangeConfiguration?: (this: void, sections: string[] | undefined, next: DidChangeConfigurationSignature) => Promise<void>;Middleware for configuration change notifications.
didChangeWatchedFile?: (this: void, event: FileEvent, next: DidChangeWatchedFileSignature) => void;Middleware for watched file change notifications.
handleApplyEdit?: (this: void, params: ApplyWorkspaceEditParams, next: RequestHandler<ApplyWorkspaceEditParams, ApplyWorkspaceEditResult, void>) => HandlerResult<ApplyWorkspaceEditResult, void>;Middleware for applying workspace edits.
Type alias exported by coc.nvim.
export type WorkspaceMiddleware = _WorkspaceMiddleware & ConfigurationWorkspaceMiddleware & WorkspaceFolderWorkspaceMiddleware & FileOperationsMiddleware;Params to show a document.
export interface ShowDocumentParams {
uri: string;
external?: boolean;
takeFocus?: boolean;
selection?: Range;
}uri: string;The document uri to show.
external?: boolean;Indicates to show the resource in an external program.
To show for example https://code.visualstudio.com/
in the default WEB browser set external to true.
takeFocus?: boolean;An optional property to indicate whether the editor showing the document should take focus or not. Clients might ignore this property if an external program in started.
selection?: Range;An optional selection range if the document is a text document. Clients might ignore the property if an external program is started or the file is not a text file.
The result of an show document request.
export interface ShowDocumentResult {
success: boolean;
}success: boolean;A boolean indicating if the show was successful.
General parameters to register for a notification or to register a provider.
export interface Registration {
id: string;
method: string;
registerOptions?: LSPAny;
}id: string;The id used to register the request. The id can be used to deregister the request again.
method: string;The method / capability to register for.
registerOptions?: LSPAny;Options necessary for the registration.
Interface exported by coc.nvim.
export interface RegistrationParams {
registrations: Registration[];
}registrations: Registration[];Registrations of the request.
General parameters to unregister a request or notification.
export interface Unregistration {
id: string;
method: string;
}id: string;The id used to unregister the request or notification. Usually an id provided during the register request.
method: string;The method to unregister for.
Interface exported by coc.nvim.
export interface UnregistrationParams {
unregisterations: Unregistration[];
}unregisterations: Unregistration[];Unregistrations of the request.
Interface exported by coc.nvim.
export interface _WindowMiddleware {
showDocument?: (params: ShowDocumentParams, token: CancellationToken, next: RequestHandler<ShowDocumentParams, ShowDocumentResult, void>) => Promise<ShowDocumentResult>;
}showDocument?: (params: ShowDocumentParams, token: CancellationToken, next: RequestHandler<ShowDocumentParams, ShowDocumentResult, void>) => Promise<ShowDocumentResult>;Middleware for show document requests.
Type alias exported by coc.nvim.
export type WindowMiddleware = _WindowMiddleware;The Middleware lets extensions intercept the request and notifications send and received from the server
interface _Middleware {
didOpen?: NextSignature<LinesTextDocument, Promise<void>>;
didChange?: NextSignature<DidChangeTextDocumentParams, Promise<void>>;
willSave?: NextSignature<TextDocumentWillSaveEvent, Promise<void>>;
willSaveWaitUntil?: NextSignature<TextDocumentWillSaveEvent, Thenable<TextEdit[]>>;
didSave?: NextSignature<LinesTextDocument, Promise<void>>;
didClose?: NextSignature<LinesTextDocument, Promise<void>>;
handleDiagnostics?: (this: void, uri: string, diagnostics: Diagnostic[], next: HandleDiagnosticsSignature) => void;
provideCompletionItem?: (this: void, document: LinesTextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<CompletionItem[] | CompletionList | null>;
resolveCompletionItem?: (this: void, item: CompletionItem, token: CancellationToken, next: ResolveCompletionItemSignature) => ProviderResult<CompletionItem>;
provideHover?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideHoverSignature) => ProviderResult<Hover>;
provideSignatureHelp?: (this: void, document: LinesTextDocument, position: Position, context: SignatureHelpContext, token: CancellationToken, next: ProvideSignatureHelpSignature) => ProviderResult<SignatureHelp>;
provideDefinition?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideDefinitionSignature) => ProviderResult<Definition | DefinitionLink[]>;
provideReferences?: (this: void, document: LinesTextDocument, position: Position, options: {
includeDeclaration: boolean;
}, token: CancellationToken, next: ProvideReferencesSignature) => ProviderResult<Location[]>;
provideDocumentHighlights?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideDocumentHighlightsSignature) => ProviderResult<DocumentHighlight[]>;
provideDocumentSymbols?: (this: void, document: LinesTextDocument, token: CancellationToken, next: ProvideDocumentSymbolsSignature) => ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
provideWorkspaceSymbols?: (this: void, query: string, token: CancellationToken, next: ProvideWorkspaceSymbolsSignature) => ProviderResult<WorkspaceSymbol[]>;
provideCodeActions?: (this: void, document: LinesTextDocument, range: Range, context: CodeActionContext, token: CancellationToken, next: ProvideCodeActionsSignature) => ProviderResult<(Command | CodeAction)[]>;
handleWorkDoneProgress?: (this: void, token: ProgressToken, params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd, next: HandleWorkDoneProgressSignature) => void;
handleRegisterCapability?: (this: void, params: RegistrationParams, next: RequestHandler<RegistrationParams, void, void>) => Promise<void>;
handleUnregisterCapability?: (this: void, params: UnregistrationParams, next: RequestHandler<UnregistrationParams, void, void>) => Promise<void>;
resolveCodeAction?: (this: void, item: CodeAction, token: CancellationToken, next: ResolveCodeActionSignature) => ProviderResult<CodeAction>;
provideCodeLenses?: (this: void, document: LinesTextDocument, token: CancellationToken, next: ProvideCodeLensesSignature) => ProviderResult<CodeLens[]>;
resolveCodeLens?: (this: void, codeLens: CodeLens, token: CancellationToken, next: ResolveCodeLensSignature) => ProviderResult<CodeLens>;
provideDocumentFormattingEdits?: (this: void, document: LinesTextDocument, options: FormattingOptions, token: CancellationToken, next: ProvideDocumentFormattingEditsSignature) => ProviderResult<TextEdit[]>;
provideDocumentRangeFormattingEdits?: (this: void, document: LinesTextDocument, range: Range, options: FormattingOptions, token: CancellationToken, next: ProvideDocumentRangeFormattingEditsSignature) => ProviderResult<TextEdit[]>;
provideDocumentRangesFormattingEdits?: (this: void, document: LinesTextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken, next: ProvideDocumentRangesFormattingEditsSignature) => ProviderResult<TextEdit[]>;
provideOnTypeFormattingEdits?: (this: void, document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken, next: ProvideOnTypeFormattingEditsSignature) => ProviderResult<TextEdit[]>;
prepareRename?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: PrepareRenameSignature) => ProviderResult<Range | {
range: Range;
placeholder: string;
}>;
provideRenameEdits?: (this: void, document: LinesTextDocument, position: Position, newName: string, token: CancellationToken, next: ProvideRenameEditsSignature) => ProviderResult<WorkspaceEdit>;
provideDocumentLinks?: (this: void, document: LinesTextDocument, token: CancellationToken, next: ProvideDocumentLinksSignature) => ProviderResult<DocumentLink[]>;
resolveDocumentLink?: (this: void, link: DocumentLink, token: CancellationToken, next: ResolveDocumentLinkSignature) => ProviderResult<DocumentLink>;
executeCommand?: (this: void, command: string, args: any[], next: ExecuteCommandSignature) => ProviderResult<any>;
workspace?: WorkspaceMiddleware;
window?: WindowMiddleware;
}didOpen?: NextSignature<LinesTextDocument, Promise<void>>;Middleware for document open notifications.
didChange?: NextSignature<DidChangeTextDocumentParams, Promise<void>>;Middleware for document change notifications.
willSave?: NextSignature<TextDocumentWillSaveEvent, Promise<void>>;Middleware for document will-save notifications.
willSaveWaitUntil?: NextSignature<TextDocumentWillSaveEvent, Thenable<TextEdit[]>>;Middleware for document will-save-wait-until requests.
didSave?: NextSignature<LinesTextDocument, Promise<void>>;Middleware for document save notifications.
didClose?: NextSignature<LinesTextDocument, Promise<void>>;Middleware for document close notifications.
handleDiagnostics?: (this: void, uri: string, diagnostics: Diagnostic[], next: HandleDiagnosticsSignature) => void;Middleware for diagnostics notifications.
provideCompletionItem?: (this: void, document: LinesTextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<CompletionItem[] | CompletionList | null>;Middleware for providing completion items.
resolveCompletionItem?: (this: void, item: CompletionItem, token: CancellationToken, next: ResolveCompletionItemSignature) => ProviderResult<CompletionItem>;Middleware for resolving completion items.
provideHover?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideHoverSignature) => ProviderResult<Hover>;Middleware for providing hover results.
provideSignatureHelp?: (this: void, document: LinesTextDocument, position: Position, context: SignatureHelpContext, token: CancellationToken, next: ProvideSignatureHelpSignature) => ProviderResult<SignatureHelp>;Middleware for providing signature help.
provideDefinition?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideDefinitionSignature) => ProviderResult<Definition | DefinitionLink[]>;Middleware for providing definitions.
provideReferences?: (this: void, document: LinesTextDocument, position: Position, options: {
includeDeclaration: boolean;
}, token: CancellationToken, next: ProvideReferencesSignature) => ProviderResult<Location[]>;Middleware for providing references.
provideDocumentHighlights?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideDocumentHighlightsSignature) => ProviderResult<DocumentHighlight[]>;Middleware for providing document highlights.
provideDocumentSymbols?: (this: void, document: LinesTextDocument, token: CancellationToken, next: ProvideDocumentSymbolsSignature) => ProviderResult<SymbolInformation[] | DocumentSymbol[]>;Middleware for providing document symbols.
provideWorkspaceSymbols?: (this: void, query: string, token: CancellationToken, next: ProvideWorkspaceSymbolsSignature) => ProviderResult<WorkspaceSymbol[]>;Middleware for providing workspace symbols.
provideCodeActions?: (this: void, document: LinesTextDocument, range: Range, context: CodeActionContext, token: CancellationToken, next: ProvideCodeActionsSignature) => ProviderResult<(Command | CodeAction)[]>;Middleware for providing code actions.
handleWorkDoneProgress?: (this: void, token: ProgressToken, params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd, next: HandleWorkDoneProgressSignature) => void;Middleware for work done progress notifications.
handleRegisterCapability?: (this: void, params: RegistrationParams, next: RequestHandler<RegistrationParams, void, void>) => Promise<void>;Middleware for register capability requests.
handleUnregisterCapability?: (this: void, params: UnregistrationParams, next: RequestHandler<UnregistrationParams, void, void>) => Promise<void>;Middleware for unregister capability requests.
resolveCodeAction?: (this: void, item: CodeAction, token: CancellationToken, next: ResolveCodeActionSignature) => ProviderResult<CodeAction>;Middleware for resolving code actions.
provideCodeLenses?: (this: void, document: LinesTextDocument, token: CancellationToken, next: ProvideCodeLensesSignature) => ProviderResult<CodeLens[]>;Middleware for providing code lenses.
resolveCodeLens?: (this: void, codeLens: CodeLens, token: CancellationToken, next: ResolveCodeLensSignature) => ProviderResult<CodeLens>;Middleware for resolving code lenses.
provideDocumentFormattingEdits?: (this: void, document: LinesTextDocument, options: FormattingOptions, token: CancellationToken, next: ProvideDocumentFormattingEditsSignature) => ProviderResult<TextEdit[]>;Middleware for providing document formatting edits.
provideDocumentRangeFormattingEdits?: (this: void, document: LinesTextDocument, range: Range, options: FormattingOptions, token: CancellationToken, next: ProvideDocumentRangeFormattingEditsSignature) => ProviderResult<TextEdit[]>;Middleware for providing range formatting edits.
provideDocumentRangesFormattingEdits?: (this: void, document: LinesTextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken, next: ProvideDocumentRangesFormattingEditsSignature) => ProviderResult<TextEdit[]>;Middleware for providing ranges formatting edits.
provideOnTypeFormattingEdits?: (this: void, document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken, next: ProvideOnTypeFormattingEditsSignature) => ProviderResult<TextEdit[]>;Middleware for providing on-type formatting edits.
prepareRename?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: PrepareRenameSignature) => ProviderResult<Range | {
range: Range;
placeholder: string;
}>;Middleware for preparing renames.
provideRenameEdits?: (this: void, document: LinesTextDocument, position: Position, newName: string, token: CancellationToken, next: ProvideRenameEditsSignature) => ProviderResult<WorkspaceEdit>;Middleware for providing rename edits.
provideDocumentLinks?: (this: void, document: LinesTextDocument, token: CancellationToken, next: ProvideDocumentLinksSignature) => ProviderResult<DocumentLink[]>;Middleware for providing document links.
resolveDocumentLink?: (this: void, link: DocumentLink, token: CancellationToken, next: ResolveDocumentLinkSignature) => ProviderResult<DocumentLink>;Middleware for resolving document links.
executeCommand?: (this: void, command: string, args: any[], next: ExecuteCommandSignature) => ProviderResult<any>;Middleware for executing commands.
workspace?: WorkspaceMiddleware;Workspace middleware.
window?: WindowMiddleware;Window middleware.
Interface exported by coc.nvim.
interface GeneralMiddleware {
sendRequest?<P, R>(this: void, type: string | MessageSignature, param: P | undefined, token: CancellationToken | undefined, next: (type: string | MessageSignature, param?: P, token?: CancellationToken) => Promise<R>): Promise<R>;
sendNotification?<R>(this: void, type: string | MessageSignature, next: (type: string | MessageSignature, params?: R) => Promise<void>, params: R): Promise<void>;
}sendRequest?<P, R>(this: void, type: string | MessageSignature, param: P | undefined, token: CancellationToken | undefined, next: (type: string | MessageSignature, param?: P, token?: CancellationToken) => Promise<R>): Promise<R>;Middleware for sending requests.
sendNotification?<R>(this: void, type: string | MessageSignature, next: (type: string | MessageSignature, params?: R) => Promise<void>, params: R): Promise<void>;Middleware for sending notifications.
Interface exported by coc.nvim.
export interface ProvideTextDocumentContentSignature {
(this: void, uri: Uri, token: CancellationToken): ProviderResult<string>;
}(this: void, uri: Uri, token: CancellationToken): ProviderResult<string>;Interface exported by coc.nvim.
export interface TextDocumentContentMiddleware {
provideTextDocumentContent?: (this: void, uri: Uri, token: CancellationToken, next: ProvideTextDocumentContentSignature) => ProviderResult<string>;
}provideTextDocumentContent?: (this: void, uri: Uri, token: CancellationToken, next: ProvideTextDocumentContentSignature) => ProviderResult<string>;Middleware for providing text document content.
Interface exported by coc.nvim.
export interface InlineCompletionMiddleware {
provideInlineCompletionItems?: (this: void, document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken, next: ProvideInlineCompletionItemsSignature) => ProviderResult<InlineCompletionItem[] | InlineCompletionList>;
}provideInlineCompletionItems?: (this: void, document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken, next: ProvideInlineCompletionItemsSignature) => ProviderResult<InlineCompletionItem[] | InlineCompletionList>;Middleware for providing inline completion items.
Type alias exported by coc.nvim.
export type Middleware = _Middleware & TypeDefinitionMiddleware & ImplementationMiddleware & ColorProviderMiddleware & DeclarationMiddleware & FoldingRangeProviderMiddleware & CallHierarchyMiddleware & SemanticTokensMiddleware & LinkedEditingRangeMiddleware & SelectionRangeProviderMiddleware & DiagnosticProviderMiddleware & GeneralMiddleware & TextDocumentContentMiddleware & InlineCompletionMiddleware;Interface exported by coc.nvim.
export interface ConnectionOptions {
maxRestartCount?: number;
}maxRestartCount?: number;Maximum number of restart attempts before giving up.
Enum exported by coc.nvim.
export enum DiagnosticPullMode {
onType = 'onType',
onSave = 'onSave',
onFocus = 'onFocus'
}onType = 'onType'onSave = 'onSave'onFocus = 'onFocus'Interface exported by coc.nvim.
export interface DiagnosticPullOptions {
onChange?: boolean;
onFocus?: boolean;
onSave?: boolean;
workspace?: boolean;
ignored?: string[];
filter?(document: {
uri: string;
languageId: string;
}, mode: 'onType' | 'onSave'): boolean;
match?(documentSelector: DocumentSelector, resource: Uri): boolean;
}onChange?: boolean;Whether to pull for diagnostics on document change. Default to "pullDiagnostic.onChange" configuration.
onFocus?: boolean;Whether to pull for diagnostics on editor focus.
onSave?: boolean;Whether to pull for diagnostics on document save. Default to "pullDiagnostic.onSave" configuration.
workspace?: boolean;Whether to pull for workspace diagnostics when possible. Default to "pullDiagnostic.workspace" configuration.
ignored?: string[];Minimatch patterns to match full filepath that should be ignored for pullDiagnostic. Default to "pullDiagnostic.ignored" configuration.
filter?(document: {
uri: string;
languageId: string;
}, mode: 'onType' | 'onSave'): boolean;An optional filter method that is consulted when triggering a diagnostic pull during document change or document save.
The document gets filtered if the method returns true.
match?(documentSelector: DocumentSelector, resource: Uri): boolean;An optional match method that is consulted when pulling for diagnostics when only a URI is known (e.g. for not instantiated tabs)
The method should return true if the document selector matches the
given resource. See also the vscode.languages.match function.
Interface exported by coc.nvim.
export interface URIConverter {
(value: Uri): string;
}(value: Uri): string;Interface exported by coc.nvim.
export interface LanguageClientOptions {
ignoredRootPaths?: string[];
disableSnippetCompletion?: boolean;
disableDynamicRegister?: boolean;
disabledFeatures?: string[];
formatterPriority?: number;
documentSelector?: DocumentSelector | string[];
synchronize?: SynchronizeOptions;
diagnosticCollectionName?: string;
outputChannelName?: string;
outputChannel?: OutputChannel;
traceOutputChannel?: OutputChannel;
revealOutputChannelOn?: RevealOutputChannelOn;
stdioEncoding?: string;
uriConverter?: {
code2Protocol: URIConverter;
};
initializationOptions?: any | (() => any);
initializationFailedHandler?: InitializationFailedHandler;
progressOnInitialization?: boolean;
errorHandler?: ErrorHandler;
middleware?: Middleware;
workspaceFolder?: WorkspaceFolder;
connectionOptions?: ConnectionOptions;
diagnosticPullOptions?: DiagnosticPullOptions;
textSynchronization?: {
delayOpenNotifications?: boolean;
};
languageIdMap?: {
[filename: string]: string;
};
markdown?: {
isTrusted?: boolean;
supportHtml?: boolean;
};
}ignoredRootPaths?: string[];Root paths that are ignored by the language client.
disableSnippetCompletion?: boolean;Disable snippet completion when true.
disableDynamicRegister?: boolean;Disable dynamic registration when true.
disabledFeatures?: string[];Features disabled for the client.
formatterPriority?: number;Priority of the formatter service.
documentSelector?: DocumentSelector | string[];Document selector of the client.
synchronize?: SynchronizeOptions;Synchronization options of the client.
diagnosticCollectionName?: string;Name of the diagnostic collection.
outputChannelName?: string;Name of the output channel.
outputChannel?: OutputChannel;Output channel of the client.
traceOutputChannel?: OutputChannel;Trace output channel of the client.
revealOutputChannelOn?: RevealOutputChannelOn;When to reveal the output channel.
stdioEncoding?: string;The encoding use to read stdout and stderr. Defaults to 'utf8' if omitted.
uriConverter?: {
code2Protocol: URIConverter;
};Converter used to encode/decode uri.
initializationOptions?: any | (() => any);Initialization options sent to the server.
initializationFailedHandler?: InitializationFailedHandler;Handler invoked when initialization fails.
progressOnInitialization?: boolean;Show progress while initializing when true.
errorHandler?: ErrorHandler;Error handler of the client.
middleware?: Middleware;Middleware of the client.
workspaceFolder?: WorkspaceFolder;Workspace folder of the client.
connectionOptions?: ConnectionOptions;Connection options of the client.
diagnosticPullOptions?: DiagnosticPullOptions;Diagnostic pull options of the client.
textSynchronization?: {
delayOpenNotifications?: boolean;
};Text synchronization options of the client.
languageIdMap?: {
[filename: string]: string;
};Map of filename to languageId used when opening documents, e.g. { "application.yml": "spring-boot-properties-yaml" }.
markdown?: {
isTrusted?: boolean;
supportHtml?: boolean;
};Markdown options of the client.
Enum exported by coc.nvim.
export enum ClientState {
Initial,
Starting,
StartFailed,
Running,
Stopping,
Stopped
}InitialStartingStartFailedRunningStoppingStoppedEnum exported by coc.nvim.
export enum State {
Stopped = 1,
Running = 2,
Starting = 3,
StartFailed = 4
}Stopped = 1Running = 2Starting = 3StartFailed = 4Interface exported by coc.nvim.
export interface StateChangeEvent {
oldState: State;
newState: State;
}Interface exported by coc.nvim.
export interface RegistrationData<T> {
id: string;
registerOptions: T;
}id: string;Id of the registration.
registerOptions: T;Register options of the registration.
Type alias exported by coc.nvim.
export type FeatureState = {
kind: 'document';
id: string;
registrations: boolean;
matches: boolean;
} | {
kind: 'workspace';
id: string;
registrations: boolean;
} | {
kind: 'window';
id: string;
registrations: boolean;
} | {
kind: 'static';
};A static feature. A static feature can't be dynamically activate via the server. It is wired during the initialize sequence.
export interface StaticFeature {
fillInitializeParams?: (params: object) => void;
fillClientCapabilities(capabilities: object): void;
preInitialize?: (capabilities: object, documentSelector: DocumentSelector | undefined) => void;
initialize(capabilities: object, documentSelector: DocumentSelector | undefined): void;
getState?(): FeatureState;
dispose(): void;
}fillInitializeParams?: (params: object) => void;Called to fill the initialize params.
fillClientCapabilities(capabilities: object): void;Called to fill in the client capabilities this feature implements.
preInitialize?: (capabilities: object, documentSelector: DocumentSelector | undefined) => void;A preflight where the server capabilities are shown to all features before a feature is actually initialized. This allows feature to capture some state if they are a pre-requisite for other features.
initialize(capabilities: object, documentSelector: DocumentSelector | undefined): void;Initialize the feature. This method is called on a feature instance when the client has successfully received the initialize request from the server and before the client sends the initialized notification to the server.
getState?(): FeatureState;Returns the state the feature is in.
dispose(): void;Called when the client is stopped to dispose this feature. Usually a feature unregisters listeners registered hooked up with the VS Code extension host.
A dynamic feature can be activated via the server.
export interface DynamicFeature<RO> {
fillInitializeParams?: (params: InitializeParams) => void;
fillClientCapabilities(capabilities: any): void;
initialize(capabilities: object, documentSelector: DocumentSelector | undefined): void;
preInitialize?: (capabilities: object, documentSelector: DocumentSelector | undefined) => void;
registrationType: RegistrationType<RO>;
register(data: RegistrationData<RO>): void;
unregister(id: string): void;
getState?(): FeatureState;
dispose(): void;
}fillInitializeParams?: (params: InitializeParams) => void;Called to fill the initialize params.
fillClientCapabilities(capabilities: any): void;Called to fill in the client capabilities this feature implements.
initialize(capabilities: object, documentSelector: DocumentSelector | undefined): void;Initialize the feature. This method is called on a feature instance when the client has successfully received the initialize request from the server and before the client sends the initialized notification to the server.
preInitialize?: (capabilities: object, documentSelector: DocumentSelector | undefined) => void;A preflight where the server capabilities are shown to all features before a feature is actually initialized. This allows feature to capture some state if they are a pre-requisite for other features.
registrationType: RegistrationType<RO>;The signature (e.g. method) for which this features support dynamic activation / registration.
register(data: RegistrationData<RO>): void;Is called when the server send a register request for the given message.
unregister(id: string): void;Is called when the server wants to unregister a feature.
getState?(): FeatureState;Returns the state the feature is in.
dispose(): void;Called when the client is stopped to dispose this feature. Usually a feature unregisters listeners registered hooked up with the VS Code extension host.
Class exported by coc.nvim.
class ParameterStructures {
private readonly kind;
static readonly auto: ParameterStructures;
static readonly byPosition: ParameterStructures;
static readonly byName: ParameterStructures;
private constructor();
static is(value: any): value is ParameterStructures;
toString(): string;
}private readonly kind;static readonly auto: ParameterStructures;The parameter structure is automatically inferred on the number of parameters and the parameter type in case of a single param.
static readonly byPosition: ParameterStructures;Forces byPosition parameter structure. This is useful if you have a single
parameter which has a literal type.
static readonly byName: ParameterStructures;Forces byName parameter structure. This is only useful when having a single
parameter. The library will report errors if used with a different number of
parameters.
private constructor();static is(value: any): value is ParameterStructures;Checks whether the given value is a ParameterStructures.
toString(): string;String representation of the parameter structure.
An interface to type messages.
export interface MessageSignature {
readonly method: string;
readonly numberOfParams: number;
readonly parameterStructures: ParameterStructures;
}readonly method: string;Method name of the message.
readonly numberOfParams: number;Number of parameters of the message.
readonly parameterStructures: ParameterStructures;Parameter structure of the message.
An abstract implementation of a MessageType.
abstract class AbstractMessageSignature implements MessageSignature {
readonly method: string;
readonly numberOfParams: number;
constructor(method: string, numberOfParams: number);
get parameterStructures(): ParameterStructures;
}readonly method: string;Method name of the message.
readonly numberOfParams: number;Number of parameters of the message.
constructor(method: string, numberOfParams: number);get parameterStructures(): ParameterStructures;Parameter structure of the message.
Classes to type request response pairs
export class RequestType0<R, E> extends AbstractMessageSignature {
readonly _: [
R,
E,
_EM
] | undefined;
constructor(method: string);
}readonly _: [
R,
E,
_EM
] | undefined;Clients must not use this property. It is here to ensure correct typing.
constructor(method: string);Class exported by coc.nvim.
export class RequestType<P, R, E> extends AbstractMessageSignature {
private _parameterStructures;
readonly _: [
P,
R,
E,
_EM
] | undefined;
constructor(method: string, _parameterStructures?: ParameterStructures);
get parameterStructures(): ParameterStructures;
}private _parameterStructures;readonly _: [
P,
R,
E,
_EM
] | undefined;Clients must not use this property. It is here to ensure correct typing.
constructor(method: string, _parameterStructures?: ParameterStructures);get parameterStructures(): ParameterStructures;Parameter structure of the request.
Class exported by coc.nvim.
export class NotificationType<P> extends AbstractMessageSignature {
readonly _: [
P,
_EM
] | undefined;
constructor(method: string);
}readonly _: [
P,
_EM
] | undefined;Clients must not use this property. It is here to ensure correct typing.
constructor(method: string);Class exported by coc.nvim.
export class NotificationType0 extends AbstractMessageSignature {
readonly _: [
_EM
] | undefined;
constructor(method: string);
}readonly _: [
_EM
] | undefined;Clients must not use this property. It is here to ensure correct typing.
constructor(method: string);Interface exported by coc.nvim.
export interface InitializeParams {
processId: number | null;
clientInfo?: {
name: string;
version?: string;
};
rootPath?: string | null;
rootUri: string | null;
capabilities: any;
initializationOptions?: any;
trace?: 'off' | 'messages' | 'verbose';
workDoneToken?: ProgressToken;
}processId: number | null;The process Id of the parent process that started the server.
clientInfo?: {
name: string;
version?: string;
};Information about the client
rootPath?: string | null;The rootPath of the workspace. Is null if no folder is open.
rootUri: string | null;The rootUri of the workspace. Is null if no
folder is open. If both rootPath and rootUri are set
rootUri wins.
capabilities: any;The capabilities provided by the client (editor or tool)
initializationOptions?: any;User provided initialization options.
trace?: 'off' | 'messages' | 'verbose';The initial trace setting. If omitted trace is disabled ('off').
workDoneToken?: ProgressToken;An optional token that a server can use to report work done progress.
Class exported by coc.nvim.
class RegistrationType<RO> {
readonly ____: [
RO,
_EM
] | undefined;
readonly method: string;
constructor(method: string);
}readonly ____: [
RO,
_EM
] | undefined;Clients must not use this property. It is here to ensure correct typing.
readonly method: string;Method name of the registration type.
constructor(method: string);The result returned from an initialize request.
export interface InitializeResult {
capabilities: any;
serverInfo?: {
name: string;
version?: string;
};
[custom: string]: any;
}capabilities: any;The capabilities the language server provides.
serverInfo?: {
name: string;
version?: string;
};Information about the server.
[custom: string]: any;Custom initialization results.
Interface exported by coc.nvim.
export interface NotificationFeature<T extends Function> {
getProvider(document: {
uri: string;
languageId: string;
}): {
send: T;
};
}getProvider(document: {
uri: string;
languageId: string;
}): {
send: T;
};Triggers the corresponding RPC method.
Interface exported by coc.nvim.
export interface ExecutableOptions {
cwd?: string;
env?: any;
detached?: boolean;
shell?: boolean;
}cwd?: string;Working directory of the process.
env?: any;Environment variables of the process.
detached?: boolean;Detach the process from the parent.
shell?: boolean;Use a shell to run the process.
Interface exported by coc.nvim.
export interface Executable {
command: string;
args?: string[];
options?: ExecutableOptions;
}command: string;Command of the executable.
args?: string[];Arguments of the command.
options?: ExecutableOptions;Options of the executable.
Interface exported by coc.nvim.
export interface ForkOptions {
cwd?: string;
env?: any;
execPath?: string;
encoding?: string;
execArgv?: string[];
}cwd?: string;Working directory of the process.
env?: any;Environment variables of the process.
execPath?: string;Path of the executable.
encoding?: string;Encoding of the process output.
execArgv?: string[];Arguments passed to the executable.
Interface exported by coc.nvim.
export interface StreamInfo {
writer: NodeJS.WritableStream;
reader: NodeJS.ReadableStream;
detached?: boolean;
}writer: NodeJS.WritableStream;Writable stream of the server.
reader: NodeJS.ReadableStream;Readable stream of the server.
detached?: boolean;Detach the streams from the parent.
Enum exported by coc.nvim.
export enum TransportKind {
stdio = 0,
ipc = 1,
pipe = 2,
socket = 3
}stdio = 0ipc = 1pipe = 2socket = 3Interface exported by coc.nvim.
export interface SocketTransport {
kind: TransportKind.socket;
port: number;
}kind: TransportKind.socket;Transport kind, always socket.
port: number;Port of the socket.
Interface exported by coc.nvim.
export interface NodeModule {
module: string;
transport?: TransportKind | SocketTransport;
args?: string[];
runtime?: string;
options?: ForkOptions;
}module: string;Module path of the server.
transport?: TransportKind | SocketTransport;Transport of the server.
args?: string[];Arguments of the server.
runtime?: string;Runtime of the server.
options?: ForkOptions;Fork options of the server.
Interface exported by coc.nvim.
export interface ChildProcessInfo {
process: cp.ChildProcess;
detached: boolean;
}process: cp.ChildProcess;Child process of the server.
detached: boolean;Whether the process is detached.
Interface exported by coc.nvim.
export interface PartialMessageInfo {
readonly messageToken: number;
readonly waitingTime: number;
}readonly messageToken: number;Token of the partial message.
readonly waitingTime: number;Waiting time of the partial message.
Interface exported by coc.nvim.
export interface MessageReader {
readonly onError: Event<Error>;
readonly onClose: Event<void>;
readonly onPartialMessage: Event<PartialMessageInfo>;
listen(callback: (data: {
jsonrpc: string;
}) => void): void;
dispose(): void;
}readonly onError: Event<Error>;Fired on error.
readonly onClose: Event<void>;Fired on close.
readonly onPartialMessage: Event<PartialMessageInfo>;Fired on partial message.
listen(callback: (data: {
jsonrpc: string;
}) => void): void;Start listening for messages.
dispose(): void;Dispose the reader.
Interface exported by coc.nvim.
export interface MessageWriter {
readonly onError: Event<[
Error,
{
jsonrpc: string;
} | undefined,
number | undefined
]>;
readonly onClose: Event<void>;
write(msg: {
jsonrpc: string;
}): void;
dispose(): void;
}Class exported by coc.nvim.
export class NullLogger {
constructor();
error(message: string): void;
warn(message: string): void;
info(message: string): void;
log(message: string): void;
}constructor();error(message: string): void;Log an error message.
warn(message: string): void;Log a warning message.
info(message: string): void;Log an info message.
log(message: string): void;Log a message.
Interface exported by coc.nvim.
export interface MessageTransports {
reader: MessageReader;
writer: MessageWriter;
detached?: boolean;
}reader: MessageReader;Message reader of the transport.
writer: MessageWriter;Message writer of the transport.
detached?: boolean;Whether the transport is detached.
Type alias exported by coc.nvim.
export type ServerOptions = Executable | NodeModule | {
run: Executable;
debug: Executable;
} | {
run: NodeModule;
debug: NodeModule;
} | (() => Promise<cp.ChildProcess | StreamInfo | MessageTransports | ChildProcessInfo>);Interface exported by coc.nvim.
export interface _EM {
_$endMarker$_: number;
}_$endMarker$_: number;End marker used for typing only.
Class exported by coc.nvim.
export class ProgressType<PR> {
readonly __?: [
PR,
_EM
];
readonly _pr?: PR;
constructor();
}readonly __?: [
PR,
_EM
];Clients must not use these properties. They are here to ensure correct typing. in TypeScript
readonly _pr?: PR;Typing marker, do not use.
constructor();Enum exported by coc.nvim.
export enum Trace {
Off = 0,
Messages = 1,
Compact = 2,
Verbose = 3
}Off = 0Messages = 1Compact = 2Verbose = 3Interface exported by coc.nvim.
export interface RequestProtocolSignature<P, R, PR, E, RO> {
method: string;
numberOfParams?: number;
parameterStructures?: unknown;
}method: string;Method name of the request.
numberOfParams?: number;Number of parameters of the request.
parameterStructures?: unknown;Parameter structure of the request.
Interface exported by coc.nvim.
export interface RequestProtocolSignature0<R, PR, E, RO> {
method: string;
}method: string;Method name of the request.
Interface exported by coc.nvim.
export interface RequestSignature<P, R, E> {
method: string;
numberOfParams?: number;
parameterStructures?: unknown;
}method: string;Method name of the request.
numberOfParams?: number;Number of parameters of the request.
parameterStructures?: unknown;Parameter structure of the request.
Interface exported by coc.nvim.
export interface RequestSignature0<R, E> {
method: string;
}method: string;Method name of the request.
Interface exported by coc.nvim.
export interface NotificationProtocolSignature<P, RO> {
method: string;
numberOfParams?: number;
parameterStructures?: unknown;
}method: string;Method name of the notification.
numberOfParams?: number;Number of parameters of the notification.
parameterStructures?: unknown;Parameter structure of the notification.
Interface exported by coc.nvim.
export interface NotificationProtocolSignature0<RO> {
readonly ____: [
RO,
_EM
] | undefined;
method: string;
}readonly ____: [
RO,
_EM
] | undefined;Typing marker, do not use.
method: string;Method name of the notification.
Interface exported by coc.nvim.
export interface NotificationSignature<P> {
readonly _: [
P,
_EM
] | undefined;
method: string;
numberOfParams?: number;
parameterStructures?: unknown;
}readonly _: [
P,
_EM
] | undefined;Typing marker, do not use.
method: string;Method name of the notification.
numberOfParams?: number;Number of parameters of the notification.
parameterStructures?: unknown;Parameter structure of the notification.
Interface exported by coc.nvim.
export interface NotificationSignature0 {
method: string;
}method: string;Method name of the notification.
Class exported by coc.nvim.
export class ProtocolRequestType0<R, PR, E, RO> extends RequestType0<R, E> implements ProgressType<PR>, RegistrationType<RO> {
readonly ___: [
PR,
RO,
_EM
] | undefined;
readonly ____: [
RO,
_EM
] | undefined;
readonly _pr: PR | undefined;
constructor(method: string);
}Class exported by coc.nvim.
export class ProtocolRequestType<P, R, PR, E, RO> extends RequestType<P, R, E> implements ProgressType<PR>, RegistrationType<RO> {
readonly ___: [
PR,
RO,
_EM
] | undefined;
readonly ____: [
RO,
_EM
] | undefined;
readonly _pr: PR | undefined;
constructor(method: string);
}Class exported by coc.nvim.
export class ProtocolNotificationType0<RO> extends NotificationType0 implements RegistrationType<RO> {
readonly ___: [
RO,
_EM
] | undefined;
readonly ____: [
RO,
_EM
] | undefined;
constructor(method: string);
}Class exported by coc.nvim.
export class ProtocolNotificationType<P, RO> extends NotificationType<P> implements RegistrationType<RO> {
readonly ___: [
RO,
_EM
] | undefined;
readonly ____: [
RO,
_EM
] | undefined;
constructor(method: string);
}Interface exported by coc.nvim.
export interface NotificationHandler0 {
(): void;
}(): void;Interface exported by coc.nvim.
export interface NotificationHandler<P> {
(params: P): void;
}(params: P): void;Including the registration options from languageserver protocol package could be too complicated and the options can be changed from time to time.
export interface GeneralRegistrationOptions {
[key: string]: any;
}[key: string]: any;Interface exported by coc.nvim.
export interface DidChangeWatchedFilesRegistrationOptions {
watchers: FileSystemWatcher[];
}watchers: FileSystemWatcher[];The watchers to register.
Interface exported by coc.nvim.
export interface DidChangeConfigurationRegistrationOptions {
section?: string | string[];
}section?: string | string[];Configuration sections that changed.
Interface exported by coc.nvim.
interface TextDocumentRegistrationOptions {
documentSelector: DocumentSelector | null;
}documentSelector: DocumentSelector | null;A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.
Interface exported by coc.nvim.
interface TextDocumentChangeRegistrationOptions {
syncKind: 0 | 1 | 2;
}syncKind: 0 | 1 | 2;How documents are synced to the server.
Interface exported by coc.nvim.
interface TextDocumentSendFeature<T extends Function> {
getProvider(document: TextDocument): {
send: T;
} | undefined;
}getProvider(document: TextDocument): {
send: T;
} | undefined;Returns a provider for the given text document.
Interface exported by coc.nvim.
interface NotificationSendEvent<E, P> {
original: E;
type: ProtocolNotificationType<P, TextDocumentRegistrationOptions>;
params: P;
}original: E;Original event of the notification.
type: ProtocolNotificationType<P, TextDocumentRegistrationOptions>;Notification type of the event.
params: P;Parameters of the notification.
Interface exported by coc.nvim.
interface DidOpenTextDocumentParams {
textDocument: TextDocumentItem;
}textDocument: TextDocumentItem;The document that was opened.
Interface exported by coc.nvim.
interface NotifyingFeature<E, P> {
onNotificationSent: Event<NotificationSendEvent<E, P>>;
}onNotificationSent: Event<NotificationSendEvent<E, P>>;Fired when a notification is sent.
Interface exported by coc.nvim.
export interface DidOpenTextDocumentFeatureShape extends DynamicFeature<TextDocumentRegistrationOptions>, TextDocumentSendFeature<(textDocument: TextDocument) => Promise<void>>, NotifyingFeature<TextDocument, DidOpenTextDocumentParams> {
openDocuments: Iterable<TextDocument>;
}openDocuments: Iterable<TextDocument>;Documents currently opened by the feature.
Interface exported by coc.nvim.
export interface DidChangeTextDocumentFeatureShape extends DynamicFeature<TextDocumentChangeRegistrationOptions>, TextDocumentSendFeature<(event: DidChangeTextDocumentParams) => Promise<void>>, NotifyingFeature<DidChangeTextDocumentParams, Pick<DidChangeTextDocumentParams, 'textDocument' | 'contentChanges'>> {
}Interface exported by coc.nvim.
export interface DidSaveTextDocumentFeatureShape extends DynamicFeature<TextDocumentRegistrationOptions>, TextDocumentSendFeature<(textDocument: TextDocument) => Promise<void>>, NotifyingFeature<TextDocument, {
textDocument: {
uri: string;
};
text?: string;
}> {
}Interface exported by coc.nvim.
export interface DidCloseTextDocumentFeatureShape extends DynamicFeature<TextDocumentRegistrationOptions>, TextDocumentSendFeature<(textDocument: TextDocument) => Promise<void>>, NotifyingFeature<TextDocument, {
textDocument: {
uri: string;
};
}> {
}Interface exported by coc.nvim.
export interface TextDocumentContentProviderShape {
scheme: string;
onDidChangeEmitter: Emitter<Uri>;
provider: TextDocumentContentProvider;
}scheme: string;Scheme of the provider.
provider: TextDocumentContentProvider;Provider of the text document content.
Interface exported by coc.nvim.
export interface WorkspaceProviderFeature<PR> {
getProviders(): PR[] | undefined;
}getProviders(): PR[] | undefined;Get the registered providers.
Interface exported by coc.nvim.
export interface TextDocumentProviderFeature<T> {
readonly registrationLength: number;
getProvider(textDocument: TextDocument): T | undefined;
}readonly registrationLength: number;Number of registered providers.
getProvider(textDocument: TextDocument): T | undefined;Triggers the corresponding RPC method.
Interface exported by coc.nvim.
export interface CodeLensProviderShape {
provider?: CodeLensProvider;
onDidChangeCodeLensEmitter: Emitter<void>;
}provider?: CodeLensProvider;Provider of code lenses.
onDidChangeCodeLensEmitter: Emitter<void>;Emitter fired when code lenses change.
Interface exported by coc.nvim.
export interface SemanticTokensProviderShape {
range?: DocumentRangeSemanticTokensProvider;
full?: DocumentSemanticTokensProvider;
onDidChangeSemanticTokensEmitter: Emitter<void>;
}range?: DocumentRangeSemanticTokensProvider;Provider of range semantic tokens.
full?: DocumentSemanticTokensProvider;Provider of full document semantic tokens.
onDidChangeSemanticTokensEmitter: Emitter<void>;Emitter fired when semantic tokens change.
Interface exported by coc.nvim.
export interface InlineValueProviderShape {
provider: InlineValuesProvider;
onDidChangeInlineValues: Emitter<void>;
}provider: InlineValuesProvider;Provider of inline values.
onDidChangeInlineValues: Emitter<void>;Emitter fired when inline values change.
Interface exported by coc.nvim.
export interface InlayHintsProviderShape {
provider: InlayHintsProvider;
onDidChangeInlayHints: Emitter<void>;
}provider: InlayHintsProvider;Provider of inlay hints.
onDidChangeInlayHints: Emitter<void>;Emitter fired when inlay hints change.
Interface exported by coc.nvim.
export interface FoldingRangeProviderShape {
provider: FoldingRangeProvider;
onDidChangeFoldingRange: Emitter<void>;
}provider: FoldingRangeProvider;Provider of folding ranges.
onDidChangeFoldingRange: Emitter<void>;Emitter fired when folding ranges change.
Interface exported by coc.nvim.
export interface DiagnosticProviderShape {
onDidChangeDiagnosticsEmitter: Emitter<void>;
diagnostics: DiagnosticProvider;
forget(document: TextDocument): void;
}onDidChangeDiagnosticsEmitter: Emitter<void>;An event that signals that the diagnostics should be refreshed for all documents.
diagnostics: DiagnosticProvider;The provider of diagnostics.
forget(document: TextDocument): void;Forget the given document and remove all diagnostics.
Interface exported by coc.nvim.
export interface DiagnosticFeatureShape {
refresh(): void;
}refresh(): void;Refresh all diagnostics.
A language server for manage a language server.
It's recommended to use services.registerLanguageClient to register language client to serviers,
you can have language client listed in CocList services and services could start the language client
by documentselector of clientOptions.
export class LanguageClient {
readonly id: string;
readonly name: string;
constructor(id: string, name: string, serverOptions: ServerOptions, clientOptions: LanguageClientOptions, forceDebug?: boolean);
constructor(name: string, serverOptions: ServerOptions, clientOptions: LanguageClientOptions, forceDebug?: boolean);
sendRequest<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO> | RequestProtocolSignature0<R, PR, E, RO>, token?: CancellationToken): Promise<R>;
sendRequest<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO> | RequestProtocolSignature<P, R, PR, E, RO>, params: P, token?: CancellationToken): Promise<R>;
sendRequest<R, E>(type: RequestType0<R, E> | RequestSignature0<R, E>, token?: CancellationToken): Promise<R>;
sendRequest<P, R, E>(type: RequestType<P, R, E> | RequestSignature<P, R, E>, params: P, token?: CancellationToken): Promise<R>;
sendRequest<R>(method: string, token?: CancellationToken): Promise<R>;
sendRequest<R>(method: string, param: any, token?: CancellationToken): Promise<R>;
onRequest<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, handler: RequestHandler0<R, E>): Disposable;
onRequest<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO>, handler: RequestHandler<P, R, E>): Disposable;
onRequest<R, E>(type: RequestType0<R, E>, handler: RequestHandler0<R, E>): Disposable;
onRequest<P, R, E>(type: RequestType<P, R, E>, handler: RequestHandler<P, R, E>): Disposable;
onRequest<R, E>(method: string, handler: (...params: any[]) => HandlerResult<R, E>): Disposable;
sendNotification<RO>(type: ProtocolNotificationType0<RO> | NotificationProtocolSignature0<RO>): Promise<void>;
sendNotification<P, RO>(type: ProtocolNotificationType<P, RO> | NotificationSignature<P>, params?: P): Promise<void>;
sendNotification(type: NotificationType0 | NotificationSignature0): Promise<void>;
sendNotification<P>(type: NotificationType<P> | NotificationSignature<P>, params?: P): Promise<void>;
sendNotification(method: string): Promise<void>;
sendNotification(method: string, params: any): Promise<void>;
onNotification<RO>(type: ProtocolNotificationType0<RO>, handler: NotificationHandler0): Disposable;
onNotification<P, RO>(type: ProtocolNotificationType<P, RO>, handler: NotificationHandler<P>): Disposable;
onNotification(type: NotificationType0, handler: () => void): Disposable;
onNotification<P>(type: NotificationType<P>, handler: (params: P) => void): Disposable;
onNotification(method: string, handler: (...params: any[]) => void): Disposable;
onProgress<P>(type: ProgressType<any>, token: string | number, handler: (params: P) => void): Disposable;
sendProgress<P>(type: ProgressType<P>, token: string | number, value: P): Promise<void>;
debug(message: string, data?: any, showNotification?: boolean): void;
info(message: string, data?: any, showNotification?: boolean): void;
warn(message: string, data?: any, showNotification?: boolean): void;
error(message: string, data?: any, showNotification?: boolean | 'force'): void;
traceMessage(message: string, data?: any): void;
readonly state: State;
readonly middleware: Middleware;
readonly initializeResult: InitializeResult | undefined;
readonly clientOptions: LanguageClientOptions;
readonly outputChannel: OutputChannel;
readonly onDidChangeState: Event<StateChangeEvent>;
readonly diagnostics: DiagnosticCollection | undefined;
readonly serviceState: ClientState;
readonly started: boolean;
readonly isInDebugMode: boolean;
needsStart(): boolean;
needsStop(): boolean;
onReady(): Promise<void>;
set trace(value: Trace);
isRunning(): boolean;
stop(): Promise<void>;
start(): Promise<void>;
restart(): Promise<void>;
dispose(): Promise<void>;
registerFeature(feature: StaticFeature | DynamicFeature<any>): void;
handleFailedRequest<T, P extends {
method: string;
}>(type: P, token: CancellationToken | undefined, error: any, defaultValue: T, showNotification?: boolean): T;
createDefaultErrorHandler(maxRestartCount?: number): ErrorHandler;
getFeature(request: 'workspace/executeCommand'): DynamicFeature<GeneralRegistrationOptions>;
getFeature(request: 'workspace/didChangeWorkspaceFolders'): DynamicFeature<void>;
getFeature(request: 'workspace/didChangeWatchedFiles'): DynamicFeature<DidChangeWatchedFilesRegistrationOptions>;
getFeature(request: 'workspace/didChangeConfiguration'): DynamicFeature<DidChangeConfigurationRegistrationOptions>;
getFeature(request: 'textDocument/didOpen'): DidOpenTextDocumentFeatureShape;
getFeature(request: 'textDocument/didChange'): DidChangeTextDocumentFeatureShape;
getFeature(request: 'textDocument/willSave'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentSendFeature<(textDocument: TextDocumentWillSaveEvent) => Promise<void>>;
getFeature(request: 'textDocument/willSaveWaitUntil'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentSendFeature<(textDocument: TextDocument) => ProviderResult<TextEdit[]>>;
getFeature(request: 'textDocument/didSave'): DidSaveTextDocumentFeatureShape;
getFeature(request: 'textDocument/didClose'): DidCloseTextDocumentFeatureShape;
getFeature(request: 'workspace/didCreateFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileCreateEvent) => Promise<void>;
};
getFeature(request: 'workspace/didRenameFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileRenameEvent) => Promise<void>;
};
getFeature(request: 'workspace/didDeleteFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileDeleteEvent) => Promise<void>;
};
getFeature(request: 'workspace/willCreateFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileWillCreateEvent) => Promise<void>;
};
getFeature(request: 'workspace/willRenameFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileWillRenameEvent) => Promise<void>;
};
getFeature(request: 'workspace/willDeleteFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileWillDeleteEvent) => Promise<void>;
};
getFeature(request: 'workspace/symbol'): DynamicFeature<TextDocumentRegistrationOptions> & WorkspaceProviderFeature<WorkspaceSymbolProvider>;
getFeature(request: 'textDocument/completion'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CompletionItemProvider>;
getFeature(request: 'textDocument/hover'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<HoverProvider>;
getFeature(request: 'textDocument/signatureHelp'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<SignatureHelpProvider>;
getFeature(request: 'textDocument/definition'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DefinitionProvider>;
getFeature(request: 'textDocument/references'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<ReferenceProvider>;
getFeature(request: 'textDocument/documentHighlight'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentHighlightProvider>;
getFeature(request: 'textDocument/codeAction'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CodeActionProvider>;
getFeature(request: 'textDocument/codeLens'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CodeLensProviderShape>;
getFeature(request: 'textDocument/formatting'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentFormattingEditProvider>;
getFeature(request: 'textDocument/rangeFormatting'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentRangeFormattingEditProvider>;
getFeature(request: 'textDocument/onTypeFormatting'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<OnTypeFormattingEditProvider>;
getFeature(request: 'textDocument/rename'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<RenameProvider>;
getFeature(request: 'textDocument/documentSymbol'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentSymbolProvider>;
getFeature(request: 'textDocument/documentLink'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentLinkProvider>;
getFeature(request: 'textDocument/documentColor'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentColorProvider>;
getFeature(request: 'textDocument/declaration'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DeclarationProvider>;
getFeature(request: 'textDocument/foldingRange'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<FoldingRangeProviderShape>;
getFeature(request: 'textDocument/implementation'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<ImplementationProvider>;
getFeature(request: 'textDocument/selectionRange'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<SelectionRangeProvider>;
getFeature(request: 'textDocument/typeDefinition'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<TypeDefinitionProvider>;
getFeature(request: 'textDocument/prepareCallHierarchy'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CallHierarchyProvider>;
getFeature(request: 'textDocument/semanticTokens'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<SemanticTokensProviderShape>;
getFeature(request: 'textDocument/linkedEditingRange'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<LinkedEditingRangeProvider>;
getFeature(request: 'textDocument/prepareTypeHierarchy'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<TypeHierarchyProvider>;
getFeature(request: 'textDocument/inlineValue'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<InlineValueProviderShape>;
getFeature(request: 'textDocument/inlayHint'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<InlayHintsProviderShape>;
getFeature(request: 'textDocument/diagnostic'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DiagnosticProviderShape> & DiagnosticFeatureShape;
getFeature(request: 'workspace/textDocumentContent'): DynamicFeature<TextDocumentRegistrationOptions> & WorkspaceProviderFeature<TextDocumentContentProviderShape>;
getFeature(request: 'textDocument/inlineCompletion'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<InlineCompletionItemProvider>;
}readonly id: string;Id of the language client.
readonly name: string;Name of the language client.
constructor(id: string, name: string, serverOptions: ServerOptions, clientOptions: LanguageClientOptions, forceDebug?: boolean);constructor(name: string, serverOptions: ServerOptions, clientOptions: LanguageClientOptions, forceDebug?: boolean);Create language client by name and options, don't forget to register language client
to services by services.registerLanguageClient
sendRequest<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO> | RequestProtocolSignature0<R, PR, E, RO>, token?: CancellationToken): Promise<R>;Send a request to the language server.
sendRequest<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO> | RequestProtocolSignature<P, R, PR, E, RO>, params: P, token?: CancellationToken): Promise<R>;Send a request to the language server.
sendRequest<R, E>(type: RequestType0<R, E> | RequestSignature0<R, E>, token?: CancellationToken): Promise<R>;Send a request to the language server.
sendRequest<P, R, E>(type: RequestType<P, R, E> | RequestSignature<P, R, E>, params: P, token?: CancellationToken): Promise<R>;Send a request to the language server.
sendRequest<R>(method: string, token?: CancellationToken): Promise<R>;Send a request to the language server by method name.
sendRequest<R>(method: string, param: any, token?: CancellationToken): Promise<R>;Send a request to the language server by method name with parameters.
onRequest<R, PR, E, RO>(type: ProtocolRequestType0<R, PR, E, RO>, handler: RequestHandler0<R, E>): Disposable;Register a request handler for requests from the language server.
onRequest<P, R, PR, E, RO>(type: ProtocolRequestType<P, R, PR, E, RO>, handler: RequestHandler<P, R, E>): Disposable;Register a request handler for requests from the language server.
onRequest<R, E>(type: RequestType0<R, E>, handler: RequestHandler0<R, E>): Disposable;Register a request handler for requests from the language server.
onRequest<P, R, E>(type: RequestType<P, R, E>, handler: RequestHandler<P, R, E>): Disposable;Register a request handler for requests from the language server.
onRequest<R, E>(method: string, handler: (...params: any[]) => HandlerResult<R, E>): Disposable;Register a request handler by method name.
sendNotification<RO>(type: ProtocolNotificationType0<RO> | NotificationProtocolSignature0<RO>): Promise<void>;Send a notification to the language server.
sendNotification<P, RO>(type: ProtocolNotificationType<P, RO> | NotificationSignature<P>, params?: P): Promise<void>;Send a notification to the language server.
sendNotification(type: NotificationType0 | NotificationSignature0): Promise<void>;Send a notification to the language server.
sendNotification<P>(type: NotificationType<P> | NotificationSignature<P>, params?: P): Promise<void>;Send a notification to the language server.
sendNotification(method: string): Promise<void>;Send a notification to the language server by method name.
sendNotification(method: string, params: any): Promise<void>;Send a notification to the language server by method name with parameters.
onNotification<RO>(type: ProtocolNotificationType0<RO>, handler: NotificationHandler0): Disposable;Register a notification handler for notifications from the language server.
onNotification<P, RO>(type: ProtocolNotificationType<P, RO>, handler: NotificationHandler<P>): Disposable;Register a notification handler for notifications from the language server.
onNotification(type: NotificationType0, handler: () => void): Disposable;Register a notification handler for notifications from the language server.
onNotification<P>(type: NotificationType<P>, handler: (params: P) => void): Disposable;Register a notification handler for notifications from the language server.
onNotification(method: string, handler: (...params: any[]) => void): Disposable;Register a notification handler by method name.
onProgress<P>(type: ProgressType<any>, token: string | number, handler: (params: P) => void): Disposable;Register a progress handler for progress reports from the language server.
sendProgress<P>(type: ProgressType<P>, token: string | number, value: P): Promise<void>;Send a progress report to the language server.
debug(message: string, data?: any, showNotification?: boolean): void;Append debug message to outputChannel
info(message: string, data?: any, showNotification?: boolean): void;Append info message to outputChannel
warn(message: string, data?: any, showNotification?: boolean): void;Append warning message to outputChannel
error(message: string, data?: any, showNotification?: boolean | 'force'): void;Append error message to outputChannel
traceMessage(message: string, data?: any): void;Append trace message to traceOutputChannel or outputChannel
readonly state: State;Current state of the language client.
readonly middleware: Middleware;Middleware of the language client.
readonly initializeResult: InitializeResult | undefined;Result of the initialize request.
readonly clientOptions: LanguageClientOptions;Options of the language client.
readonly outputChannel: OutputChannel;Output channel of the language client.
readonly onDidChangeState: Event<StateChangeEvent>;Fired on language server state change.
readonly diagnostics: DiagnosticCollection | undefined;Diagnostic collection of the language client.
readonly serviceState: ClientState;Current running state.
readonly started: boolean;Whether the language client has been started.
readonly isInDebugMode: boolean;The server is running in debug mode by forceDebug or debug arguments of NodeJS.
needsStart(): boolean;Check if server could start.
needsStop(): boolean;Check if server could stop.
onReady(): Promise<void>;Resolved when server ready
set trace(value: Trace);Set the trace level of the language client.
isRunning(): boolean;Return true when the client is running.
stop(): Promise<void>;Stop language server.
start(): Promise<void>;Start language server, not needed when registered to services by services.registerLanguageClient
restart(): Promise<void>;Restart language client.
dispose(): Promise<void>;Dispose the language client.
registerFeature(feature: StaticFeature | DynamicFeature<any>): void;Register custom feature.
handleFailedRequest<T, P extends {
method: string;
}>(type: P, token: CancellationToken | undefined, error: any, defaultValue: T, showNotification?: boolean): T;Log failed request to outputChannel and throw error when necessary.
createDefaultErrorHandler(maxRestartCount?: number): ErrorHandler;Create a default error handler.
getFeature(request: 'workspace/executeCommand'): DynamicFeature<GeneralRegistrationOptions>;Get the feature handling workspace/executeCommand, with registration for general registration options.
getFeature(request: 'workspace/didChangeWorkspaceFolders'): DynamicFeature<void>;Get the feature handling workspace/didChangeWorkspaceFolders.
getFeature(request: 'workspace/didChangeWatchedFiles'): DynamicFeature<DidChangeWatchedFilesRegistrationOptions>;Get the feature handling workspace/didChangeWatchedFiles, with registration for watched files.
getFeature(request: 'workspace/didChangeConfiguration'): DynamicFeature<DidChangeConfigurationRegistrationOptions>;Get the feature handling workspace/didChangeConfiguration, with registration for configuration sections.
getFeature(request: 'textDocument/didOpen'): DidOpenTextDocumentFeatureShape;Get the feature handling textDocument/didOpen, sending open notifications for text documents.
getFeature(request: 'textDocument/didChange'): DidChangeTextDocumentFeatureShape;Get the feature handling textDocument/didChange, sending change notifications for text documents.
getFeature(request: 'textDocument/willSave'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentSendFeature<(textDocument: TextDocumentWillSaveEvent) => Promise<void>>;Get the feature handling textDocument/willSave, sending will-save notifications.
getFeature(request: 'textDocument/willSaveWaitUntil'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentSendFeature<(textDocument: TextDocument) => ProviderResult<TextEdit[]>>;Get the feature handling textDocument/willSaveWaitUntil, sending will-save-wait-until requests that return edits.
getFeature(request: 'textDocument/didSave'): DidSaveTextDocumentFeatureShape;Get the feature handling textDocument/didSave, sending save notifications.
getFeature(request: 'textDocument/didClose'): DidCloseTextDocumentFeatureShape;Get the feature handling textDocument/didClose, sending close notifications.
getFeature(request: 'workspace/didCreateFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileCreateEvent) => Promise<void>;
};Get the feature handling workspace/didCreateFiles, sending file create events.
getFeature(request: 'workspace/didRenameFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileRenameEvent) => Promise<void>;
};Get the feature handling workspace/didRenameFiles, sending file rename events.
getFeature(request: 'workspace/didDeleteFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileDeleteEvent) => Promise<void>;
};Get the feature handling workspace/didDeleteFiles, sending file delete events.
getFeature(request: 'workspace/willCreateFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileWillCreateEvent) => Promise<void>;
};Get the feature handling workspace/willCreateFiles, sending file will-create events.
getFeature(request: 'workspace/willRenameFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileWillRenameEvent) => Promise<void>;
};Get the feature handling workspace/willRenameFiles, sending file will-rename events.
getFeature(request: 'workspace/willDeleteFiles'): DynamicFeature<GeneralRegistrationOptions> & {
send: (event: FileWillDeleteEvent) => Promise<void>;
};Get the feature handling workspace/willDeleteFiles, sending file will-delete events.
getFeature(request: 'workspace/symbol'): DynamicFeature<TextDocumentRegistrationOptions> & WorkspaceProviderFeature<WorkspaceSymbolProvider>;Get the feature handling workspace/symbol, providing workspace symbol providers.
getFeature(request: 'textDocument/completion'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CompletionItemProvider>;Get the feature handling textDocument/completion, providing completion item providers.
getFeature(request: 'textDocument/hover'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<HoverProvider>;Get the feature handling textDocument/hover, providing hover providers.
getFeature(request: 'textDocument/signatureHelp'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<SignatureHelpProvider>;Get the feature handling textDocument/signatureHelp, providing signature help providers.
getFeature(request: 'textDocument/definition'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DefinitionProvider>;Get the feature handling textDocument/definition, providing definition providers.
getFeature(request: 'textDocument/references'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<ReferenceProvider>;Get the feature handling textDocument/references, providing reference providers.
getFeature(request: 'textDocument/documentHighlight'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentHighlightProvider>;Get the feature handling textDocument/documentHighlight, providing document highlight providers.
getFeature(request: 'textDocument/codeAction'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CodeActionProvider>;Get the feature handling textDocument/codeAction, providing code action providers.
getFeature(request: 'textDocument/codeLens'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CodeLensProviderShape>;Get the feature handling textDocument/codeLens, providing code lens providers.
getFeature(request: 'textDocument/formatting'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentFormattingEditProvider>;Get the feature handling textDocument/formatting, providing document formatting edit providers.
getFeature(request: 'textDocument/rangeFormatting'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentRangeFormattingEditProvider>;Get the feature handling textDocument/rangeFormatting, providing range formatting edit providers.
getFeature(request: 'textDocument/onTypeFormatting'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<OnTypeFormattingEditProvider>;Get the feature handling textDocument/onTypeFormatting, providing on-type formatting edit providers.
getFeature(request: 'textDocument/rename'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<RenameProvider>;Get the feature handling textDocument/rename, providing rename providers.
getFeature(request: 'textDocument/documentSymbol'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentSymbolProvider>;Get the feature handling textDocument/documentSymbol, providing document symbol providers.
getFeature(request: 'textDocument/documentLink'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentLinkProvider>;Get the feature handling textDocument/documentLink, providing document link providers.
getFeature(request: 'textDocument/documentColor'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentColorProvider>;Get the feature handling textDocument/documentColor, providing document color providers.
getFeature(request: 'textDocument/declaration'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DeclarationProvider>;Get the feature handling textDocument/declaration, providing declaration providers.
getFeature(request: 'textDocument/foldingRange'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<FoldingRangeProviderShape>;Get the feature handling textDocument/foldingRange, providing folding range providers.
getFeature(request: 'textDocument/implementation'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<ImplementationProvider>;Get the feature handling textDocument/implementation, providing implementation providers.
getFeature(request: 'textDocument/selectionRange'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<SelectionRangeProvider>;Get the feature handling textDocument/selectionRange, providing selection range providers.
getFeature(request: 'textDocument/typeDefinition'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<TypeDefinitionProvider>;Get the feature handling textDocument/typeDefinition, providing type definition providers.
getFeature(request: 'textDocument/prepareCallHierarchy'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CallHierarchyProvider>;Get the feature handling textDocument/prepareCallHierarchy, providing call hierarchy providers.
getFeature(request: 'textDocument/semanticTokens'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<SemanticTokensProviderShape>;Get the feature handling textDocument/semanticTokens, providing semantic tokens providers.
getFeature(request: 'textDocument/linkedEditingRange'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<LinkedEditingRangeProvider>;Get the feature handling textDocument/linkedEditingRange, providing linked editing range providers.
getFeature(request: 'textDocument/prepareTypeHierarchy'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<TypeHierarchyProvider>;Get the feature handling textDocument/prepareTypeHierarchy, providing type hierarchy providers.
getFeature(request: 'textDocument/inlineValue'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<InlineValueProviderShape>;Get the feature handling textDocument/inlineValue, providing inline value providers.
getFeature(request: 'textDocument/inlayHint'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<InlayHintsProviderShape>;Get the feature handling textDocument/inlayHint, providing inlay hint providers.
getFeature(request: 'textDocument/diagnostic'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DiagnosticProviderShape> & DiagnosticFeatureShape;Get the feature handling textDocument/diagnostic, providing diagnostic providers with refresh support.
getFeature(request: 'workspace/textDocumentContent'): DynamicFeature<TextDocumentRegistrationOptions> & WorkspaceProviderFeature<TextDocumentContentProviderShape>;Get the feature handling workspace/textDocumentContent, providing text document content providers.
getFeature(request: 'textDocument/inlineCompletion'): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<InlineCompletionItemProvider>;Get the feature handling textDocument/inlineCompletion, providing inline completion item providers.
Monitor for setting change, restart language server when specified setting changed.
export class SettingMonitor {
constructor(client: LanguageClient, setting: string);
start(): Disposable;
}constructor(client: LanguageClient, setting: string);start(): Disposable;Start monitoring the setting and start the client when it is enabled.