Skip to main content
Complete API

Typings Reference

All 759 public coc.nvim APIs in one continuous document. Use the menu or URL hash to move between modules and declarations without loading another page.

Generated from typings/index.d.ts @ 555f5ceon

API module

types API

All 554 public APIs exported from the types module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

types

DocumentUri

A tagging type for string properties that are actually document URIs.

Source

Type definition

export type DocumentUri = string;
Kind
type alias
Declaration
typings/index.d.ts:16
types

integer

Defines an integer in the range of -2^31 to 2^31 - 1.

Source

Type definition

export type integer = number;
Kind
type alias
Declaration
typings/index.d.ts:24
types

uinteger

Defines an unsigned integer in the range of 0 to 2^31 - 1.

Source

Type definition

export type uinteger = number;
Kind
type alias
Declaration
typings/index.d.ts:33
types

decimal

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.

Source

Type definition

export type decimal = number;
Kind
type alias
Declaration
typings/index.d.ts:46
types

LSPAny

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.

Source

Type definition

export type LSPAny = any;
Kind
type alias
Declaration
typings/index.d.ts:70
types

LSPObject

Type alias exported by coc.nvim.

Source

Type definition

export type LSPObject = object;
Kind
type alias
Declaration
typings/index.d.ts:71
types

LSPArray

Type alias exported by coc.nvim.

Source

Type definition

export type LSPArray = any[];
Kind
type alias
Declaration
typings/index.d.ts:72
types

Position

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.

Source

Interface definition

export interface Position {
    line: uinteger;
    character: uinteger;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:102
types

Range

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 }
}
Source

Interface definition

export interface Range {
    start: Position;
    end: Position;
}

Members

start: Position;

The range's start position.

end: Position;

The range's end position.

Kind
interface
Declaration
typings/index.d.ts:150
types

Location

Represents a location inside a resource, such as a line inside a text file.

Source

Interface definition

export interface Location {
    uri: DocumentUri;
    range: Range;
}

Members

uri: DocumentUri;

The document URI of the location.

range: Range;

The range of the location.

Kind
interface
Declaration
typings/index.d.ts:188
types

Color

Represents a color in RGBA space.

Source

Interface definition

export interface Color {
    readonly red: decimal;
    readonly green: decimal;
    readonly blue: decimal;
    readonly alpha: decimal;
}

Members

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].

Kind
interface
Declaration
typings/index.d.ts:263
types

ColorInformation

Represents a color range from a document.

Source

Interface definition

export interface ColorInformation {
    range: Range;
    color: Color;
}

Members

range: Range;

The range in the document where this color appears.

color: Color;

The actual color value for this color range.

Kind
interface
Declaration
typings/index.d.ts:298
types

ColorPresentation

Interface exported by coc.nvim.

Source

Interface definition

export interface ColorPresentation {
    label: string;
    textEdit?: TextEdit;
    additionalTextEdits?: TextEdit[];
}

Members

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;

An edit which is applied to a document when selecting this presentation for the color. When falsy the label is used.

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.

Kind
interface
Declaration
typings/index.d.ts:322
types

FoldingRangeKind

A predefined folding range kind.

The type is a string since the value set is extensible

Source

Type definition

export type FoldingRangeKind = string;
Kind
type alias
Declaration
typings/index.d.ts:377
types

FoldingRange

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.

Source

Interface definition

export interface FoldingRange {
    startLine: uinteger;
    startCharacter?: uinteger;
    endLine: uinteger;
    endCharacter?: uinteger;
    kind?: FoldingRangeKind;
    collapsedText?: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:382
types

DiagnosticRelatedInformation

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.

Source

Interface definition

export interface DiagnosticRelatedInformation {
    location: Location;
    message: string;
}

Members

location: Location;

The location of this related diagnostic information.

message: string;

The message of this related diagnostic information.

Kind
interface
Declaration
typings/index.d.ts:435
types

DiagnosticSeverity

Type alias exported by coc.nvim.

Source

Type definition

export type DiagnosticSeverity = 1 | 2 | 3 | 4;
Kind
type alias
Declaration
typings/index.d.ts:480
types

DiagnosticTag

Type alias exported by coc.nvim.

Source

Type definition

export type DiagnosticTag = 1 | 2;
Kind
type alias
Declaration
typings/index.d.ts:501
types

CodeDescription

Structure to capture a description for an error code.

Source

Interface definition

export interface CodeDescription {
    href: string;
}

Members

href: string;

An URI to open with more information about the diagnostic error.

Kind
interface
Declaration
typings/index.d.ts:507
types

Diagnostic

Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource.

Source

Interface definition

export interface Diagnostic {
    range: Range;
    severity?: DiagnosticSeverity;
    code?: integer | string;
    codeDescription?: CodeDescription;
    source?: string;
    message: string;
    tags?: DiagnosticTag[];
    relatedInformation?: DiagnosticRelatedInformation[];
    data?: LSPAny;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:525
types

Command

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.

Source

Interface definition

export interface Command {
    title: string;
    command: string;
    arguments?: LSPAny[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:614
types

TextEdit

A text edit applicable to a text document.

Source

Interface definition

export interface TextEdit {
    range: Range;
    newText: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:646
types

ChangeAnnotation

Additional information that describes document changes.

Source

Interface definition

export interface ChangeAnnotation {
    label: string;
    needsConfirmation?: boolean;
    description?: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:687
types

ChangeAnnotationIdentifier

An identifier to refer to a change annotation stored with a workspace edit.

Source

Type definition

export type ChangeAnnotationIdentifier = string;
Kind
type alias
Declaration
typings/index.d.ts:714
types

TextDocumentEdit

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.

Source

Interface definition

export interface TextDocumentEdit {
    textDocument: OptionalVersionedTextDocumentIdentifier;
    edits: (TextEdit | AnnotatedTextEdit | SnippetTextEdit)[];
}

Members

textDocument: OptionalVersionedTextDocumentIdentifier;

The text document to change.

edits: (TextEdit | AnnotatedTextEdit | SnippetTextEdit)[];

The edits to be applied.

Kind
interface
Declaration
typings/index.d.ts:758
types

CreateFileOptions

Options to create a file.

Source

Interface definition

export interface CreateFileOptions {
    overwrite?: boolean;
    ignoreIfExists?: boolean;
}

Members

overwrite?: boolean;

Overwrite existing file. Overwrite wins over ignoreIfExists

ignoreIfExists?: boolean;

Ignore if exists.

Kind
interface
Declaration
typings/index.d.ts:803
types

RenameFileOptions

Rename file options

Source

Interface definition

export interface RenameFileOptions {
    overwrite?: boolean;
    ignoreIfExists?: boolean;
}

Members

overwrite?: boolean;

Overwrite target if existing. Overwrite wins over ignoreIfExists

ignoreIfExists?: boolean;

Ignores if target exists.

Kind
interface
Declaration
typings/index.d.ts:837
types

DeleteFileOptions

Delete file options

Source

Interface definition

export interface DeleteFileOptions {
    recursive?: boolean;
    ignoreIfNotExists?: boolean;
}

Members

recursive?: boolean;

Delete the content recursively if a folder is denoted.

ignoreIfNotExists?: boolean;

Ignore the operation if the file doesn't exist.

Kind
interface
Declaration
typings/index.d.ts:875
types

WorkspaceEdit

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

Source

Interface definition

export interface WorkspaceEdit {
    changes?: {
        [uri: DocumentUri]: TextEdit[];
    };
    documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[];
    changeAnnotations?: {
        [id: ChangeAnnotationIdentifier]: ChangeAnnotation;
    };
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:920
types

TextEditChange

A change to capture text edits for existing resources.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:958
types

WorkspaceChange

A workspace change helps constructing changes to a workspace.

Source

Class definition

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;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:1020
types

TextDocumentIdentifier

A literal to identify a text document in the client.

Source

Interface definition

export interface TextDocumentIdentifier {
    uri: DocumentUri;
}

Members

uri: DocumentUri;

The text document's uri.

Kind
interface
Declaration
typings/index.d.ts:1066
types

OptionalVersionedTextDocumentIdentifier

A text document identifier to optionally denote a specific version of a text document.

Source

Interface definition

export interface OptionalVersionedTextDocumentIdentifier extends TextDocumentIdentifier {
    version: integer | null;
}

Members

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).

Kind
interface
Declaration
typings/index.d.ts:1115
types

TextDocumentItem

An item to transfer a text document from the client to the server.

Source

Interface definition

export interface TextDocumentItem {
    uri: DocumentUri;
    languageId: string;
    version: integer;
    text: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1145
types

MarkupKind

Type alias exported by coc.nvim.

Source

Type definition

export type MarkupKind = 'plaintext' | 'markdown';
Kind
type alias
Declaration
typings/index.d.ts:1203
types

MarkupContent

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.

Source

Interface definition

export interface MarkupContent {
    kind: MarkupKind;
    value: string;
}

Members

kind: MarkupKind;

The type of the Markup

value: string;

The content itself

Kind
interface
Declaration
typings/index.d.ts:1228
types

CompletionItemKind

Type alias exported by coc.nvim.

Source

Type definition

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;
Kind
type alias
Declaration
typings/index.d.ts:1274
types

InsertTextFormat

Type alias exported by coc.nvim.

Source

Type definition

export type InsertTextFormat = 1 | 2;
Kind
type alias
Declaration
typings/index.d.ts:1296
types

CompletionItemTag

Type alias exported by coc.nvim.

Source

Type definition

export type CompletionItemTag = 1;
Kind
type alias
Declaration
typings/index.d.ts:1309
types

InsertReplaceEdit

A special text edit to provide an insert and a replace operation.

Source

Interface definition

export interface InsertReplaceEdit {
    newText: string;
    insert: Range;
    replace: Range;
}

Members

newText: string;

The string to be inserted.

insert: Range;

The range if the insert is requested

replace: Range;

The range if the replace is requested.

Kind
interface
Declaration
typings/index.d.ts:1315
types

InsertTextMode

Type alias exported by coc.nvim.

Source

Type definition

export type InsertTextMode = 1 | 2;
Kind
type alias
Declaration
typings/index.d.ts:1370
types

CompletionItemLabelDetails

Additional details for a completion item label.

Source

Interface definition

export interface CompletionItemLabelDetails {
    detail?: string;
    description?: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1376
types

CompletionItem

A completion item represents a text snippet that is proposed to complete text that is being typed.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1395
types

CompletionList

Represents a collection of completion items to be presented in the editor.

Source

Interface definition

export interface CompletionList {
    isIncomplete: boolean;
    itemDefaults?: {
        commitCharacters?: string[];
        editRange?: Range | {
            insert: Range;
            replace: Range;
        };
        insertTextFormat?: InsertTextFormat;
        insertTextMode?: InsertTextMode;
        data?: LSPAny;
    };
    items: CompletionItem[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1567
types

MarkedString

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.

Source

Type definition

export type MarkedString = string | {
    language: string;
    value: string;
};
Kind
type alias
Declaration
typings/index.d.ts:1657
types

ParameterInformation

Represents a parameter of a callable-signature. A parameter can have a label and a doc-comment.

Source

Interface definition

export interface ParameterInformation {
    label: string | [
        uinteger,
        uinteger
    ];
    documentation?: string | MarkupContent;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1697
types

SignatureInformation

Represents the signature of something callable. A signature can have a label, like a function-name, a doc-comment, and a set of parameters.

Source

Interface definition

export interface SignatureInformation {
    label: string;
    documentation?: string | MarkupContent;
    parameters?: ParameterInformation[];
    activeParameter?: uinteger;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1733
types

SignatureHelp

Signature help represents the signature of something callable. There can be multiple signature but only one active and only one active parameter.

Source

Interface definition

export interface SignatureHelp {
    signatures: SignatureInformation[];
    activeSignature?: uinteger;
    activeParameter?: uinteger;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1769
types

Definition

The definition of a symbol represented as one or many locations. For most programming languages there is only one location at which a symbol is defined.

Servers should prefer returning DefinitionLink over Definition if supported by the client.

Source

Type definition

export type Definition = Location | Location[];
Kind
type alias
Declaration
typings/index.d.ts:1805
types

ReferenceContext

Value-object that contains additional information when requesting references.

Source

Interface definition

export interface ReferenceContext {
    includeDeclaration: boolean;
}

Members

includeDeclaration: boolean;

Include the declaration of the current symbol.

Kind
interface
Declaration
typings/index.d.ts:1831
types

DocumentHighlightKind

Type alias exported by coc.nvim.

Source

Type definition

export type DocumentHighlightKind = 1 | 2 | 3;
Kind
type alias
Declaration
typings/index.d.ts:1854
types

DocumentHighlight

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.

Source

Interface definition

export interface DocumentHighlight {
    range: Range;
    kind?: DocumentHighlightKind;
}

Members

range: Range;

The range this highlight applies to.

kind?: DocumentHighlightKind;

The highlight kind, default is text.

Kind
interface
Declaration
typings/index.d.ts:1860
types

SymbolKind

Type alias exported by coc.nvim.

Source

Type definition

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;
Kind
type alias
Declaration
typings/index.d.ts:1913
types

SymbolTag

Type alias exported by coc.nvim.

Source

Type definition

export type SymbolTag = 1;
Kind
type alias
Declaration
typings/index.d.ts:1925
types

BaseSymbolInformation

A base for all symbol information.

Source

Interface definition

export interface BaseSymbolInformation {
    name: string;
    kind: SymbolKind;
    tags?: SymbolTag[];
    containerName?: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1929
types

SymbolInformation

Represents information about programming constructs like variables, classes, interfaces etc.

Source

Interface definition

export interface SymbolInformation extends BaseSymbolInformation {
    deprecated?: boolean;
    location: Location;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1956
types

WorkspaceSymbol

A special workspace symbol that supports locations without a range.

See also SymbolInformation.

Source

Interface definition

export interface WorkspaceSymbol extends BaseSymbolInformation {
    location: Location | {
        uri: DocumentUri;
    };
    data?: LSPAny;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:1995
types

DocumentSymbol

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.

Source

Interface definition

export interface DocumentSymbol {
    name: string;
    detail?: string;
    kind: SymbolKind;
    tags?: SymbolTag[];
    deprecated?: boolean;
    range: Range;
    selectionRange: Range;
    children?: DocumentSymbol[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:2030
types

CodeActionKind

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.

Source

Type definition

export type CodeActionKind = string;
Kind
type alias
Declaration
typings/index.d.ts:2097
types

CodeActionTriggerKind

Type alias exported by coc.nvim.

Source

Type definition

export type CodeActionTriggerKind = 1 | 2;
Kind
type alias
Declaration
typings/index.d.ts:2208
types

CodeActionContext

Contains additional diagnostic information about the context in which a code action is run.

Source

Interface definition

export interface CodeActionContext {
    diagnostics: Diagnostic[];
    only?: CodeActionKind[];
    triggerKind?: CodeActionTriggerKind;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:2213
types

CodeAction

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.

Source

Interface definition

export interface CodeAction {
    title: string;
    kind?: CodeActionKind;
    diagnostics?: Diagnostic[];
    isPreferred?: boolean;
    disabled?: {
        reason: string;
    };
    edit?: WorkspaceEdit;
    command?: Command;
    data?: LSPAny;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:2256
types

CodeLens

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.

Source

Interface definition

export interface CodeLens {
    range: Range;
    command?: Command;
    data?: LSPAny;
}

Members

range: Range;

The range in which this code lens is valid. Should only span a single line.

command?: Command;

The command this code lens represents.

data?: LSPAny;

A data entry field that is preserved on a code lens item between a CodeLensRequest and a CodeLensResolveRequest.

Kind
interface
Declaration
typings/index.d.ts:2357
types

FormattingOptions

Value-object describing what options formatting should use.

Source

Interface definition

export interface FormattingOptions {
    tabSize: uinteger;
    insertSpaces: boolean;
    trimTrailingWhitespace?: boolean;
    insertFinalNewline?: boolean;
    trimFinalNewlines?: boolean;
    [key: string]: boolean | integer | string | undefined;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:2389
types

SelectionRange

A selection range represents a part of a selection hierarchy. A selection range may have a parent selection range that contains it.

Source

Interface definition

export interface SelectionRange {
    range: Range;
    parent?: SelectionRange;
}

Members

range: Range;

The range of this selection range.

parent?: SelectionRange;

The parent selection range containing this range. Therefore parent.range must contain this.range.

Kind
interface
Declaration
typings/index.d.ts:2482
types

CallHierarchyItem

Represents programming constructs like functions or constructors in the context of call hierarchy.

Source

Interface definition

export interface CallHierarchyItem {
    name: string;
    kind: SymbolKind;
    tags?: SymbolTag[];
    detail?: string;
    uri: DocumentUri;
    range: Range;
    selectionRange: Range;
    data?: LSPAny;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:2511
types

CallHierarchyIncomingCall

Represents an incoming call, e.g. a caller of a method or constructor.

Source

Interface definition

export interface CallHierarchyIncomingCall {
    from: CallHierarchyItem;
    fromRanges: Range[];
}

Members

from: CallHierarchyItem;

The item that makes the call.

fromRanges: Range[];

The ranges at which the calls appear. This is relative to the caller denoted by this.from.

Kind
interface
Declaration
typings/index.d.ts:2552
types

CallHierarchyOutgoingCall

Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.

Source

Interface definition

export interface CallHierarchyOutgoingCall {
    to: CallHierarchyItem;
    fromRanges: Range[];
}

Members

to: CallHierarchyItem;

The item that is called.

fromRanges: Range[];

The range at which this item is called. This is the range relative to the caller, e.g the item passed to provideCallHierarchyOutgoingCalls and not this.to.

Kind
interface
Declaration
typings/index.d.ts:2568
types

SemanticTokenTypes

A set of predefined token types. This set is not fixed an clients can specify additional token types via the corresponding client capabilities.

Source

Enum definition

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"
}

Members

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"
Kind
enum
Declaration
typings/index.d.ts:2587
types

SemanticTokenModifiers

A set of predefined token modifiers. This set is not fixed an clients can specify additional token types via the corresponding client capabilities.

Source

Enum definition

export enum SemanticTokenModifiers {
    declaration = "declaration",
    definition = "definition",
    readonly = "readonly",
    static = "static",
    deprecated = "deprecated",
    abstract = "abstract",
    async = "async",
    modification = "modification",
    documentation = "documentation",
    defaultLibrary = "defaultLibrary"
}

Members

declaration = "declaration"
definition = "definition"
readonly = "readonly"
static = "static"
deprecated = "deprecated"
abstract = "abstract"
async = "async"
modification = "modification"
documentation = "documentation"
defaultLibrary = "defaultLibrary"
Kind
enum
Declaration
typings/index.d.ts:2630
types

SemanticTokensLegend

Interface exported by coc.nvim.

Source

Interface definition

export interface SemanticTokensLegend {
    tokenTypes: string[];
    tokenModifiers: string[];
}

Members

tokenTypes: string[];

The token types a server uses.

tokenModifiers: string[];

The token modifiers a server uses.

Kind
interface
Declaration
typings/index.d.ts:2645
types

SemanticTokens

Interface exported by coc.nvim.

Source

Interface definition

export interface SemanticTokens {
    resultId?: string;
    data: uinteger[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:2658
types

SemanticTokensEdit

Interface exported by coc.nvim.

Source

Interface definition

export interface SemanticTokensEdit {
    start: uinteger;
    deleteCount: uinteger;
    data?: uinteger[];
}

Members

start: uinteger;

The start offset of the edit.

deleteCount: uinteger;

The count of elements to remove.

data?: uinteger[];

The elements to insert.

Kind
interface
Declaration
typings/index.d.ts:2680
types

SemanticTokensDelta

Interface exported by coc.nvim.

Source

Interface definition

export interface SemanticTokensDelta {
    readonly resultId?: string;
    edits: SemanticTokensEdit[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:2697
types

InlineValueText

Provide inline value as text.

Source

Type definition

export type InlineValueText = {
    range: Range;
    text: string;
};
Kind
type alias
Declaration
typings/index.d.ts:2756
types

InlineValueVariableLookup

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.

Source

Type definition

export type InlineValueVariableLookup = {
    range: Range;
    variableName?: string;
    caseSensitiveLookup: boolean;
};
Kind
type alias
Declaration
typings/index.d.ts:2785
types

InlineValueEvaluatableExpression

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.

Source

Type definition

export type InlineValueEvaluatableExpression = {
    range: Range;
    expression?: string;
};
Kind
type alias
Declaration
typings/index.d.ts:2819
types

InlineValue

Inline value information can be provided by different means:

  • directly as a text value (class InlineValueText).
  • as a name to use for a variable lookup (class InlineValueVariableLookup)
  • as an evaluatable expression (class InlineValueEvaluatableExpression) The InlineValue types combines all inline value types into one type.
Source

Type definition

export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression;
Kind
type alias
Declaration
typings/index.d.ts:2851
types

InlineValueContext

Type alias exported by coc.nvim.

Source

Type definition

export type InlineValueContext = {
    frameId: integer;
    stoppedLocation: Range;
};
Kind
type alias
Declaration
typings/index.d.ts:2855
types

InlayHintKind

Type alias exported by coc.nvim.

Source

Type definition

export type InlayHintKind = 1 | 2;
Kind
type alias
Declaration
typings/index.d.ts:2898
types

InlayHintLabelPart

An inlay hint label part allows for interactive and composite labels of inlay hints.

Source

Type definition

export type InlayHintLabelPart = {
    value: string;
    tooltip?: string | MarkupContent;
    location?: Location;
    command?: Command;
};
Kind
type alias
Declaration
typings/index.d.ts:2905
types

WorkspaceFolder

A workspace folder inside a client.

Source

Interface definition

export interface WorkspaceFolder {
    uri: string;
    name: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3005
types

TextDocument

A simple text document. Not to be implemented. The document keeps the content as string.

Source

Interface definition

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;
}

Members

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.

positionAt(offset: uinteger): Position;

Converts a zero-based offset to a position.

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.

Kind
interface
Declaration
typings/index.d.ts:3024
types

InlineCompletionOption

Interface exported by coc.nvim.

Source

Interface definition

export interface InlineCompletionOption {
    provider?: string;
    autoTrigger?: boolean;
}

Members

provider?: string;

The provider name, extension name or LanguageClient id.

autoTrigger?: boolean;

Set trigger kind to InlineCompletionTriggerKind.Automatic when true.

Kind
interface
Declaration
typings/index.d.ts:3099
types

InlineCompletionTriggerKind

Type alias exported by coc.nvim.

Source

Type definition

export type InlineCompletionTriggerKind = 1 | 2;
Kind
type alias
Declaration
typings/index.d.ts:3110
types

SelectedCompletionInfo

Describes the currently selected completion item.

Source

Type definition

export type SelectedCompletionInfo = {
    range: Range;
    text: string;
};
Kind
type alias
Declaration
typings/index.d.ts:3115
types

StringValue

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}.

Source

Type definition

export type StringValue = {
    kind: 'snippet';
    value: string;
};
Kind
type alias
Declaration
typings/index.d.ts:3157
types

InlineCompletionItem

An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.

Source

Interface definition

export interface InlineCompletionItem {
    insertText: string | StringValue;
    filterText?: string;
    range?: Range;
    command?: Command;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3175
types

ApplyKind

Defines how values from a set of defaults and an individual item will be merged.

Source

Type definition

export type ApplyKind = 1 | 2;
Kind
type alias
Declaration
typings/index.d.ts:3255
types

WorkspaceEditMetadata

Additional data about a workspace edit.

Source

Type definition

export type WorkspaceEditMetadata = {
    isRefactoring?: boolean;
};
Kind
type alias
Declaration
typings/index.d.ts:3260
types

ApplyWorkspaceEditParams

The parameters passed via an apply workspace edit request.

Source

Interface definition

export interface ApplyWorkspaceEditParams {
    label?: string;
    edit: WorkspaceEdit;
    metadata?: WorkspaceEditMetadata;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3269
types

ApplyWorkspaceEditResult

The result returned from the apply workspace edit request.

Source

Interface definition

export interface ApplyWorkspaceEditResult {
    applied: boolean;
    failureReason?: string;
    failedChange?: uinteger;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3292
types

Thenable

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;

Attaches callbacks for the resolution and/or rejection of the thenable.

then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;

Attaches a rejection callback to the thenable.

Kind
interface
Declaration
typings/index.d.ts:3313
types

Disposable

Interface exported by coc.nvim.

Source

Interface definition

export interface Disposable {
    dispose(): void;
}

Members

dispose(): void;

Dispose this object.

Kind
interface
Declaration
typings/index.d.ts:3325
types

TextDocumentContentChange

An event describing a change to a text document.

Source

Interface definition

export interface TextDocumentContentChange {
    range: Range;
    text: string;
}

Members

range: Range;

The range of the document that changed.

text: string;

The new text for the provided range.

Kind
interface
Declaration
typings/index.d.ts:3354
types

TextDocumentWillSaveEvent

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.

Source

Interface definition

export interface TextDocumentWillSaveEvent {
    document: LinesTextDocument;
    reason: 1 | 2 | 3;
}

Members

document: LinesTextDocument;

The document that will be saved.

reason: 1 | 2 | 3;

The reason why save was triggered.

Kind
interface
Declaration
typings/index.d.ts:3386
types

DocumentFilter

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)
Source

Type definition

export type DocumentFilter = {
    language: string;
    scheme?: string;
    pattern?: string;
} | {
    language?: string;
    scheme: string;
    pattern?: string;
} | {
    language?: string;
    scheme?: string;
    pattern: string;
};
Kind
type alias
Declaration
typings/index.d.ts:3415
types

DocumentSelector

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'.

Source

Type definition

export type DocumentSelector = DocumentFilter | string | ReadonlyArray<DocumentFilter | string>;
Kind
type alias
Declaration
typings/index.d.ts:3450
types

SignatureHelpTriggerKind

Type alias exported by coc.nvim.

Source

Type definition

export type SignatureHelpTriggerKind = 1 | 2 | 3;
Kind
type alias
Declaration
typings/index.d.ts:3470
types

SignatureHelpContext

Additional information about the context in which a signature help request was triggered.

Source

Interface definition

export interface SignatureHelpContext {
    triggerKind: SignatureHelpTriggerKind;
    triggerCharacter?: string;
    isRetrigger: boolean;
    activeSignatureHelp?: SignatureHelp;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3477
types

CompletionTriggerKind

Type alias exported by coc.nvim.

Source

Type definition

export type CompletionTriggerKind = 1 | 2 | 3;
Kind
type alias
Declaration
typings/index.d.ts:3524
types

CompletionContext

Contains additional information about the context in which a completion request is triggered.

Source

Interface definition

export interface CompletionContext {
    triggerKind: CompletionTriggerKind;
    triggerCharacter?: string;
    option: CompleteOption;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3529
types

Event

Represents a typed event.

A function that represents an event to which you subscribe by calling it with a listener function as argument.

Source

Interface definition

export interface Event<T> {
    (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
}

Members

(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.

Kind
interface
Declaration
typings/index.d.ts:3555
types

EmitterOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface EmitterOptions {
    onFirstListenerAdd?: Function;
    onLastListenerRemove?: Function;
}

Members

onFirstListenerAdd?: Function;

Called when the first listener is added.

onLastListenerRemove?: Function;

Called when the last listener is removed.

Kind
interface
Declaration
typings/index.d.ts:3573
types

Emitter

Class exported by coc.nvim.

Source

Class definition

export class Emitter<T> {
    constructor(_options?: EmitterOptions | undefined);
    get event(): Event<T>;
    fire(event: T): any;
    dispose(): void;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:3584
types

CancellationToken

Defines a CancellationToken. This interface is not intended to be implemented. A CancellationToken must be created via a CancellationTokenSource.

Source

Interface definition

export interface CancellationToken {
    readonly isCancellationRequested: boolean;
    readonly onCancellationRequested: Event<any>;
}

Members

readonly isCancellationRequested: boolean;

Is true when the token has been cancelled, false otherwise.

readonly onCancellationRequested: Event<any>;

An event which fires upon cancellation.

Kind
interface
Declaration
typings/index.d.ts:3607
types

CancellationTokenSource

Class exported by coc.nvim.

Source

Class definition

export class CancellationTokenSource {
    get token(): CancellationToken;
    cancel(): void;
    dispose(): void;
}

Members

get token(): CancellationToken;

The cancellation token of this source.

cancel(): void;

Cancel the token, firing the cancellation event.

dispose(): void;

Dispose the source.

Kind
class
Declaration
typings/index.d.ts:3624
types

TextLine

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.

Source

Interface definition

export interface TextLine {
    readonly lineNumber: number;
    readonly text: string;
    readonly range: Range;
    readonly rangeIncludingLineBreak: Range;
    readonly firstNonWhitespaceCharacterIndex: number;
    readonly isEmptyOrWhitespace: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3645
types

LinesTextDocument

Interface exported by coc.nvim.

Source

Interface definition

export interface LinesTextDocument extends TextDocument {
    readonly length: number;
    readonly end: Position;
    readonly eol: boolean;
    readonly lines: ReadonlyArray<string>;
    lineAt(lineOrPos: number | Position): TextLine;
}

Members

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.

lineAt(lineOrPos: number | Position): TextLine;

Returns a text line denoted by the line number. Note that the returned object is not live and changes to the document are not reflected.

Kind
interface
Declaration
typings/index.d.ts:3679
types

LinkedEditingRanges

The result of a linked editing range request.

Source

Interface definition

export interface LinkedEditingRanges {
    ranges: Range[];
    wordPattern?: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3713
types

UniquenessLevel

Type alias exported by coc.nvim.

Source

Type definition

export type UniquenessLevel = 'document' | 'project' | 'group' | 'scheme' | 'global';
Kind
type alias
Declaration
typings/index.d.ts:3759
types

MonikerKind

Type alias exported by coc.nvim.

Source

Type definition

export type MonikerKind = 'import' | 'export' | 'local';
Kind
type alias
Declaration
typings/index.d.ts:3783
types

Moniker

Moniker definition to match LSIF 0.5 moniker definition.

Source

Interface definition

export interface Moniker {
    scheme: string;
    identifier: string;
    unique: UniquenessLevel;
    kind?: MonikerKind;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:3790
types

PreviousResultId

A previous result id in a workspace pull request.

Source

Type definition

export type PreviousResultId = {
    uri: string;
    value: string;
};
Kind
type alias
Declaration
typings/index.d.ts:3818
types

DocumentDiagnosticReportKind

Type alias exported by coc.nvim.

Source

Type definition

export type DocumentDiagnosticReportKind = 'full' | 'unchanged';
Kind
type alias
Declaration
typings/index.d.ts:3830
types

ErrorCodes

Type alias exported by coc.nvim.

Source

Type definition

export type ErrorCodes = number;
Kind
type alias
Declaration
typings/index.d.ts:3975
types

ResponseErrorLiteral

Interface exported by coc.nvim.

Source

Interface definition

export interface ResponseErrorLiteral<D = void> {
    code: number;
    message: string;
    data?: D;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4032
types

ResponseError

An error object return in a response in case a request has failed.

Source

Class definition

export class ResponseError<D = void> extends Error {
    readonly code: number;
    readonly data: D | undefined;
    constructor(code: number, message: string, data?: D);
    toJson(): ResponseErrorLiteral<D>;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:4052
types

Message

A language server message

Source

Interface definition

export interface Message {
    jsonrpc: string;
}

Members

jsonrpc: string;

The protocol version, always "2.0".

Kind
interface
Declaration
typings/index.d.ts:4071
types

ResponseMessage

A response message.

Source

Interface definition

export interface ResponseMessage extends Message {
    id: number | string | null;
    result?: string | number | boolean | object | any[] | null;
    error?: ResponseErrorLiteral<any>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4092
types

VimValue

Type alias exported by coc.nvim.

Source

Type definition

type VimValue = number | boolean | string | number[] | {
    [key: string]: any;
};
Kind
type alias
Declaration
typings/index.d.ts:4110
types

VimClientInfo

Interface exported by coc.nvim.

Source

Interface definition

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;
    };
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4118
types

UiAttachOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface UiAttachOptions {
    rgb?: boolean;
    ext_popupmenu?: boolean;
    ext_tabline?: boolean;
    ext_wildmenu?: boolean;
    ext_cmdline?: boolean;
    ext_linegrid?: boolean;
    ext_hlstate?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4166
types

ChanInfo

Interface exported by coc.nvim.

Source

Interface definition

export interface ChanInfo {
    id: number;
    stream: 'stdio' | 'stderr' | 'socket' | 'job';
    mode: 'bytes' | 'terminal' | 'rpc';
    pty?: number;
    buffer?: number;
    client?: VimClientInfo;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4197
types

VimCommandDescription

Returned by nvim_get_commands api.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4227
types

NvimFloatOptions

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4274
types

ExtmarkOptions

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4345
types

ExtmarkDetails

Interface exported by coc.nvim.

Source

Interface definition

export interface ExtmarkDetails {
    end_col: number;
    end_row: number;
    priority: number;
    hl_group?: string;
    virt_text?: [
        string,
        string
    ][];
    virt_lines?: [
        string,
        string | string
    ][][];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4412
types

NvimProc

Interface exported by coc.nvim.

Source

Interface definition

export interface NvimProc {
    ppid: number;
    name: string;
    pid: number;
}

Members

ppid: number;

Parent process id.

name: string;

Name of the process.

pid: number;

Process id.

Kind
interface
Declaration
typings/index.d.ts:4439
types

SignPlaceOption

Interface exported by coc.nvim.

Source

Interface definition

export interface SignPlaceOption {
    id?: number;
    group?: string;
    name: string;
    lnum: number;
    priority?: number;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4454
types

SignUnplaceOption

Interface exported by coc.nvim.

Source

Interface definition

export interface SignUnplaceOption {
    group?: string;
    id?: number;
}

Members

group?: string;

Sign group, default to the unnamed group.

id?: number;

Sign id, unplace all signs of the group when omitted.

Kind
interface
Declaration
typings/index.d.ts:4477
types

SignPlacedOption

Interface exported by coc.nvim.

Source

Interface definition

export interface SignPlacedOption {
    group?: string;
    id?: number;
    lnum?: number;
}

Members

group?: string;

Use '*' for all group, default to '' as unnamed group.

id?: number;

Sign id.

lnum?: number;

Line number.

Kind
interface
Declaration
typings/index.d.ts:4488
types

SignItem

Interface exported by coc.nvim.

Source

Interface definition

export interface SignItem {
    group: string;
    id: number;
    lnum: number;
    name: string;
    priority: number;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4503
types

HighlightItem

Interface exported by coc.nvim.

Source

Interface definition

export interface HighlightItem {
    hlGroup: string;
    lnum: number;
    colStart: number;
    colEnd: number;
}

Members

hlGroup: string;

Highlight group name.

lnum: number;

0 based

colStart: number;

0 based

colEnd: number;

0 based

Kind
interface
Declaration
typings/index.d.ts:4526
types

ExtendedHighlightItem

Interface exported by coc.nvim.

Source

Interface definition

export interface ExtendedHighlightItem extends HighlightItem {
    combine?: boolean;
    start_incl?: boolean;
    end_incl?: boolean;
}

Members

combine?: boolean;

Combine the highlight with the existing one.

start_incl?: boolean;

Start column is inclusive.

end_incl?: boolean;

End column is inclusive.

Kind
interface
Declaration
typings/index.d.ts:4545
types

HighlightOption

Interface exported by coc.nvim.

Source

Interface definition

export interface HighlightOption {
    start?: number;
    end?: number;
    priority?: number;
    changedtick?: number;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4560
types

BufferKeymapOption

All values default to false, see :h :map-arguments

Source

Interface definition

export interface BufferKeymapOption {
    desc?: string;
    noremap?: boolean;
    nowait?: boolean;
    silent?: boolean;
    script?: boolean;
    expr?: boolean;
    unique?: boolean;
    special?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4582
types

InsertKeymapText

Interface exported by coc.nvim.

Source

Interface definition

export interface InsertKeymapText {
    text: string;
}

Members

text: string;

Literal text to insert.

Kind
interface
Declaration
typings/index.d.ts:4618
types

InsertKeymapKey

Interface exported by coc.nvim.

Source

Interface definition

export interface InsertKeymapKey {
    key: string;
}

Members

key: string;

One special key in Vim key notation, for example <Left> or <C-G>.

Kind
interface
Declaration
typings/index.d.ts:4623
types

InsertKeymapOption

Interface exported by coc.nvim.

Source

Interface definition

export interface InsertKeymapOption {
    buffer?: number | boolean;
    arglist?: string[];
}

Members

buffer?: number | boolean;

Buffer number, or current buffer with true or 0.

arglist?: string[];

Vim expressions evaluated when the mapping is invoked.

Kind
interface
Declaration
typings/index.d.ts:4630
types

BufferHighlight

Interface exported by coc.nvim.

Source

Interface definition

export interface BufferHighlight {
    hlGroup?: string;
    srcId?: number;
    line?: number;
    colStart?: number;
    colEnd?: number;
}

Members

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

Kind
interface
Declaration
typings/index.d.ts:4637
types

BufferClearHighlight

Interface exported by coc.nvim.

Source

Interface definition

export interface BufferClearHighlight {
    srcId?: number;
    lineStart?: number;
    lineEnd?: number;
}

Members

srcId?: number;

Namespace to clear or -1 for ungrouped highlights.

lineStart?: number;

First line to clear.

lineEnd?: number;

Last line to clear.

Kind
interface
Declaration
typings/index.d.ts:4660
types

VirtualTextOption

Interface exported by coc.nvim.

Source

Interface definition

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';
}

Members

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

Kind
interface
Declaration
typings/index.d.ts:4675
types

AugroupOption

Interface exported by coc.nvim.

Source

Interface definition

export interface AugroupOption {
    clear?: boolean;
}

Members

clear?: boolean;

Clear the all autocmds before create autocmd group, default to true.

Kind
interface
Declaration
typings/index.d.ts:4706
types

AutocmdOption

Interface exported by coc.nvim.

Source

Interface definition

interface AutocmdOption {
    group?: string | number;
    pattern?: string | string[];
    buffer?: number;
    desc?: string;
    command?: string;
    once?: boolean;
    nested?: boolean;
    replace?: boolean;
}

Members

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()

Kind
interface
Declaration
typings/index.d.ts:4713
types

BaseApi

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:4748
types

Neovim

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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[]): Promise<unknown>;

Call a vim function.

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.

Kind
interface
Declaration
typings/index.d.ts:4819
types

Buffer

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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

Kind
interface
Declaration
typings/index.d.ts:5275
types

Window

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:5527
types

Tabpage

Interface exported by coc.nvim.

Source

Interface definition

export interface Tabpage extends BaseApi<Tabpage> {
    number: Promise<number>;
    valid: Promise<boolean>;
    windows: Promise<Window[]>;
    window: Promise<Window>;
}

Members

number: Promise<number>;

tabpage number.

valid: Promise<boolean>;

Is current tabpage valid.

windows: Promise<Window[]>;

Returns all windows of tabpage.

window: Promise<Window>;

Current window of tabpage.

Kind
interface
Declaration
typings/index.d.ts:5665
types

UriComponents

Interface exported by coc.nvim.

Source

Interface definition

export interface UriComponents {
    scheme: string;
    authority: string;
    path: string;
    query: string;
    fragment: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:5689
types

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
Source

Class definition

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;
}

Members

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.

  • Will not validate the path for invalid characters and semantics.
  • Will not look at the scheme of this URI.
  • The result shall not be used for display purposes but for accessing a file on disk.

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.

  • The result shall not be used for display purposes but for externalization or transport.
  • The result will be encoded using the percentage encoding and encoding happens mostly ignore the scheme-specific encoding rules.
toJSON(): UriComponents;

Serialize the URI to its components.

Kind
class
Declaration
typings/index.d.ts:5727
types

VimCompleteItem

See :h complete-items

Source

Interface definition

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[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:5863
types

CompleteDoneItem

Interface exported by coc.nvim.

Source

Interface definition

export interface CompleteDoneItem {
    readonly word: string;
    readonly abbr?: string;
    readonly source: string;
    readonly isSnippet: boolean;
    readonly kind?: string | CompletionItemKind;
    readonly menu?: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:5939
types

LocationListItem

Interface exported by coc.nvim.

Source

Interface definition

export interface LocationListItem {
    bufnr: number;
    lnum: number;
    end_lnum: number;
    col: number;
    end_col: number;
    text: string;
    type: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:5966
types

QuickfixItem

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:5997
types

ProviderResult

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
  }
}
Source

Type definition

export type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;
Kind
type alias
Declaration
typings/index.d.ts:6084
types

ProviderName

Supported provider names.

Source

Enum definition

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'
}

Members

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'
Kind
enum
Declaration
typings/index.d.ts:6093
types

CompletionItemProvider

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.

Source

Interface definition

export interface CompletionItemProvider {
    provideCompletionItems(document: LinesTextDocument, position: Position, token: CancellationToken, context?: CompletionContext): ProviderResult<CompletionItem[] | CompletionList>;
    resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6139
types

HoverProvider

The hover provider interface defines the contract between extensions and the hover-feature.

Source

Interface definition

export interface HoverProvider {
    provideHover(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Hover>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6179
types

DefinitionProvider

The definition provider interface defines the contract between extensions and the go to definition and peek definition features.

Source

Interface definition

export interface DefinitionProvider {
    provideDefinition(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}

Members

provideDefinition(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;

Provide the definition of the symbol at the given position and document.

Kind
interface
Declaration
typings/index.d.ts:6203
types

DeclarationProvider

The definition provider interface defines the contract between extensions and the go to definition and peek definition features.

Source

Interface definition

export interface DeclarationProvider {
    provideDeclaration(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}

Members

provideDeclaration(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;

Provide the declaration of the symbol at the given position and document.

Kind
interface
Declaration
typings/index.d.ts:6225
types

SignatureHelpProvider

The signature help provider interface defines the contract between extensions and the parameter hints-feature.

Source

Interface definition

export interface SignatureHelpProvider {
    provideSignatureHelp(document: LinesTextDocument, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;
}

Members

provideSignatureHelp(document: LinesTextDocument, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;

Provide help for the signature at the given position and document.

Kind
interface
Declaration
typings/index.d.ts:6240
types

TypeDefinitionProvider

The type definition provider defines the contract between extensions and the go to type definition feature.

Source

Interface definition

export interface TypeDefinitionProvider {
    provideTypeDefinition(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}

Members

provideTypeDefinition(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;

Provide the type definition of the symbol at the given position and document.

Kind
interface
Declaration
typings/index.d.ts:6262
types

ReferenceProvider

The reference provider interface defines the contract between extensions and the find references-feature.

Source

Interface definition

export interface ReferenceProvider {
    provideReferences(document: LinesTextDocument, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;
}

Members

provideReferences(document: LinesTextDocument, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;

Provide a set of project-wide references for the given position and document.

Kind
interface
Declaration
typings/index.d.ts:6283
types

FoldingContext

Folding context (for future use)

Source

Interface definition

export interface FoldingContext {
}
Kind
interface
Declaration
typings/index.d.ts:6305
types

FoldingRangeProvider

The folding range provider interface defines the contract between extensions and Folding in the editor.

Source

Interface definition

export interface FoldingRangeProvider {
    onDidChangeFoldingRanges?: Event<void>;
    provideFoldingRanges(document: LinesTextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6311
types

DocumentSymbolProvider

The document symbol provider interface defines the contract between extensions and the go to symbol-feature.

Source

Interface definition

export interface DocumentSymbolProvider {
    provideDocumentSymbols(document: LinesTextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
}

Members

provideDocumentSymbols(document: LinesTextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;

Provide symbol information for the given document.

Kind
interface
Declaration
typings/index.d.ts:6337
types

ImplementationProvider

The implementation provider interface defines the contract between extensions and the go to implementation feature.

Source

Interface definition

export interface ImplementationProvider {
    provideImplementation(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}

Members

provideImplementation(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;

Provide the implementations of the symbol at the given position and document.

Kind
interface
Declaration
typings/index.d.ts:6356
types

WorkspaceSymbolProvider

The workspace symbol provider interface defines the contract between extensions and the symbol search-feature.

Source

Interface definition

export interface WorkspaceSymbolProvider {
    provideWorkspaceSymbols(query: string, token: CancellationToken): ProviderResult<WorkspaceSymbol[]>;
    resolveWorkspaceSymbol?(symbol: WorkspaceSymbol, token: CancellationToken): ProviderResult<WorkspaceSymbol>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6377
types

RenameProvider

The rename provider interface defines the contract between extensions and the rename-feature.

Source

Interface definition

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;
    }>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6421
types

DocumentFormattingEditProvider

The document formatting provider interface defines the contract between extensions and the formatting-feature.

Source

Interface definition

export interface DocumentFormattingEditProvider {
    provideDocumentFormattingEdits(document: LinesTextDocument, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}

Members

provideDocumentFormattingEdits(document: LinesTextDocument, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;

Provide formatting edits for a whole document.

Kind
interface
Declaration
typings/index.d.ts:6461
types

DocumentRangeFormattingEditProvider

The document formatting provider interface defines the contract between extensions and the formatting-feature.

Source

Interface definition

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[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6482
types

CodeActionProvider

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.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6528
types

CodeActionProviderMetadata

Metadata about the type of code actions that a CodeActionProvider providers

Source

Interface definition

export interface CodeActionProviderMetadata {
    readonly providedCodeActionKinds?: ReadonlyArray<string>;
}

Members

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)`

Kind
interface
Declaration
typings/index.d.ts:6563
types

DocumentHighlightProvider

The document highlight provider interface defines the contract between extensions and the word-highlight-feature.

Source

Interface definition

export interface DocumentHighlightProvider {
    provideDocumentHighlights(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6577
types

DocumentLinkProvider

The document link provider defines the contract between extensions and feature of showing links in the editor.

Source

Interface definition

export interface DocumentLinkProvider {
    provideDocumentLinks(document: LinesTextDocument, token: CancellationToken): ProviderResult<DocumentLink[]>;
    resolveDocumentLink?(link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6600
types

CodeLensProvider

A code lens provider adds commands to source text. The commands will be shown as dedicated horizontal lines in between the source text.

Source

Interface definition

export interface CodeLensProvider {
    provideCodeLenses(document: LinesTextDocument, token: CancellationToken): ProviderResult<CodeLens[]>;
    resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
}

Members

provideCodeLenses(document: LinesTextDocument, token: CancellationToken): ProviderResult<CodeLens[]>;

Compute a list of lenses. This call should return as fast as possible and if computing the commands is expensive implementors should only return code lens objects with the range set and implement resolve.

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.

Kind
interface
Declaration
typings/index.d.ts:6629
types

OnTypeFormattingEditProvider

The document formatting provider interface defines the contract between extensions and the formatting-feature.

Source

Interface definition

export interface OnTypeFormattingEditProvider {
    provideOnTypeFormattingEdits(document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6658
types

DocumentColorProvider

The document color provider defines the contract between extensions and feature of picking and modifying colors in the editor.

Source

Interface definition

export interface DocumentColorProvider {
    provideDocumentColors(document: LinesTextDocument, token: CancellationToken): ProviderResult<ColorInformation[]>;
    provideColorPresentations(color: Color, context: {
        document: LinesTextDocument;
        range: Range;
    }, token: CancellationToken): ProviderResult<ColorPresentation[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6682
types

TextDocumentContentProvider

Interface exported by coc.nvim.

Source

Interface definition

export interface TextDocumentContentProvider {
    onDidChange?: Event<Uri>;
    provideTextDocumentContent(uri: Uri, token: CancellationToken): ProviderResult<string>;
}

Members

onDidChange?: Event<Uri>;

An event to signal a resource has changed.

provideTextDocumentContent(uri: Uri, token: CancellationToken): ProviderResult<string>;

Provide textual content for a given uri.

The editor will use the returned string-content to create a readonly document. Resources allocated should be released when the corresponding document has been closed.

Kind
interface
Declaration
typings/index.d.ts:6706
types

SelectionRangeProvider

Interface exported by coc.nvim.

Source

Interface definition

export interface SelectionRangeProvider {
    provideSelectionRanges(document: LinesTextDocument, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6727
types

CallHierarchyProvider

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.

Source

Interface definition

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[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6740
types

DocumentSemanticTokensProvider

The document semantic tokens provider interface defines the contract between extensions and semantic tokens.

Source

Interface definition

export interface DocumentSemanticTokensProvider {
    onDidChangeSemanticTokens?: Event<void>;
    provideDocumentSemanticTokens(document: LinesTextDocument, token: CancellationToken): ProviderResult<SemanticTokens>;
    provideDocumentSemanticTokensEdits?(document: LinesTextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensDelta>;
}

Members

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:

  • at index 5*i - deltaLine: token line number, relative to the previous token
  • at index 5*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)
  • at index 5*i+2 - length: the length of the token. A token cannot be multiline.
  • at index 5*i+3 - tokenType: will be looked up in SemanticTokensLegend.tokenTypes. We currently ask that tokenType < 65536.
  • at index 5*i+4 - tokenModifiers: each set bit will be looked up in SemanticTokensLegend.tokenModifiers

How to encode tokens

Here 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: [] }
  1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types. For this example, we will choose the following legend which must be passed in when registering the provider:
   tokenTypes: ['property', 'type', 'class'],
   tokenModifiers: ['private', 'static']
  1. The first transformation step is to encode 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 }
  1. The next step is to represent each token relative to the previous token in the file. In this case, the second token is on the same line as the first token, so the 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 }
  1. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation:
   // 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.


How tokens change when the document changes

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.

Kind
interface
Declaration
typings/index.d.ts:6784
types

DocumentRangeSemanticTokensProvider

The document range semantic tokens provider interface defines the contract between extensions and semantic tokens.

Source

Interface definition

export interface DocumentRangeSemanticTokensProvider {
    provideDocumentRangeSemanticTokens(document: LinesTextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
}

Members

provideDocumentRangeSemanticTokens(document: LinesTextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
Kind
interface
Declaration
typings/index.d.ts:6888
types

LinkedEditingRangeProvider

Interface exported by coc.nvim.

Source

Interface definition

export interface LinkedEditingRangeProvider {
    provideLinkedEditingRanges(document: LinesTextDocument, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6895
types

InlayHintsProvider

The inlay hints provider interface defines the contract between extensions and the inlay hints feature.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6914
types

TypeHierarchyProvider

The type hierarchy provider interface describes the contract between extensions and the type hierarchy feature.

Source

Interface definition

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[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6950
types

InlineValuesProvider

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.

Source

Interface definition

export interface InlineValuesProvider {
    onDidChangeInlineValues?: Event<void> | undefined;
    provideInlineValues(document: TextDocument, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:6995
types

DiagnosticProvider

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7017
types

InlineCompletionItemProvider

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.

Source

Interface definition

export interface InlineCompletionItemProvider {
    provideInlineCompletionItems(document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<InlineCompletionItem[] | InlineCompletionList>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7038
types

NextEditProvider

Provider contract for returning Next Edit candidates and receiving notifications when a candidate is shown.

Source

Interface definition

export interface NextEditProvider {
    provideNextEdits(document: TextDocument, position: Position, context: NextEditContext, token: CancellationToken): ProviderResult<NextEditItem[] | NextEditList>;
    handleDidShowNextEdit?(item: NextEditItem): void | Thenable<void>;
}

Members

provideNextEdits(document: TextDocument, position: Position, context: NextEditContext, token: CancellationToken): ProviderResult<NextEditItem[] | NextEditList>;
handleDidShowNextEdit?(item: NextEditItem): void | Thenable<void>;

Example

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),
  )
}
Kind
interface
Declaration
typings/index.d.ts:7076
types

CancellationError

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.

Source

Class definition

export class CancellationError extends Error {
    constructor();
}

Members

constructor();

Creates a new cancellation error.

Kind
class
Declaration
typings/index.d.ts:7090
types

SemanticTokensBuilder

A semantic tokens builder can help with creating a SemanticTokens instance which contains delta encoded semantic tokens.

Source

Class definition

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;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:7102
types

Document

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7134
types

TextEditorOptions

Represents a text editor's options.

Source

Interface definition

export interface TextEditorOptions {
    tabSize: number;
    insertSpaces: boolean;
    trimTrailingWhitespace?: boolean;
    insertFinalNewline?: boolean;
    trimFinalNewlines?: boolean;
}

Members

tabSize: number;

The size in spaces a tab takes. This is used for two purposes:

  • the rendering width of a tab character;
  • the number of spaces to insert when insertSpaces is true.

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.

Kind
interface
Declaration
typings/index.d.ts:7300
types

TextEditor

Represents an editor that is attached to a document.

Source

Interface definition

export interface TextEditor {
    readonly tabpageid: number;
    readonly winid: number;
    readonly winnr: number;
    readonly document: Document;
    readonly visibleRanges: readonly Range[];
    readonly options: TextEditorOptions;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7331
types

Documentation

Interface exported by coc.nvim.

Source

Interface definition

export interface Documentation {
    filetype: string;
    content: string;
    active?: [
        number,
        number
    ];
    highlights?: HighlightItem[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7359
types

GlobPattern

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.

Source

Type definition

export type GlobPattern = string | RelativePattern;
Kind
type alias
Declaration
typings/index.d.ts:7395
types

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.

Source

Class definition

export class RelativePattern {
    baseUri: Uri;
    pattern: string;
    constructor(base: WorkspaceFolder | Uri | string, pattern: string);
    toJSON(): {
        pattern: string;
        baseUri: UriComponents;
    };
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:7403
types

Highlighter

Build buffer with lines and highlights

Source

Class definition

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;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:7451
types

LineBuilder

Build line with content and highlights.

Source

Class definition

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[];
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:7504
types

ListConfiguration

Interface exported by coc.nvim.

Source

Interface definition

export interface ListConfiguration {
    get<T>(key: string, defaultValue?: T): T;
    previousKey(): string;
    nextKey(): string;
    dispose(): void;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7524
types

ListActionOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface ListActionOptions {
    persist?: boolean;
    reload?: boolean;
    parallel?: boolean;
    tabPersist?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7543
types

CommandTaskOption

Interface exported by coc.nvim.

Source

Interface definition

export interface CommandTaskOption {
    cmd: string;
    args: string[];
    cwd?: string;
    env?: NodeJS.ProcessEnv;
    onLine: (line: string) => ListItem | undefined;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7562
types

BasicList

Class exported by coc.nvim.

Source

Class definition

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;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:7585
types

Mutex

Class exported by coc.nvim.

Source

Class definition

export class Mutex {
    get busy(): boolean;
    acquire(): Promise<() => void>;
    use<T>(f: () => Promise<T>): Promise<T>;
    reset(): void;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:7680
types

AnsiItem

Interface exported by coc.nvim.

Source

Interface definition

export interface AnsiItem {
    foreground?: string;
    background?: string;
    bold?: boolean;
    italic?: boolean;
    underline?: boolean;
    text: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7702
types

ParsedUrlQueryInput

Interface exported by coc.nvim.

Source

Interface definition

export interface ParsedUrlQueryInput {
    [key: string]: unknown;
}

Members

[key: string]: unknown;
Kind
interface
Declaration
typings/index.d.ts:7729
types

FetchOptions

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7733
types

DownloadOptions

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:7772
types

ResponseResult

Type alias exported by coc.nvim.

Source

Type definition

export type ResponseResult = string | Buffer | {
    [name: string]: any;
};
Kind
type alias
Declaration
typings/index.d.ts:7807
types

ExecOptions

Interface exported by coc.nvim.

Source

Interface definition

interface ExecOptions {
    cwd?: string;
    env?: NodeJS.ProcessEnv;
    shell?: string;
    timeout?: number;
    maxBuffer?: number;
    killSignal?: string;
    uid?: number;
    gid?: number;
    windowsHide?: boolean;
    encoding?: string;
}

Members

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'.

Kind
interface
Declaration
typings/index.d.ts:7841
types

FileType

Type of a file or directory.

Source

Enum definition

export enum FileType {
    Unknown = 0,
    File = 1,
    Directory = 2,
    SymbolicLink = 64
}

Members

Unknown = 0

The file type is unknown.

File = 1

A regular file.

Directory = 2

A directory.

SymbolicLink = 64

A symbolic link to a file.

Kind
enum
Declaration
typings/index.d.ts:7940
types

CommandItem

Interface exported by coc.nvim.

Source

Interface definition

export interface CommandItem {
    id: string;
    internal?: boolean;
    execute(...args: any[]): any;
}

Members

id: string;

Unique id of the command.

internal?: boolean;

Internal command, not shown in lists.

execute(...args: any[]): any;

Execute the command handler.

Kind
interface
Declaration
typings/index.d.ts:7961
types

EventResult

Type alias exported by coc.nvim.

Source

Type definition

type EventResult = void | Promise<void>;
Kind
type alias
Declaration
typings/index.d.ts:8101
types

MoveEvents

Type alias exported by coc.nvim.

Source

Type definition

type MoveEvents = 'CursorMoved' | 'CursorMovedI';
Kind
type alias
Declaration
typings/index.d.ts:8102
types

HoldEvents

Type alias exported by coc.nvim.

Source

Type definition

type HoldEvents = 'CursorHold' | 'CursorHoldI';
Kind
type alias
Declaration
typings/index.d.ts:8103
types

BufEvents

Type alias exported by coc.nvim.

Source

Type definition

type BufEvents = 'BufHidden' | 'BufEnter' | 'BufWritePost' | 'InsertLeave' | 'TermOpen' | 'InsertEnter' | 'BufCreate' | 'BufUnload' | 'BufWritePre' | 'Enter';
Kind
type alias
Declaration
typings/index.d.ts:8104
types

EmptyEvents

Type alias exported by coc.nvim.

Source

Type definition

type EmptyEvents = 'FocusGained' | 'FocusLost' | 'InsertSnippet';
Kind
type alias
Declaration
typings/index.d.ts:8107
types

InsertChangeEvents

Type alias exported by coc.nvim.

Source

Type definition

type InsertChangeEvents = 'TextChangedP' | 'TextChangedI';
Kind
type alias
Declaration
typings/index.d.ts:8108
types

TaskEvents

Type alias exported by coc.nvim.

Source

Type definition

type TaskEvents = 'TaskExit' | 'TaskStderr' | 'TaskStdout';
Kind
type alias
Declaration
typings/index.d.ts:8109
types

WindowEvents

Type alias exported by coc.nvim.

Source

Type definition

type WindowEvents = 'WinLeave' | 'WinEnter' | 'WinClosed';
Kind
type alias
Declaration
typings/index.d.ts:8110
types

AllEvents

Type alias exported by coc.nvim.

Source

Type definition

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';
Kind
type alias
Declaration
typings/index.d.ts:8111
types

OptionValue

Type alias exported by coc.nvim.

Source

Type definition

type OptionValue = string | number | boolean;
Kind
type alias
Declaration
typings/index.d.ts:8112
types

PromptWidowKeys

Type alias exported by coc.nvim.

Source

Type definition

type PromptWidowKeys = 'C-j' | 'C-k' | 'C-n' | 'C-p' | 'up' | 'down';
Kind
type alias
Declaration
typings/index.d.ts:8113
types

CursorPosition

Interface exported by coc.nvim.

Source

Interface definition

export interface CursorPosition {
    readonly bufnr: number;
    readonly lnum: number;
    readonly col: number;
    readonly insert: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:8115
types

InsertChange

Interface exported by coc.nvim.

Source

Interface definition

export interface InsertChange {
    readonly lnum: number;
    readonly col: number;
    readonly pre: string;
    readonly insertChar: string | undefined;
    readonly changedtick: number;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:8134
types

PopupChangeEvent

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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)

Kind
interface
Declaration
typings/index.d.ts:8157
types

VisibleEvent

Interface exported by coc.nvim.

Source

Interface definition

export interface VisibleEvent {
    winid: number;
    bufnr: number;
    region: [
        number,
        number
    ];
}

Members

winid: number;

Window id.

bufnr: number;

Buffer number.

region: [ number, number ];

1 based, end inclusive topline, botline

Kind
interface
Declaration
typings/index.d.ts:8200
types

FileCreateEvent

An event that is fired after files are created.

Source

Interface definition

export interface FileCreateEvent {
    readonly files: ReadonlyArray<Uri>;
}

Members

readonly files: ReadonlyArray<Uri>;

The files that got created.

Kind
interface
Declaration
typings/index.d.ts:8337
types

FileWillCreateEvent

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.

Source

Interface definition

export interface FileWillCreateEvent {
    readonly token: CancellationToken;
    readonly files: ReadonlyArray<Uri>;
    waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;
}

Members

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);
})
Kind
interface
Declaration
typings/index.d.ts:8352
types

FileWillDeleteEvent

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.

Source

Interface definition

export interface FileWillDeleteEvent {
    readonly files: ReadonlyArray<Uri>;
    waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;
}

Members

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);
})
Kind
interface
Declaration
typings/index.d.ts:8392
types

FileDeleteEvent

An event that is fired after files are deleted.

Source

Interface definition

export interface FileDeleteEvent {
    readonly files: ReadonlyArray<Uri>;
}

Members

readonly files: ReadonlyArray<Uri>;

The files that got deleted.

Kind
interface
Declaration
typings/index.d.ts:8423
types

FileRenameEvent

An event that is fired after files are renamed.

Source

Interface definition

export interface FileRenameEvent {
    readonly files: ReadonlyArray<{
        oldUri: Uri;
        newUri: Uri;
    }>;
}

Members

readonly files: ReadonlyArray<{ oldUri: Uri; newUri: Uri; }>;

The files that got renamed.

Kind
interface
Declaration
typings/index.d.ts:8434
types

FileWillRenameEvent

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.

Source

Interface definition

export interface FileWillRenameEvent {
    readonly files: ReadonlyArray<{
        oldUri: Uri;
        newUri: Uri;
    }>;
    waitUntil(thenable: Thenable<WorkspaceEdit | any>): void;
}

Members

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);
})
Kind
interface
Declaration
typings/index.d.ts:8449
types

DocumentSymbolProviderMetadata

Interface exported by coc.nvim.

Source

Interface definition

export interface DocumentSymbolProviderMetadata {
    label?: string;
}

Members

label?: string;

A human-readable string that is shown when multiple outlines trees show for one document.

Kind
interface
Declaration
typings/index.d.ts:8479
types

ServiceStat

Enum exported by coc.nvim.

Source

Enum definition

export enum ServiceStat {
    Initial,
    Starting,
    StartFailed,
    Running,
    Stopping,
    Stopped
}

Members

Initial
Starting
StartFailed
Running
Stopping
Stopped
Kind
enum
Declaration
typings/index.d.ts:8886
types

IServiceProvider

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:8895
types

SourceConfig

Source options to create source that could respect configuration from coc.source.{name}

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:8974
types

SourceStat

Interface exported by coc.nvim.

Source

Interface definition

export interface SourceStat {
    name: string;
    priority: number;
    triggerCharacters: string[];
    type: 'native' | 'remote' | 'service';
    shortcut: string;
    filepath: string;
    disabled: boolean;
    filetypes: string[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9037
types

SourceType

Enum exported by coc.nvim.

Source

Enum definition

export enum SourceType {
    Native,
    Remote,
    Service
}

Members

Native
Remote
Service
Kind
enum
Declaration
typings/index.d.ts:9072
types

CompleteResult

Interface exported by coc.nvim.

Source

Interface definition

export interface CompleteResult {
    items: ReadonlyArray<VimCompleteItem>;
    isIncomplete?: boolean;
    startcol?: number;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9078
types

CompleteOption

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9094
types

ISource

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9153
types

TreeItemLabel

Interface exported by coc.nvim.

Source

Interface definition

export interface TreeItemLabel {
    label: string;
    highlights?: [
        number,
        number
    ][];
}

Members

label: string;

Text of the label.

highlights?: [ number, number ][];

Ranges of highlights, 0 based.

Kind
interface
Declaration
typings/index.d.ts:9318
types

TreeItemIcon

Interface exported by coc.nvim.

Source

Interface definition

export interface TreeItemIcon {
    text: string;
    hlGroup: string;
}

Members

text: string;

Text of the icon.

hlGroup: string;

Highlight group of the icon.

Kind
interface
Declaration
typings/index.d.ts:9329
types

TreeItemCollapsibleState

Collapsible state of the tree item

Source

Enum definition

export enum TreeItemCollapsibleState {
    None = 0,
    Collapsed = 1,
    Expanded = 2
}

Members

None = 0

Determines an item can be neither collapsed nor expanded. Implies it has no children.

Collapsed = 1

Determines an item is collapsed

Expanded = 2

Determines an item is expanded

Kind
enum
Declaration
typings/index.d.ts:9343
types

TreeItem

Class exported by coc.nvim.

Source

Class definition

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);
}

Members

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);
Kind
class
Declaration
typings/index.d.ts:9358
types

TreeItemAction

Action resolved by

Source

Interface definition

export interface TreeItemAction<T> {
    title: string;
    handler: (item: T) => ProviderResult<void>;
}

Members

title: string;

Label text in menu.

handler: (item: T) => ProviderResult<void>;

Handler of the action.

Kind
interface
Declaration
typings/index.d.ts:9431
types

TreeViewOptions

Options for creating a

Source

Interface definition

export interface TreeViewOptions<T> {
    bufhidden?: 'hide' | 'unload' | 'delete' | 'wipe';
    winfixwidth?: boolean;
    enableFilter?: boolean;
    disableLeafIndent?: boolean;
    treeDataProvider: TreeDataProvider<T>;
    canSelectMany?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9445
types

TreeViewExpansionEvent

The event that is fired when an element in the is expanded or collapsed

Source

Interface definition

export interface TreeViewExpansionEvent<T> {
    readonly element: T;
}

Members

readonly element: T;

Element that is expanded or collapsed.

Kind
interface
Declaration
typings/index.d.ts:9477
types

TreeViewSelectionChangeEvent

The event that is fired when there is a change in tree view's selection

Source

Interface definition

export interface TreeViewSelectionChangeEvent<T> {
    readonly selection: T[];
}

Members

readonly selection: T[];

Selected elements.

Kind
interface
Declaration
typings/index.d.ts:9489
types

TreeViewVisibilityChangeEvent

The event that is fired when there is a change in tree view's visibility

Source

Interface definition

export interface TreeViewVisibilityChangeEvent {
    readonly visible: boolean;
}

Members

readonly visible: boolean;

true if the tree view is visible otherwise false.

Kind
interface
Declaration
typings/index.d.ts:9501
types

TreeView

Represents a Tree view

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9513
types

TreeDataProvider

A data provider that provides tree data

Source

Interface definition

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>[]>;
}

Members

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.

getTreeItem(element: T): TreeItem | Thenable<TreeItem>;

Get representation of the element

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.

Kind
interface
Declaration
typings/index.d.ts:9598
types

ConfigurationChangeEvent

An event describing the change in Configuration

Source

Interface definition

export interface ConfigurationChangeEvent {
    affectsConfiguration(section: string, scope?: ConfigurationScope): boolean;
}

Members

affectsConfiguration(section: string, scope?: ConfigurationScope): boolean;

Returns true if the given section for the given resource (if provided) is affected.

Kind
interface
Declaration
typings/index.d.ts:9671
types

WillSaveEvent

Interface exported by coc.nvim.

Source

Interface definition

export interface WillSaveEvent extends TextDocumentWillSaveEvent {
    waitUntil(thenable: Thenable<TextEdit[] | any>): void;
}

Members

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);
})
Kind
interface
Declaration
typings/index.d.ts:9683
types

KeymapOption

Interface exported by coc.nvim.

Source

Interface definition

export interface KeymapOption {
    cmd?: boolean;
    sync?: boolean;
    cancel?: boolean;
    silent?: boolean;
    repeat?: boolean;
    special?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9707
types

DidChangeTextDocumentParams

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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

Kind
interface
Declaration
typings/index.d.ts:9734
types

MapMode

Type alias exported by coc.nvim.

Source

Type definition

export type MapMode = 'n' | 'i' | 'v' | 'x' | 's' | 'o' | '!' | 't' | 'c' | 'l';
Kind
type alias
Declaration
typings/index.d.ts:9781
types

Autocmd

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9783
types

Env

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9822
types

Mru

Store & retrieve most recent used items.

Source

Class definition

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>;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:9912
types

TaskOptions

Option to create task that runs in (neo)vim.

Source

Interface definition

export interface TaskOptions {
    cmd: string;
    args?: string[];
    cwd?: string;
    env?: {
        [key: string]: string;
    };
    pty?: boolean;
    detach?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9950
types

Task

Controls long running task started by (neo)vim. Useful to keep the task running after CocRestart.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:9981
types

JsonDB

A simple json database.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:10014
types

RenameEvent

Interface exported by coc.nvim.

Source

Interface definition

export interface RenameEvent {
    oldUri: Uri;
    newUri: Uri;
}

Members

oldUri: Uri;

Old uri of the file.

newUri: Uri;

New uri of the file.

Kind
interface
Declaration
typings/index.d.ts:10052
types

FileSystemWatcher

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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 onDidCreate: Event<Uri>;

Fired when a file is created.

readonly onDidChange: Event<Uri>;

Fired when a file is changed.

readonly onDidDelete: Event<Uri>;

Fired when a file is deleted.

readonly onDidRename: Event<RenameEvent>;

Fired when a file is renamed.

dispose(): void;

Dispose the watcher.

Kind
interface
Declaration
typings/index.d.ts:10063
types

ConfigurationInspect

Interface exported by coc.nvim.

Source

Interface definition

export interface ConfigurationInspect<T> {
    key: string;
    defaultValue?: T;
    globalValue?: T;
    workspaceValue?: T;
    workspaceFolderValue?: T;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:10100
types

WorkspaceConfiguration

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:10132
types

BufferSyncItem

Interface exported by coc.nvim.

Source

Interface definition

export interface BufferSyncItem {
    dispose: () => void;
    onChange?(e: DidChangeTextDocumentParams): void;
    onTextChange?(): void;
    onVisible?(winid: number, region: Readonly<[
        number,
        number
    ]>): void;
}

Members

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

Kind
interface
Declaration
typings/index.d.ts:10187
types

BufferSync

Interface exported by coc.nvim.

Source

Interface definition

export interface BufferSync<T extends BufferSyncItem> {
    readonly items: Iterable<T>;
    getItem(uri: string): T | undefined;
    getItem(bufnr: number): T | undefined;
    dispose: () => void;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:10209
types

FuzzyMatchResult

Interface exported by coc.nvim.

Source

Interface definition

export interface FuzzyMatchResult {
    score: number;
    positions: Uint32Array;
}

Members

score: number;

Score of the match, higher is better.

positions: Uint32Array;

Matched character positions.

Kind
interface
Declaration
typings/index.d.ts:10228
types

FuzzyMatchHighlights

Interface exported by coc.nvim.

Source

Interface definition

export interface FuzzyMatchHighlights {
    score: number;
    highlights: AnsiHighlight[];
}

Members

score: number;

Score of the match, higher is better.

highlights: AnsiHighlight[];

Highlights of the match.

Kind
interface
Declaration
typings/index.d.ts:10239
types

FuzzyScore

An array representing a fuzzy match.

  1. the score
  2. the offset at which matching started
  3. <match_pos_N>
  4. <match_pos_1>
  5. <match_pos_0> etc
Source

Type definition

export type FuzzyScore = [
    score: number,
    wordStart: number,
    ...matches: number[]
];
Kind
type alias
Declaration
typings/index.d.ts:10259
types

FuzzyScoreOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface FuzzyScoreOptions {
    readonly boostFullMatch: boolean;
    readonly firstMatchCanBeWeak: boolean;
}

Members

readonly boostFullMatch: boolean;

Boost the score of full matches.

readonly firstMatchCanBeWeak: boolean;

Allows first match to be a weak match

Kind
interface
Declaration
typings/index.d.ts:10261
types

FuzzyKind

Match kinds could be:

  • 'aggressive' with fixed match for permutations.
  • 'any' fast match with first 13 characters only.
  • 'normal' nothing special.
Source

Type definition

export type FuzzyKind = 'normal' | 'aggressive' | 'any';
Kind
type alias
Declaration
typings/index.d.ts:10279
types

ScoreFunction

Type alias exported by coc.nvim.

Source

Type definition

export type ScoreFunction = (word: string, wordPos?: number) => FuzzyScore | undefined;
Kind
type alias
Declaration
typings/index.d.ts:10281
types

FuzzyMatch

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:10283
types

TextDocumentMatch

Interface exported by coc.nvim.

Source

Interface definition

export interface TextDocumentMatch {
    readonly uri: string;
    readonly languageId: string;
}

Members

readonly uri: string;

Uri of the document.

readonly languageId: string;

Language id of the document.

Kind
interface
Declaration
typings/index.d.ts:10343
types

PatternType

Type of pattern used by workspace folder.

Source

Enum definition

export enum PatternType {
    Buffer,
    LanguageServer,
    Global
}

Members

LanguageServer
Global
Kind
enum
Declaration
typings/index.d.ts:10357
types

TerminalExitStatus

Represents how a terminal exited.

Source

Interface definition

export interface TerminalExitStatus {
    readonly code: number | undefined;
}

Members

readonly code: number | undefined;

The exit code that a terminal exited with, it can have the following values:

  • Zero: the terminal process or custom execution succeeded.
  • Non-zero: the terminal process or custom execution failed.
  • undefined: the user forcibly closed the terminal or a custom execution exited without providing an exit code.
Kind
interface
Declaration
typings/index.d.ts:10855
types

TerminalOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface TerminalOptions {
    name?: string;
    shellPath?: string;
    shellArgs?: string[];
    cwd?: string;
    env?: {
        [key: string]: string | null;
    };
    strictEnv?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:10866
types

Terminal

An individual terminal instance within the integrated terminal.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:10906
types

StatusItemOption

Option for create status item.

Source

Interface definition

export interface StatusItemOption {
    progress?: boolean;
}

Members

progress?: boolean;

Show the item as a progress indicator.

Kind
interface
Declaration
typings/index.d.ts:10970
types

StatusBarItem

Status item that included in g:coc_status

Source

Interface definition

export interface StatusBarItem {
    readonly priority: number;
    isProgress: boolean;
    text: string;
    show(): void;
    hide(): void;
    dispose(): void;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:10980
types

ProgressOptions

Value-object describing where and how progress should show.

Source

Interface definition

export interface ProgressOptions {
    title?: string;
    cancellable?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11022
types

Progress

Defines a generalized way of reporting progress updates.

Source

Interface definition

export interface Progress<T> {
    report(value: T): void;
}

Members

report(value: T): void;

Report a progress update.

Kind
interface
Declaration
typings/index.d.ts:11040
types

MessageItem

Represents an action that is shown with an information, warning, or error message.

Source

Interface definition

export interface MessageItem {
    title: string;
    isCloseAffordance?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11059
types

DialogButton

Interface exported by coc.nvim.

Source

Interface definition

export interface DialogButton {
    index: number;
    text: string;
    disabled?: boolean;
}

Members

index: number;

Use by callback, should >= 0

text: string;

Text of the button.

disabled?: boolean;

Not shown when true

Kind
interface
Declaration
typings/index.d.ts:11077
types

DialogConfig

Interface exported by coc.nvim.

Source

Interface definition

export interface DialogConfig {
    content: string;
    title?: string;
    close?: boolean;
    highlight?: string;
    highlights?: ReadonlyArray<HighlightItem>;
    borderhighlight?: string;
    buttons?: DialogButton[];
    callback?: (index: number) => void;
}

Members

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

Kind
interface
Declaration
typings/index.d.ts:11092
types

NotificationKind

Type alias exported by coc.nvim.

Source

Type definition

export type NotificationKind = 'error' | 'info' | 'warning' | 'progress';
Kind
type alias
Declaration
typings/index.d.ts:11127
types

NotificationConfig

Interface exported by coc.nvim.

Source

Interface definition

export interface NotificationConfig {
    kind?: NotificationKind;
    content?: string;
    title?: string;
    buttons?: DialogButton[];
    callback?: (index: number) => void;
}

Members

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

Kind
interface
Declaration
typings/index.d.ts:11129
types

QuickPickOptions

Options to configure the behavior of the quick pick UI.

Source

Interface definition

export interface QuickPickOptions {
    title?: string;
    placeHolder?: string;
    matchOnDescription?: boolean;
    canPickMany?: boolean;
    placeholder?: string;
}

Members

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;
Kind
interface
Declaration
typings/index.d.ts:11155
types

QuickPickItem

Represents an item that can be selected from a list of items.

Source

Interface definition

export interface QuickPickItem {
    label: string;
    description?: string;
    picked?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11182
types

QuickPickConfig

Interface exported by coc.nvim.

Source

Interface definition

export interface QuickPickConfig<T extends QuickPickItem> {
    title?: string;
    placeholder?: string;
    items: readonly T[];
    value?: string;
    canSelectMany?: boolean;
    matchOnDescription: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11197
types

QuickPick

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11224
types

ScreenPosition

Interface exported by coc.nvim.

Source

Interface definition

export interface ScreenPosition {
    row: number;
    col: number;
}

Members

row: number;

Screen row, 1 based.

col: number;

Screen column, 1 based.

Kind
interface
Declaration
typings/index.d.ts:11305
types

MsgTypes

Type alias exported by coc.nvim.

Source

Type definition

export type MsgTypes = 'error' | 'warning' | 'more';
Kind
type alias
Declaration
typings/index.d.ts:11316
types

OpenTerminalOption

Interface exported by coc.nvim.

Source

Interface definition

export interface OpenTerminalOption {
    cwd?: string;
    autoclose?: boolean;
    keepfocus?: boolean;
    position?: 'bottom' | 'right';
}

Members

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'.

Kind
interface
Declaration
typings/index.d.ts:11318
types

OutputChannel

An output channel is a container for readonly textual information.

To get an instance of an OutputChannel use createOutputChannel.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11343
types

TerminalResult

Interface exported by coc.nvim.

Source

Interface definition

export interface TerminalResult {
    bufnr: number;
    success: boolean;
    content?: string;
}

Members

bufnr: number;

Buffer number of the terminal.

success: boolean;

Whether the command finished successfully.

content?: string;

Output content of the terminal.

Kind
interface
Declaration
typings/index.d.ts:11392
types

Dialog

Interface exported by coc.nvim.

Source

Interface definition

export interface Dialog {
    bufnr: number;
    winid: Promise<number | null>;
    dispose: () => void;
}

Members

bufnr: number;

Buffer number of dialog.

winid: Promise<number | null>;

Window id of dialog.

dispose: () => void;

Dispose the dialog.

Kind
interface
Declaration
typings/index.d.ts:11407
types

HighlightItemDef

Type alias exported by coc.nvim.

Source

Type definition

export type HighlightItemDef = [
    string,
    number,
    number,
    number,
    number?,
    number?,
    number?
];
Kind
type alias
Declaration
typings/index.d.ts:11422
types

HighlightDiff

Interface exported by coc.nvim.

Source

Interface definition

export interface HighlightDiff {
    remove: number[];
    removeMarkers: number[];
    add: HighlightItemDef[];
}

Members

remove: number[];

Namespaces to remove.

removeMarkers: number[];

Marker namespaces to remove.

add: HighlightItemDef[];

Highlights to add.

Kind
interface
Declaration
typings/index.d.ts:11424
types

MenuItem

Interface exported by coc.nvim.

Source

Interface definition

export interface MenuItem {
    text: string;
    disabled?: boolean | {
        reason: string;
    };
}

Members

text: string;

Text of the menu item.

disabled?: boolean | { reason: string; };

Disable the item when true or with a reason.

Kind
interface
Declaration
typings/index.d.ts:11439
types

MenuOption

Interface exported by coc.nvim.

Source

Interface definition

export interface MenuOption {
    title?: string;
    content?: string;
    shortcuts?: boolean;
    position?: 'center' | 'cursor';
}

Members

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'

Kind
interface
Declaration
typings/index.d.ts:11450
types

InputOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface InputOptions {
    placeholder?: string;
    position?: 'cursor' | 'center';
    marginTop?: number;
    borderhighlight?: string;
    list?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11469
types

InputPreference

Interface exported by coc.nvim.

Source

Interface definition

export interface InputPreference extends InputOptions {
    border?: [
        0 | 1,
        0 | 1,
        0 | 1,
        0 | 1
    ];
    rounded?: boolean;
    minWidth?: number;
    maxWidth?: number;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11492
types

InputDimension

Interface exported by coc.nvim.

Source

Interface definition

export interface InputDimension {
    readonly width: number;
    readonly height: number;
    readonly row: number;
    readonly col: number;
}

Members

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

Kind
interface
Declaration
typings/index.d.ts:11511
types

InputBox

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11530
types

FloatWinConfig

FloatWinConfig.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:11568
types

FloatFactory

Class exported by coc.nvim.

Source

Class definition

export class FloatFactory {
    constructor(nvim: Neovim);
    show: (docs: Documentation[], options?: FloatWinConfig) => Promise<void>;
    close: () => void;
    activated: () => Promise<boolean>;
    dispose: () => void;
}

Members

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

Kind
class
Declaration
typings/index.d.ts:11659
types

Logger

Extension-scoped logger with trace, debug, info, warning, error, fatal, and mark methods.

Source

Interface definition

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;
}

Members

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.

Example

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)
  }
}
Kind
interface
Declaration
typings/index.d.ts:12122
types

Memento

A memento represents a storage utility. It can store and retrieve values.

Source

Interface definition

export interface Memento {
    get<T>(key: string): T | undefined;
    get<T>(key: string, defaultValue: T): T;
    update(key: string, value: any): Promise<void>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12165
types

ExtensionState

Type alias exported by coc.nvim.

Source

Type definition

export type ExtensionState = 'disabled' | 'loaded' | 'activated' | 'unknown';
Kind
type alias
Declaration
typings/index.d.ts:12194
types

ExtensionType

Enum exported by coc.nvim.

Source

Enum definition

export enum ExtensionType {
    Global,
    Local,
    SingleFile,
    Internal
}

Members

Global
Local
SingleFile
Internal
Kind
enum
Declaration
typings/index.d.ts:12196
types

ExtensionJson

Interface exported by coc.nvim.

Source

Interface definition

export interface ExtensionJson {
    name: string;
    main?: string;
    engines: {
        [key: string]: string;
    };
    version?: string;
    [key: string]: any;
}

Members

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;
Kind
interface
Declaration
typings/index.d.ts:12203
types

ExtensionInfo

Interface exported by coc.nvim.

Source

Interface definition

export interface ExtensionInfo {
    id: string;
    version: string;
    description: string;
    root: string;
    exotic: boolean;
    uri?: string;
    state: ExtensionState;
    isLocal: boolean;
    packageJSON: Readonly<ExtensionJson>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12225
types

Extension

Represents an extension.

To get an instance of an Extension use getExtension.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12269
types

ExtensionContext

Utilities and lifecycle state provided to an extension activation function, including subscriptions, storage paths, state, and logging.

Source

Interface definition

export interface ExtensionContext {
    subscriptions: Disposable[];
    extensionPath: string;
    asAbsolutePath(relativePath: string): string;
    storagePath: string;
    workspaceState: Memento;
    globalState: Memento;
    logger: Logger;
}

Members

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.

Example

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)
}
Kind
interface
Declaration
typings/index.d.ts:12317
types

PropertyScheme

Interface exported by coc.nvim.

Source

Interface definition

export interface PropertyScheme {
    type: string;
    default: any;
    description: string;
    enum?: string[];
    items?: any;
    [key: string]: any;
}

Members

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;
Kind
interface
Declaration
typings/index.d.ts:12362
types

LocationWithTarget

Interface exported by coc.nvim.

Source

Interface definition

export interface LocationWithTarget extends Location {
    targetRange?: Range;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12433
types

LocationWithLine

Interface exported by coc.nvim.

Source

Interface definition

export interface LocationWithLine {
    uri: string;
    line: string;
    text?: string;
}

Members

uri: string;

Uri of the location.

line: string;

Match text of line.

text?: string;

Highlight text in line.

Kind
interface
Declaration
typings/index.d.ts:12441
types

AnsiHighlight

Interface exported by coc.nvim.

Source

Interface definition

export interface AnsiHighlight {
    span: [
        number,
        number
    ];
    hlGroup: string;
}

Members

span: [ number, number ];

Byte indexes, 0 based.

hlGroup: string;

Highlight group of the span.

Kind
interface
Declaration
typings/index.d.ts:12456
types

ListItem

Interface exported by coc.nvim.

Source

Interface definition

export interface ListItem {
    label: string;
    preselect?: boolean;
    filterText?: string;
    sortText?: string;
    location?: LocationWithTarget | LocationWithLine | string;
    data?: any;
    ansiHighlights?: AnsiHighlight[];
    resolved?: boolean;
    converted?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12467
types

ListMode

Type alias exported by coc.nvim.

Source

Type definition

export type ListMode = 'normal' | 'insert';
Kind
type alias
Declaration
typings/index.d.ts:12507
types

ListMatcher

Type alias exported by coc.nvim.

Source

Type definition

export type ListMatcher = 'strict' | 'fuzzy' | 'regex';
Kind
type alias
Declaration
typings/index.d.ts:12509
types

ListOptions

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12511
types

ListContext

Interface exported by coc.nvim.

Source

Interface definition

export interface ListContext {
    input: string;
    cwd: string;
    options: ListOptions;
    args: string[];
    window: Window;
    buffer: Buffer;
    listWindow: Window | null;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12562
types

ListAction

Interface exported by coc.nvim.

Source

Interface definition

export interface ListAction {
    name: string;
    persist?: boolean;
    reload?: boolean;
    parallel?: boolean;
    multiple?: boolean;
    tabPersist?: boolean;
    execute: (item: ListItem | ListItem[], context: ListContext) => ProviderResult<void>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12593
types

ListTask

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12635
types

ListArgument

Interface exported by coc.nvim.

Source

Interface definition

export interface ListArgument {
    key?: string;
    hasValue?: boolean;
    name: string;
    description: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12654
types

IList

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

resolveItem?(item: ListItem): Promise<ListItem | null>;

Resolve list item.

doHighlight?(): void;

Highlight buffer by vim's syntax commands.

dispose?(): void;

Called on list unregistered.

Kind
interface
Declaration
typings/index.d.ts:12673
types

PreviewOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface PreviewOptions {
    bufname?: string;
    lines: string[];
    filetype?: string;
    lnum?: number;
    range?: Range;
    sketch?: boolean;
}

Members

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;
Kind
interface
Declaration
typings/index.d.ts:12720
types

SnippetSession

Interface exported by coc.nvim.

Source

Interface definition

export interface SnippetSession {
    isActive: boolean;
}

Members

isActive: boolean;

Whether the snippet session is active.

Kind
interface
Declaration
typings/index.d.ts:12760
types

UltiSnipsActions

Interface exported by coc.nvim.

Source

Interface definition

export interface UltiSnipsActions {
    preExpand?: string;
    postExpand?: string;
    postJump?: string;
}

Members

preExpand?: string;

Code executed before expansion.

postExpand?: string;

Code executed after expansion.

postJump?: string;

Code executed after jump.

Kind
interface
Declaration
typings/index.d.ts:12778
types

UltiSnippetOption

Interface exported by coc.nvim.

Source

Interface definition

export interface UltiSnippetOption {
    regex?: string;
    context?: string;
    noExpand?: boolean;
    trimTrailingWhitespace?: boolean;
    removeWhiteSpace?: boolean;
    actions: UltiSnipsActions;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12796
types

SnippetString

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.

Source

Class definition

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;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:12833
types

DiagnosticItem

Interface exported by coc.nvim.

Source

Interface definition

export interface DiagnosticItem {
    file: string;
    lnum: number;
    col: number;
    source: string;
    code: string | number;
    message: string;
    severity: string;
    level: number;
    location: Location;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:12969
types

DiagnosticCollection

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.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13016
types

DiagnosticEventParams

Interface exported by coc.nvim.

Source

Interface definition

export interface DiagnosticEventParams {
    bufnr: number;
    uri: string;
    diagnostics: ReadonlyArray<Diagnostic>;
}

Members

bufnr: number;

Buffer number of the diagnostics.

uri: string;

Uri of the document.

diagnostics: ReadonlyArray<Diagnostic>;

Diagnostics of the document.

Kind
interface
Declaration
typings/index.d.ts:13092
types

ProgressToken

Type alias exported by coc.nvim.

Source

Type definition

export type ProgressToken = number | string;
Kind
type alias
Declaration
typings/index.d.ts:13143
types

WorkDoneProgressBegin

Interface exported by coc.nvim.

Source

Interface definition

export interface WorkDoneProgressBegin {
    kind: 'begin';
    title: string;
    cancellable?: boolean;
    message?: string;
    percentage?: number;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13145
types

WorkDoneProgressReport

Interface exported by coc.nvim.

Source

Interface definition

export interface WorkDoneProgressReport {
    kind: 'report';
    cancellable?: boolean;
    message?: string;
    percentage?: number;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13182
types

WorkDoneProgressEnd

Interface exported by coc.nvim.

Source

Interface definition

export interface WorkDoneProgressEnd {
    kind: 'end';
    message?: string;
}

Members

kind: 'end';

Progress kind, always end.

message?: string;

Optional, a final message indicating to for example indicate the outcome of the operation.

Kind
interface
Declaration
typings/index.d.ts:13214
types

FileChangeType

Type alias exported by coc.nvim.

Source

Type definition

export type FileChangeType = 1 | 2 | 3;
Kind
type alias
Declaration
typings/index.d.ts:13244
types

FileEvent

An event describing a file change.

Source

Interface definition

export interface FileEvent {
    uri: string;
    type: FileChangeType;
}

Members

uri: string;

The file's uri.

type: FileChangeType;

The change type.

Kind
interface
Declaration
typings/index.d.ts:13249
types

ErrorAction

An action to be performed when the connection is producing errors.

Source

Enum definition

export enum ErrorAction {
    Continue = 1,
    Shutdown = 2
}

Members

Continue = 1

Continue running the server.

Shutdown = 2

Shutdown the server.

Kind
enum
Declaration
typings/index.d.ts:13262
types

CloseAction

An action to be performed when the connection to a server got closed.

Source

Enum definition

export enum CloseAction {
    DoNotRestart = 1,
    Restart = 2
}

Members

DoNotRestart = 1

Don't restart the server. The connection stays closed.

Restart = 2

Restart the server.

Kind
enum
Declaration
typings/index.d.ts:13275
types

CloseHandlerResult

Interface exported by coc.nvim.

Source

Interface definition

export interface CloseHandlerResult {
    action: CloseAction;
    message?: string;
    handled?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13286
types

ErrorHandlerResult

Interface exported by coc.nvim.

Source

Interface definition

export interface ErrorHandlerResult {
    action: ErrorAction;
    message?: string;
    handled?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13306
types

ErrorHandler

A pluggable error handler that is invoked when the connection is either producing errors or got closed.

Source

Interface definition

export interface ErrorHandler {
    error(error: Error, message: {
        jsonrpc: string;
    }, count: number): ErrorAction | ErrorHandlerResult | Promise<ErrorHandlerResult>;
    closed(): CloseAction | CloseHandlerResult | Promise<CloseHandlerResult>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13329
types

InitializationFailedHandler

Interface exported by coc.nvim.

Source

Interface definition

export interface InitializationFailedHandler {
    (error: Error | any): boolean;
}

Members

(error: Error | any): boolean;
Kind
interface
Declaration
typings/index.d.ts:13346
types

RevealOutputChannelOn

Enum exported by coc.nvim.

Source

Enum definition

export enum RevealOutputChannelOn {
    Debug = 0,
    Info = 1,
    Warn = 2,
    Error = 3,
    Never = 4
}

Members

Debug = 0
Info = 1
Warn = 2
Error = 3
Never = 4
Kind
enum
Declaration
typings/index.d.ts:13361
types

ConfigurationItem

Interface exported by coc.nvim.

Source

Interface definition

export interface ConfigurationItem {
    scopeUri?: string;
    section?: string;
}

Members

scopeUri?: string;

The scope to get the configuration section for.

section?: string;

The configuration section asked for.

Kind
interface
Declaration
typings/index.d.ts:13368
types

ConfigurationWorkspaceMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface ConfigurationWorkspaceMiddleware {
    configuration?: (params: ConfigurationParams, token: CancellationToken, next: RequestHandler<ConfigurationParams, any[], void>) => HandlerResult<any[], void>;
}

Members

configuration?: (params: ConfigurationParams, token: CancellationToken, next: RequestHandler<ConfigurationParams, any[], void>) => HandlerResult<any[], void>;

Middleware for the workspace configuration request.

Kind
interface
Declaration
typings/index.d.ts:13398
types

WorkspaceFolderWorkspaceMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface WorkspaceFolderWorkspaceMiddleware {
    workspaceFolders?: (token: CancellationToken, next: RequestHandler0<WorkspaceFolder[] | null, void>) => HandlerResult<WorkspaceFolder[] | null, void>;
    didChangeWorkspaceFolders?: NextSignature<WorkspaceFoldersChangeEvent, Promise<void>>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13405
types

TypeDefinitionMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface TypeDefinitionMiddleware {
    provideTypeDefinition?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideTypeDefinitionSignature) => ProviderResult<Definition | DefinitionLink[]>;
}

Members

provideTypeDefinition?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideTypeDefinitionSignature) => ProviderResult<Definition | DefinitionLink[]>;

Middleware for providing type definitions.

Kind
interface
Declaration
typings/index.d.ts:13425
types

ImplementationMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface ImplementationMiddleware {
    provideImplementation?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideImplementationSignature) => ProviderResult<Definition | DefinitionLink[]>;
}

Members

provideImplementation?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideImplementationSignature) => ProviderResult<Definition | DefinitionLink[]>;

Middleware for providing implementations.

Kind
interface
Declaration
typings/index.d.ts:13442
types

ColorProviderMiddleware

Interface exported by coc.nvim.

Source

Interface definition

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[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13456
types

DeclarationMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface DeclarationMiddleware {
    provideDeclaration?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideDeclarationSignature) => ProviderResult<Declaration | DeclarationLink[]>;
}

Members

provideDeclaration?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideDeclarationSignature) => ProviderResult<Declaration | DeclarationLink[]>;

Middleware for providing declarations.

Kind
interface
Declaration
typings/index.d.ts:13482
types

FoldingRangeProviderMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface FoldingRangeProviderMiddleware {
    provideFoldingRanges?: (this: void, document: LinesTextDocument, context: FoldingContext, token: CancellationToken, next: ProvideFoldingRangeSignature) => ProviderResult<FoldingRange[]>;
}

Members

provideFoldingRanges?: (this: void, document: LinesTextDocument, context: FoldingContext, token: CancellationToken, next: ProvideFoldingRangeSignature) => ProviderResult<FoldingRange[]>;

Middleware for providing folding ranges.

Kind
interface
Declaration
typings/index.d.ts:13496
types

CallHierarchyMiddleware

Interface exported by coc.nvim.

Source

Interface definition

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[]>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13520
types

DocumentSemanticsTokensEditsSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface DocumentSemanticsTokensEditsSignature {
    (this: void, document: LinesTextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensDelta>;
}

Members

(this: void, document: LinesTextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensDelta>;
Kind
interface
Declaration
typings/index.d.ts:13555
types

SemanticTokensMiddleware

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13563
types

FileOperationsMiddleware

Interface exported by coc.nvim.

Source

Interface definition

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>>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13595
types

LinkedEditingRangeMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface LinkedEditingRangeMiddleware {
    provideLinkedEditingRange?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideLinkedEditingRangeSignature) => ProviderResult<LinkedEditingRanges>;
}

Members

provideLinkedEditingRange?: (this: void, document: LinesTextDocument, position: Position, token: CancellationToken, next: ProvideLinkedEditingRangeSignature) => ProviderResult<LinkedEditingRanges>;

Middleware for providing linked editing ranges.

Kind
interface
Declaration
typings/index.d.ts:13626
types

SelectionRangeProviderMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface SelectionRangeProviderMiddleware {
    provideSelectionRanges?: (this: void, document: LinesTextDocument, positions: Position[], token: CancellationToken, next: ProvideSelectionRangeSignature) => ProviderResult<SelectionRange[]>;
}

Members

provideSelectionRanges?: (this: void, document: LinesTextDocument, positions: Position[], token: CancellationToken, next: ProvideSelectionRangeSignature) => ProviderResult<SelectionRange[]>;

Middleware for providing selection ranges.

Kind
interface
Declaration
typings/index.d.ts:13643
types

DiagnosticProviderMiddleware

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13654
types

HandleDiagnosticsSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface HandleDiagnosticsSignature {
    (this: void, uri: string, diagnostics: Diagnostic[]): void;
}

Members

(this: void, uri: string, diagnostics: Diagnostic[]): void;
Kind
interface
Declaration
typings/index.d.ts:13669
types

ProvideCompletionItemsSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ProvideCompletionItemsSignature {
    (this: void, document: LinesTextDocument, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionItem[] | CompletionList | null>;
}

Members

(this: void, document: LinesTextDocument, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionItem[] | CompletionList | null>;
Kind
interface
Declaration
typings/index.d.ts:13673
types

ProvideSignatureHelpSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ProvideSignatureHelpSignature {
    (this: void, document: LinesTextDocument, position: Position, context: SignatureHelpContext, token: CancellationToken): ProviderResult<SignatureHelp>;
}

Members

(this: void, document: LinesTextDocument, position: Position, context: SignatureHelpContext, token: CancellationToken): ProviderResult<SignatureHelp>;
Kind
interface
Declaration
typings/index.d.ts:13685
types

ProvideReferencesSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ProvideReferencesSignature {
    (this: void, document: LinesTextDocument, position: Position, options: {
        includeDeclaration: boolean;
    }, token: CancellationToken): ProviderResult<Location[]>;
}

Members

(this: void, document: LinesTextDocument, position: Position, options: { includeDeclaration: boolean; }, token: CancellationToken): ProviderResult<Location[]>;
Kind
interface
Declaration
typings/index.d.ts:13693
types

ProvideCodeActionsSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ProvideCodeActionsSignature {
    (this: void, document: LinesTextDocument, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
}

Members

(this: void, document: LinesTextDocument, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
Kind
interface
Declaration
typings/index.d.ts:13711
types

ProvideDocumentRangeFormattingEditsSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ProvideDocumentRangeFormattingEditsSignature {
    (this: void, document: LinesTextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}

Members

(this: void, document: LinesTextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
Kind
interface
Declaration
typings/index.d.ts:13731
types

ProvideDocumentRangesFormattingEditsSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ProvideDocumentRangesFormattingEditsSignature {
    (this: void, document: LinesTextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}

Members

(this: void, document: LinesTextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
Kind
interface
Declaration
typings/index.d.ts:13735
types

ProvideOnTypeFormattingEditsSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ProvideOnTypeFormattingEditsSignature {
    (this: void, document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
}

Members

(this: void, document: LinesTextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
Kind
interface
Declaration
typings/index.d.ts:13739
types

ExecuteCommandSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ExecuteCommandSignature {
    (this: void, command: string, args: any[]): ProviderResult<any>;
}

Members

(this: void, command: string, args: any[]): ProviderResult<any>;
Kind
interface
Declaration
typings/index.d.ts:13762
types

NextSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface NextSignature<P, R> {
    (this: void, data: P, next: (data: P) => R): R;
}

Members

(this: void, data: P, next: (data: P) => R): R;
Kind
interface
Declaration
typings/index.d.ts:13766
types

DidChangeConfigurationSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface DidChangeConfigurationSignature {
    (this: void, sections: string[] | undefined): void;
}

Members

(this: void, sections: string[] | undefined): void;
Kind
interface
Declaration
typings/index.d.ts:13770
types

DidChangeWatchedFileSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface DidChangeWatchedFileSignature {
    (this: void, event: FileEvent): void;
}

Members

(this: void, event: FileEvent): void;
Kind
interface
Declaration
typings/index.d.ts:13774
types

ProvideInlineCompletionItemsSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface ProvideInlineCompletionItemsSignature {
    (this: void, document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<InlineCompletionItem[] | InlineCompletionList>;
}

Members

Kind
interface
Declaration
typings/index.d.ts:13778
types

_WorkspaceMiddleware

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13782
types

ShowDocumentParams

Params to show a document.

Source

Interface definition

export interface ShowDocumentParams {
    uri: string;
    external?: boolean;
    takeFocus?: boolean;
    selection?: Range;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13804
types

ShowDocumentResult

The result of an show document request.

Source

Interface definition

export interface ShowDocumentResult {
    success: boolean;
}

Members

success: boolean;

A boolean indicating if the show was successful.

Kind
interface
Declaration
typings/index.d.ts:13835
types

Registration

General parameters to register for a notification or to register a provider.

Source

Interface definition

export interface Registration {
    id: string;
    method: string;
    registerOptions?: LSPAny;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13845
types

RegistrationParams

Interface exported by coc.nvim.

Source

Interface definition

export interface RegistrationParams {
    registrations: Registration[];
}

Members

registrations: Registration[];

Registrations of the request.

Kind
interface
Declaration
typings/index.d.ts:13860
types

Unregistration

General parameters to unregister a request or notification.

Source

Interface definition

export interface Unregistration {
    id: string;
    method: string;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13870
types

UnregistrationParams

Interface exported by coc.nvim.

Source

Interface definition

export interface UnregistrationParams {
    unregisterations: Unregistration[];
}

Members

unregisterations: Unregistration[];

Unregistrations of the request.

Kind
interface
Declaration
typings/index.d.ts:13881
types

_WindowMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface _WindowMiddleware {
    showDocument?: (params: ShowDocumentParams, token: CancellationToken, next: RequestHandler<ShowDocumentParams, ShowDocumentResult, void>) => Promise<ShowDocumentResult>;
}

Members

showDocument?: (params: ShowDocumentParams, token: CancellationToken, next: RequestHandler<ShowDocumentParams, ShowDocumentResult, void>) => Promise<ShowDocumentResult>;

Middleware for show document requests.

Kind
interface
Declaration
typings/index.d.ts:13888
types

_Middleware

The Middleware lets extensions intercept the request and notifications send and received from the server

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:13904
types

GeneralMiddleware

Interface exported by coc.nvim.

Source

Interface definition

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>;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14049
types

TextDocumentContentMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface TextDocumentContentMiddleware {
    provideTextDocumentContent?: (this: void, uri: Uri, token: CancellationToken, next: ProvideTextDocumentContentSignature) => ProviderResult<string>;
}

Members

provideTextDocumentContent?: (this: void, uri: Uri, token: CancellationToken, next: ProvideTextDocumentContentSignature) => ProviderResult<string>;

Middleware for providing text document content.

Kind
interface
Declaration
typings/index.d.ts:14076
types

InlineCompletionMiddleware

Interface exported by coc.nvim.

Source

Interface definition

export interface InlineCompletionMiddleware {
    provideInlineCompletionItems?: (this: void, document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken, next: ProvideInlineCompletionItemsSignature) => ProviderResult<InlineCompletionItem[] | InlineCompletionList>;
}

Members

provideInlineCompletionItems?: (this: void, document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken, next: ProvideInlineCompletionItemsSignature) => ProviderResult<InlineCompletionItem[] | InlineCompletionList>;

Middleware for providing inline completion items.

Kind
interface
Declaration
typings/index.d.ts:14083
types

Middleware

Type alias exported by coc.nvim.

Source
types

ConnectionOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface ConnectionOptions {
    maxRestartCount?: number;
}

Members

maxRestartCount?: number;

Maximum number of restart attempts before giving up.

Kind
interface
Declaration
typings/index.d.ts:14092
types

DiagnosticPullMode

Enum exported by coc.nvim.

Source

Enum definition

export enum DiagnosticPullMode {
    onType = 'onType',
    onSave = 'onSave',
    onFocus = 'onFocus'
}

Members

onType = 'onType'
onSave = 'onSave'
onFocus = 'onFocus'
Kind
enum
Declaration
typings/index.d.ts:14099
types

DiagnosticPullOptions

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14105
types

URIConverter

Interface exported by coc.nvim.

Source

Interface definition

export interface URIConverter {
    (value: Uri): string;
}

Members

(value: Uri): string;
Kind
interface
Declaration
typings/index.d.ts:14159
types

LanguageClientOptions

Interface exported by coc.nvim.

Source

Interface definition

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;
    };
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14163
types

ClientState

Enum exported by coc.nvim.

Source

Enum definition

export enum ClientState {
    Initial,
    Starting,
    StartFailed,
    Running,
    Stopping,
    Stopped
}

Members

Initial
Starting
StartFailed
Running
Stopping
Stopped
Kind
enum
Declaration
typings/index.d.ts:14282
types

State

Enum exported by coc.nvim.

Source

Enum definition

export enum State {
    Stopped = 1,
    Running = 2,
    Starting = 3,
    StartFailed = 4
}

Members

Stopped = 1
Running = 2
Starting = 3
StartFailed = 4
Kind
enum
Declaration
typings/index.d.ts:14290
types

StateChangeEvent

Interface exported by coc.nvim.

Source

Interface definition

export interface StateChangeEvent {
    oldState: State;
    newState: State;
}

Members

oldState: State;

State before the change.

newState: State;

State after the change.

Kind
interface
Declaration
typings/index.d.ts:14296
types

RegistrationData

Interface exported by coc.nvim.

Source

Interface definition

export interface RegistrationData<T> {
    id: string;
    registerOptions: T;
}

Members

id: string;

Id of the registration.

registerOptions: T;

Register options of the registration.

Kind
interface
Declaration
typings/index.d.ts:14306
types

FeatureState

Type alias exported by coc.nvim.

Source

Type definition

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';
};
Kind
type alias
Declaration
typings/index.d.ts:14317
types

StaticFeature

A static feature. A static feature can't be dynamically activate via the server. It is wired during the initialize sequence.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14369
types

DynamicFeature

A dynamic feature can be activated via the server.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14417
types

ParameterStructures

Class exported by coc.nvim.

Source

Class definition

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;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:14479
types

MessageSignature

An interface to type messages.

Source

Interface definition

export interface MessageSignature {
    readonly method: string;
    readonly numberOfParams: number;
    readonly parameterStructures: ParameterStructures;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14510
types

AbstractMessageSignature

An abstract implementation of a MessageType.

Source

Class definition

abstract class AbstractMessageSignature implements MessageSignature {
    readonly method: string;
    readonly numberOfParams: number;
    constructor(method: string, numberOfParams: number);
    get parameterStructures(): ParameterStructures;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:14529
types

RequestType0

Classes to type request response pairs

Source

Class definition

export class RequestType0<R, E> extends AbstractMessageSignature {
    readonly _: [
        R,
        E,
        _EM
    ] | undefined;
    constructor(method: string);
}

Members

readonly _: [ R, E, _EM ] | undefined;

Clients must not use this property. It is here to ensure correct typing.

constructor(method: string);
Kind
class
Declaration
typings/index.d.ts:14548
types

RequestType

Class exported by coc.nvim.

Source

Class definition

export class RequestType<P, R, E> extends AbstractMessageSignature {
    private _parameterStructures;
    readonly _: [
        P,
        R,
        E,
        _EM
    ] | undefined;
    constructor(method: string, _parameterStructures?: ParameterStructures);
    get parameterStructures(): ParameterStructures;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:14556
types

NotificationType

Class exported by coc.nvim.

Source

Class definition

export class NotificationType<P> extends AbstractMessageSignature {
    readonly _: [
        P,
        _EM
    ] | undefined;
    constructor(method: string);
}

Members

readonly _: [ P, _EM ] | undefined;

Clients must not use this property. It is here to ensure correct typing.

constructor(method: string);
Kind
class
Declaration
typings/index.d.ts:14569
types

NotificationType0

Class exported by coc.nvim.

Source

Class definition

export class NotificationType0 extends AbstractMessageSignature {
    readonly _: [
        _EM
    ] | undefined;
    constructor(method: string);
}

Members

readonly _: [ _EM ] | undefined;

Clients must not use this property. It is here to ensure correct typing.

constructor(method: string);
Kind
class
Declaration
typings/index.d.ts:14577
types

InitializeParams

Interface exported by coc.nvim.

Source

Interface definition

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;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14585
types

RegistrationType

Class exported by coc.nvim.

Source

Class definition

class RegistrationType<RO> {
    readonly ____: [
        RO,
        _EM
    ] | undefined;
    readonly method: string;
    constructor(method: string);
}

Members

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);
Kind
class
Declaration
typings/index.d.ts:14639
types

InitializeResult

The result returned from an initialize request.

Source

Interface definition

export interface InitializeResult {
    capabilities: any;
    serverInfo?: {
        name: string;
        version?: string;
    };
    [custom: string]: any;
}

Members

capabilities: any;

The capabilities the language server provides.

serverInfo?: { name: string; version?: string; };

Information about the server.

[custom: string]: any;

Custom initialization results.

Kind
interface
Declaration
typings/index.d.ts:14653
types

NotificationFeature

Interface exported by coc.nvim.

Source

Interface definition

export interface NotificationFeature<T extends Function> {
    getProvider(document: {
        uri: string;
        languageId: string;
    }): {
        send: T;
    };
}

Members

getProvider(document: { uri: string; languageId: string; }): { send: T; };

Triggers the corresponding RPC method.

Kind
interface
Declaration
typings/index.d.ts:14679
types

ExecutableOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface ExecutableOptions {
    cwd?: string;
    env?: any;
    detached?: boolean;
    shell?: boolean;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14688
types

Executable

Interface exported by coc.nvim.

Source

Interface definition

export interface Executable {
    command: string;
    args?: string[];
    options?: ExecutableOptions;
}

Members

command: string;

Command of the executable.

args?: string[];

Arguments of the command.

options?: ExecutableOptions;

Options of the executable.

Kind
interface
Declaration
typings/index.d.ts:14707
types

ForkOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface ForkOptions {
    cwd?: string;
    env?: any;
    execPath?: string;
    encoding?: string;
    execArgv?: string[];
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14722
types

StreamInfo

Interface exported by coc.nvim.

Source

Interface definition

export interface StreamInfo {
    writer: NodeJS.WritableStream;
    reader: NodeJS.ReadableStream;
    detached?: boolean;
}

Members

writer: NodeJS.WritableStream;

Writable stream of the server.

reader: NodeJS.ReadableStream;

Readable stream of the server.

detached?: boolean;

Detach the streams from the parent.

Kind
interface
Declaration
typings/index.d.ts:14745
types

TransportKind

Enum exported by coc.nvim.

Source

Enum definition

export enum TransportKind {
    stdio = 0,
    ipc = 1,
    pipe = 2,
    socket = 3
}

Members

stdio = 0
ipc = 1
pipe = 2
socket = 3
Kind
enum
Declaration
typings/index.d.ts:14760
types

SocketTransport

Interface exported by coc.nvim.

Source

Interface definition

export interface SocketTransport {
    kind: TransportKind.socket;
    port: number;
}

Members

kind: TransportKind.socket;

Transport kind, always socket.

port: number;

Port of the socket.

Kind
interface
Declaration
typings/index.d.ts:14767
types

NodeModule

Interface exported by coc.nvim.

Source

Interface definition

export interface NodeModule {
    module: string;
    transport?: TransportKind | SocketTransport;
    args?: string[];
    runtime?: string;
    options?: ForkOptions;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14778
types

ChildProcessInfo

Interface exported by coc.nvim.

Source

Interface definition

export interface ChildProcessInfo {
    process: cp.ChildProcess;
    detached: boolean;
}

Members

process: cp.ChildProcess;

Child process of the server.

detached: boolean;

Whether the process is detached.

Kind
interface
Declaration
typings/index.d.ts:14801
types

PartialMessageInfo

Interface exported by coc.nvim.

Source

Interface definition

export interface PartialMessageInfo {
    readonly messageToken: number;
    readonly waitingTime: number;
}

Members

readonly messageToken: number;

Token of the partial message.

readonly waitingTime: number;

Waiting time of the partial message.

Kind
interface
Declaration
typings/index.d.ts:14812
types

MessageReader

Interface exported by coc.nvim.

Source

Interface definition

export interface MessageReader {
    readonly onError: Event<Error>;
    readonly onClose: Event<void>;
    readonly onPartialMessage: Event<PartialMessageInfo>;
    listen(callback: (data: {
        jsonrpc: string;
    }) => void): void;
    dispose(): void;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:14823
types

MessageWriter

Interface exported by coc.nvim.

Source

Interface definition

export interface MessageWriter {
    readonly onError: Event<[
        Error,
        {
            jsonrpc: string;
        } | undefined,
        number | undefined
    ]>;
    readonly onClose: Event<void>;
    write(msg: {
        jsonrpc: string;
    }): void;
    dispose(): void;
}

Members

readonly onError: Event<[ Error, { jsonrpc: string; } | undefined, number | undefined ]>;

Fired on error.

readonly onClose: Event<void>;

Fired on close.

write(msg: { jsonrpc: string; }): void;

Write a message.

dispose(): void;

Dispose the writer.

Kind
interface
Declaration
typings/index.d.ts:14846
types

NullLogger

Class exported by coc.nvim.

Source

Class definition

export class NullLogger {
    constructor();
    error(message: string): void;
    warn(message: string): void;
    info(message: string): void;
    log(message: string): void;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:14865
types

MessageTransports

Interface exported by coc.nvim.

Source

Interface definition

export interface MessageTransports {
    reader: MessageReader;
    writer: MessageWriter;
    detached?: boolean;
}

Members

reader: MessageReader;

Message reader of the transport.

writer: MessageWriter;

Message writer of the transport.

detached?: boolean;

Whether the transport is detached.

Kind
interface
Declaration
typings/index.d.ts:14885
types

_EM

Interface exported by coc.nvim.

Source

Interface definition

export interface _EM {
    _$endMarker$_: number;
}

Members

_$endMarker$_: number;

End marker used for typing only.

Kind
interface
Declaration
typings/index.d.ts:14915
types

ProgressType

Class exported by coc.nvim.

Source

Class definition

export class ProgressType<PR> {
    readonly __?: [
        PR,
        _EM
    ];
    readonly _pr?: PR;
    constructor();
}

Members

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();
Kind
class
Declaration
typings/index.d.ts:14922
types

Trace

Enum exported by coc.nvim.

Source

Enum definition

export enum Trace {
    Off = 0,
    Messages = 1,
    Compact = 2,
    Verbose = 3
}

Members

Off = 0
Messages = 1
Compact = 2
Verbose = 3
Kind
enum
Declaration
typings/index.d.ts:14935
types

RequestProtocolSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface RequestProtocolSignature<P, R, PR, E, RO> {
    method: string;
    numberOfParams?: number;
    parameterStructures?: unknown;
}

Members

method: string;

Method name of the request.

numberOfParams?: number;

Number of parameters of the request.

parameterStructures?: unknown;

Parameter structure of the request.

Kind
interface
Declaration
typings/index.d.ts:14947
types

RequestProtocolSignature0

Interface exported by coc.nvim.

Source

Interface definition

export interface RequestProtocolSignature0<R, PR, E, RO> {
    method: string;
}

Members

method: string;

Method name of the request.

Kind
interface
Declaration
typings/index.d.ts:14962
types

RequestSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface RequestSignature<P, R, E> {
    method: string;
    numberOfParams?: number;
    parameterStructures?: unknown;
}

Members

method: string;

Method name of the request.

numberOfParams?: number;

Number of parameters of the request.

parameterStructures?: unknown;

Parameter structure of the request.

Kind
interface
Declaration
typings/index.d.ts:14969
types

RequestSignature0

Interface exported by coc.nvim.

Source

Interface definition

export interface RequestSignature0<R, E> {
    method: string;
}

Members

method: string;

Method name of the request.

Kind
interface
Declaration
typings/index.d.ts:14984
types

NotificationProtocolSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface NotificationProtocolSignature<P, RO> {
    method: string;
    numberOfParams?: number;
    parameterStructures?: unknown;
}

Members

method: string;

Method name of the notification.

numberOfParams?: number;

Number of parameters of the notification.

parameterStructures?: unknown;

Parameter structure of the notification.

Kind
interface
Declaration
typings/index.d.ts:14991
types

NotificationProtocolSignature0

Interface exported by coc.nvim.

Source

Interface definition

export interface NotificationProtocolSignature0<RO> {
    readonly ____: [
        RO,
        _EM
    ] | undefined;
    method: string;
}

Members

readonly ____: [ RO, _EM ] | undefined;

Typing marker, do not use.

method: string;

Method name of the notification.

Kind
interface
Declaration
typings/index.d.ts:15006
types

NotificationSignature

Interface exported by coc.nvim.

Source

Interface definition

export interface NotificationSignature<P> {
    readonly _: [
        P,
        _EM
    ] | undefined;
    method: string;
    numberOfParams?: number;
    parameterStructures?: unknown;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:15017
types

NotificationSignature0

Interface exported by coc.nvim.

Source

Interface definition

export interface NotificationSignature0 {
    method: string;
}

Members

method: string;

Method name of the notification.

Kind
interface
Declaration
typings/index.d.ts:15036
types

ProtocolRequestType0

Class exported by coc.nvim.

Source

Class definition

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);
}

Members

readonly ___: [ PR, RO, _EM ] | undefined;

Clients must not use these properties. They are here to ensure correct typing. in TypeScript

readonly ____: [ RO, _EM ] | undefined;

Typing marker, do not use.

readonly _pr: PR | undefined;

Typing marker, do not use.

constructor(method: string);
Kind
class
Declaration
typings/index.d.ts:15043
types

ProtocolRequestType

Class exported by coc.nvim.

Source

Class definition

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);
}

Members

readonly ___: [ PR, RO, _EM ] | undefined;

Clients must not use this property. It is here to ensure correct typing.

readonly ____: [ RO, _EM ] | undefined;

Typing marker, do not use.

readonly _pr: PR | undefined;

Typing marker, do not use.

constructor(method: string);
Kind
class
Declaration
typings/index.d.ts:15060
types

ProtocolNotificationType0

Class exported by coc.nvim.

Source

Class definition

export class ProtocolNotificationType0<RO> extends NotificationType0 implements RegistrationType<RO> {
    readonly ___: [
        RO,
        _EM
    ] | undefined;
    readonly ____: [
        RO,
        _EM
    ] | undefined;
    constructor(method: string);
}

Members

readonly ___: [ RO, _EM ] | undefined;

Clients must not use this property. It is here to ensure correct typing.

readonly ____: [ RO, _EM ] | undefined;

Typing marker, do not use.

constructor(method: string);
Kind
class
Declaration
typings/index.d.ts:15076
types

ProtocolNotificationType

Class exported by coc.nvim.

Source

Class definition

export class ProtocolNotificationType<P, RO> extends NotificationType<P> implements RegistrationType<RO> {
    readonly ___: [
        RO,
        _EM
    ] | undefined;
    readonly ____: [
        RO,
        _EM
    ] | undefined;
    constructor(method: string);
}

Members

readonly ___: [ RO, _EM ] | undefined;

Clients must not use this property. It is here to ensure correct typing.

readonly ____: [ RO, _EM ] | undefined;

Typing marker, do not use.

constructor(method: string);
Kind
class
Declaration
typings/index.d.ts:15087
types

NotificationHandler0

Interface exported by coc.nvim.

Source

Interface definition

export interface NotificationHandler0 {
    (): void;
}

Members

(): void;
Kind
interface
Declaration
typings/index.d.ts:15099
types

NotificationHandler

Interface exported by coc.nvim.

Source

Interface definition

export interface NotificationHandler<P> {
    (params: P): void;
}

Members

(params: P): void;
Kind
interface
Declaration
typings/index.d.ts:15103
types

GeneralRegistrationOptions

Including the registration options from languageserver protocol package could be too complicated and the options can be changed from time to time.

Source

Interface definition

export interface GeneralRegistrationOptions {
    [key: string]: any;
}

Members

[key: string]: any;
Kind
interface
Declaration
typings/index.d.ts:15111
types

DidChangeConfigurationRegistrationOptions

Interface exported by coc.nvim.

Source

Interface definition

export interface DidChangeConfigurationRegistrationOptions {
    section?: string | string[];
}

Members

section?: string | string[];

Configuration sections that changed.

Kind
interface
Declaration
typings/index.d.ts:15122
types

TextDocumentRegistrationOptions

Interface exported by coc.nvim.

Source

Interface definition

interface TextDocumentRegistrationOptions {
    documentSelector: DocumentSelector | null;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:15129
types

TextDocumentChangeRegistrationOptions

Interface exported by coc.nvim.

Source

Interface definition

interface TextDocumentChangeRegistrationOptions {
    syncKind: 0 | 1 | 2;
}

Members

syncKind: 0 | 1 | 2;

How documents are synced to the server.

Kind
interface
Declaration
typings/index.d.ts:15137
types

TextDocumentSendFeature

Interface exported by coc.nvim.

Source

Interface definition

interface TextDocumentSendFeature<T extends Function> {
    getProvider(document: TextDocument): {
        send: T;
    } | undefined;
}

Members

getProvider(document: TextDocument): { send: T; } | undefined;

Returns a provider for the given text document.

Kind
interface
Declaration
typings/index.d.ts:15144
types

DidOpenTextDocumentFeatureShape

Interface exported by coc.nvim.

Source

Interface definition

export interface DidOpenTextDocumentFeatureShape extends DynamicFeature<TextDocumentRegistrationOptions>, TextDocumentSendFeature<(textDocument: TextDocument) => Promise<void>>, NotifyingFeature<TextDocument, DidOpenTextDocumentParams> {
    openDocuments: Iterable<TextDocument>;
}

Members

openDocuments: Iterable<TextDocument>;

Documents currently opened by the feature.

Kind
interface
Declaration
typings/index.d.ts:15180
types

WorkspaceProviderFeature

Interface exported by coc.nvim.

Source

Interface definition

export interface WorkspaceProviderFeature<PR> {
    getProviders(): PR[] | undefined;
}

Members

getProviders(): PR[] | undefined;

Get the registered providers.

Kind
interface
Declaration
typings/index.d.ts:15209
types

TextDocumentProviderFeature

Interface exported by coc.nvim.

Source

Interface definition

export interface TextDocumentProviderFeature<T> {
    readonly registrationLength: number;
    getProvider(textDocument: TextDocument): T | undefined;
}

Members

readonly registrationLength: number;

Number of registered providers.

getProvider(textDocument: TextDocument): T | undefined;

Triggers the corresponding RPC method.

Kind
interface
Declaration
typings/index.d.ts:15216
types

CodeLensProviderShape

Interface exported by coc.nvim.

Source

Interface definition

export interface CodeLensProviderShape {
    provider?: CodeLensProvider;
    onDidChangeCodeLensEmitter: Emitter<void>;
}

Members

provider?: CodeLensProvider;

Provider of code lenses.

onDidChangeCodeLensEmitter: Emitter<void>;

Emitter fired when code lenses change.

Kind
interface
Declaration
typings/index.d.ts:15227
types

SemanticTokensProviderShape

Interface exported by coc.nvim.

Source

Interface definition

export interface SemanticTokensProviderShape {
    range?: DocumentRangeSemanticTokensProvider;
    full?: DocumentSemanticTokensProvider;
    onDidChangeSemanticTokensEmitter: Emitter<void>;
}

Members

range?: DocumentRangeSemanticTokensProvider;

Provider of range semantic tokens.

full?: DocumentSemanticTokensProvider;

Provider of full document semantic tokens.

onDidChangeSemanticTokensEmitter: Emitter<void>;

Emitter fired when semantic tokens change.

Kind
interface
Declaration
typings/index.d.ts:15238
types

DiagnosticProviderShape

Interface exported by coc.nvim.

Source

Interface definition

export interface DiagnosticProviderShape {
    onDidChangeDiagnosticsEmitter: Emitter<void>;
    diagnostics: DiagnosticProvider;
    forget(document: TextDocument): void;
}

Members

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.

Kind
interface
Declaration
typings/index.d.ts:15286
types

DiagnosticFeatureShape

Interface exported by coc.nvim.

Source

Interface definition

export interface DiagnosticFeatureShape {
    refresh(): void;
}

Members

refresh(): void;

Refresh all diagnostics.

Kind
interface
Declaration
typings/index.d.ts:15304
types

LanguageClient

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.

Source

Class definition

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>;
}

Members

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.

Kind
class
Declaration
typings/index.d.ts:15317
types

SettingMonitor

Monitor for setting change, restart language server when specified setting changed.

Source

Class definition

export class SettingMonitor {
    constructor(client: LanguageClient, setting: string);
    start(): Disposable;
}

Members

constructor(client: LanguageClient, setting: string);
start(): Disposable;

Start monitoring the setting and start the client when it is enabled.

Kind
class
Declaration
typings/index.d.ts:15743
API module

commands API

All 5 public APIs exported from the commands module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

commands

commands.commandList

Registered commands.

Source

API signature

commands.commandList: CommandItem[]
Returns
CommandItem[]
Declaration
typings/index.d.ts:7982
commands

commands.execute

Execute specified command.

Deprecated use executeCommand() instead.
Source

API signature

commands.execute(command: { name: string, arguments?: any[] }): void

Parameters

ParameterType
command{ name: string, arguments?: any[] }
Returns
void
Declaration
typings/index.d.ts:7989
commands

commands.has

Check if command is registered.

Source

API signature

commands.has(id: string): boolean

Parameters

ParameterTypeDescription
idstring

Unique id of command.

Returns
boolean
Declaration
typings/index.d.ts:7996
commands

commands.registerCommand

Registers a command callable via :CocCommand <id> or programmatically.

Source

API signature

commands.registerCommand(id: string, impl: (...args: any[]) => void, thisArg?: any, internal?: boolean): Disposable

Example

import { commands, window, ExtensionContext } from 'coc.nvim';

export function activate(context: ExtensionContext) {
  context.subscriptions.push(
    commands.registerCommand('myextension.sayHello', async () => {
      window.showInformationMessage('Hello from coc.nvim extension!');
    })
  );
}

Parameters

ParameterTypeDescription
idstring

A unique identifier for the command.

impl(...args: any[]) => void

A command handler function.

thisArg?any

The this context used when invoking the handler function.

internal?boolean
Returns
Disposable

Disposable which unregisters this command on disposal.

Declaration
typings/index.d.ts:8010
commands

commands.executeCommand

Executes the command denoted by the given command identifier.

  • Note 1: When executing an editor command not all types are allowed to be passed as arguments. Allowed are the primitive types string, boolean, number, undefined, and null, as well as Position, Range, URI and Location.
  • Note 2: There are no restrictions when executing commands that have been contributed by extensions.
Source

Overloads (15)

  1. Signature 1
    commands.executeCommand<T>(command: string, ...rest: any[]): Promise<T>
    command: string

    Identifier of the command to execute.

    ...rest?: any[]

    Parameters passed to the command function.

    Returns
    Promise<T>
  2. Signature 2
    commands.executeCommand(command: 'vscode.open', uri: string | Uri): Promise<void>
    command: 'vscode.open'
    No parameter description is present in the pinned declaration.
    uri: string | Uri
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  3. Signature 3
    commands.executeCommand(command: 'workbench.action.reloadWindow'): Promise<void>
    command: 'workbench.action.reloadWindow'
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  4. Signature 4
    commands.executeCommand(command: 'workbench.action.openSettingsJson'): Promise<void>
    command: 'workbench.action.openSettingsJson'
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  5. Signature 5
    commands.executeCommand(command: 'editor.action.insertSnippet', edit: TextEdit, ultisnip?: UltiSnippetOption): Promise<boolean>
    command: 'editor.action.insertSnippet'
    No parameter description is present in the pinned declaration.
    edit: TextEdit

    Contains snippet text and range to replace.

    ultisnip?: UltiSnippetOption
    No parameter description is present in the pinned declaration.
    Returns
    Promise<boolean>
  6. Signature 6
    commands.executeCommand(command: 'editor.action.doCodeAction', action: CodeAction): Promise<void>
    command: 'editor.action.doCodeAction'
    No parameter description is present in the pinned declaration.
    action: CodeAction
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  7. Signature 7
    commands.executeCommand(command: 'editor.action.triggerSuggest', source?: string): Promise<void>
    command: 'editor.action.triggerSuggest'
    No parameter description is present in the pinned declaration.
    source?: string
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  8. Signature 8
    commands.executeCommand(command: 'editor.action.triggerParameterHints'): Promise<void>
    command: 'editor.action.triggerParameterHints'
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  9. Signature 9
    commands.executeCommand(command: 'editor.action.addRanges', ranges: Range[]): Promise<void>
    command: 'editor.action.addRanges'
    No parameter description is present in the pinned declaration.
    ranges: Range[]
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  10. Signature 10
    commands.executeCommand(command: 'editor.action.restart'): Promise<void>
    command: 'editor.action.restart'
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  11. Signature 11
    commands.executeCommand(command: 'editor.action.showReferences', uri: string | Uri, position: Position | undefined, locations: Location[]): Promise<void>
    command: 'editor.action.showReferences'
    No parameter description is present in the pinned declaration.
    uri: string | Uri
    No parameter description is present in the pinned declaration.
    position: Position | undefined
    No parameter description is present in the pinned declaration.
    locations: Location[]
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  12. Signature 12
    commands.executeCommand(command: 'editor.action.rename', uri: string | Uri, position: Position, newName?: string): Promise<void>
    command: 'editor.action.rename'
    No parameter description is present in the pinned declaration.
    uri: string | Uri
    No parameter description is present in the pinned declaration.
    position: Position
    No parameter description is present in the pinned declaration.
    newName?: string
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  13. Signature 13
    commands.executeCommand(command: 'editor.action.format'): Promise<void>
    command: 'editor.action.format'
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  14. Signature 14
    commands.executeCommand(command: 'editor.action.triggerInlineCompletion', option?: InlineCompletionOption): Promise<void>
    command: 'editor.action.triggerInlineCompletion'
    No parameter description is present in the pinned declaration.
    option?: InlineCompletionOption
    No parameter description is present in the pinned declaration.
    Returns
    Promise<void>
  15. Signature 15
    commands.executeCommand(command: 'editor.action.triggerNextEdit', option?: { provider?: string; autoTrigger?: boolean }): Promise<boolean>
    command: 'editor.action.triggerNextEdit'
    No parameter description is present in the pinned declaration.
    option?: { provider?: string; autoTrigger?: boolean }
    No parameter description is present in the pinned declaration.
    Returns
    Promise<boolean>

API signature

commands.executeCommand<T>(command: string, ...rest: any[]): Promise<T>

Parameters

ParameterTypeDescription
commandstring

Identifier of the command to execute.

...rest?any[]

Parameters passed to the command function.

Returns
Promise<T>

A promise that resolves to the returned value of the given command. undefined when the command handler function doesn't return anything.

Declaration
typings/index.d.ts:8026
API module

events API

All 6 public APIs exported from the events module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

events

events.pumAlignTop

Latest pum position, is true when pum positioned above current line.

Source

API signature

events.pumAlignTop: boolean
Returns
boolean
Declaration
typings/index.d.ts:8226
events

events.insertMode

Insert mode detected by latest events.

Source

API signature

events.insertMode: boolean
Returns
boolean
Declaration
typings/index.d.ts:8230
events

events.pumvisible

Popup menu is visible.

Source

API signature

events.pumvisible: boolean
Returns
boolean
Declaration
typings/index.d.ts:8235
events

events.race

Wait for any of event in events to fire, resolve undefined when timeout or CancellationToken requested.

Source

API signature

events.race(events: AllEvents[], timeoutOrToken?: number | CancellationToken): Promise<{ name: AllEvents, args: unknown[] } | undefined>

Parameters

ParameterTypeDescription
eventsAllEvents[]

Event names to wait.

timeoutOrToken?number | CancellationToken

Timeout in miniseconds or CancellationToken.

Returns
Promise<{ name: AllEvents, args: unknown[] } | undefined>

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8243
events

events.on

Attach handler to buffer events.

Source

Overloads (29)

  1. Signature 1
    events.on(event: BufEvents, handler: (bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: BufEvents
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  2. Signature 2
    events.on(event: MoveEvents, handler: (bufnr: number, cursor: [number, number], hasInsert: boolean) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: MoveEvents
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, cursor: [number, number], hasInsert: boolean) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  3. Signature 3
    events.on(event: HoldEvents, handler: (bufnr: number, cursor: [number, number], winid: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: HoldEvents
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, cursor: [number, number], winid: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  4. Signature 4
    events.on(event: InsertChangeEvents, handler: (bufnr: number, info: InsertChange) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: InsertChangeEvents
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, info: InsertChange) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  5. Signature 5
    events.on(event: WindowEvents, handler: (winid: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: WindowEvents
    No parameter description is present in the pinned declaration.
    handler: (winid: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  6. Signature 6
    events.on(event: WindowEvents, handler: (winid: number, bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: WindowEvents
    No parameter description is present in the pinned declaration.
    handler: (winid: number, bufnr: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  7. Signature 7
    events.on(event: 'FloatBtnClick', handler: (bufnr: number, index: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'FloatBtnClick'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, index: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  8. Signature 8
    events.on(event: 'PromptKeyPress', handler: (bufnr: number, key: PromptWidowKeys) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'PromptKeyPress'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, key: PromptWidowKeys) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  9. Signature 9
    events.on(event: 'TextChanged', handler: (bufnr: number, changedtick: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'TextChanged'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, changedtick: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  10. Signature 10
    events.on(event: 'TaskExit', handler: (id: string, code: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'TaskExit'
    No parameter description is present in the pinned declaration.
    handler: (id: string, code: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  11. Signature 11
    events.on(event: 'TaskStderr' | 'TaskStdout', handler: (id: string, lines: string[]) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'TaskStderr' | 'TaskStdout'
    No parameter description is present in the pinned declaration.
    handler: (id: string, lines: string[]) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  12. Signature 12
    events.on(event: 'BufReadCmd', handler: (scheme: string, fullpath: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'BufReadCmd'
    No parameter description is present in the pinned declaration.
    handler: (scheme: string, fullpath: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  13. Signature 13
    events.on(event: 'VimResized', handler: (columns: number, lines: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'VimResized'
    No parameter description is present in the pinned declaration.
    handler: (columns: number, lines: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  14. Signature 14
    events.on(event: 'MenuPopupChanged', handler: (event: PopupChangeEvent, cursorline: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'MenuPopupChanged'
    No parameter description is present in the pinned declaration.
    handler: (event: PopupChangeEvent, cursorline: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  15. Signature 15
    events.on(event: 'CompleteDone', handler: (item: VimCompleteItem & CompleteDoneItem | CompletionItem & CompleteDoneItem | {}) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'CompleteDone'
    No parameter description is present in the pinned declaration.
    handler: (item: VimCompleteItem & CompleteDoneItem | CompletionItem & CompleteDoneItem | {}) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  16. Signature 16
    events.on(event: 'CompleteStart', handler: (option: CompleteOption) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'CompleteStart'
    No parameter description is present in the pinned declaration.
    handler: (option: CompleteOption) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  17. Signature 17
    events.on(event: 'InsertCharPre', handler: (character: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'InsertCharPre'
    No parameter description is present in the pinned declaration.
    handler: (character: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  18. Signature 18
    events.on(event: 'FileType', handler: (filetype: string, bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'FileType'
    No parameter description is present in the pinned declaration.
    handler: (filetype: string, bufnr: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  19. Signature 19
    events.on(event: 'BufWinEnter' | 'BufWinLeave', handler: (bufnr: number, winid: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'BufWinEnter' | 'BufWinLeave'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, winid: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  20. Signature 20
    events.on(event: 'DirChanged', handler: (cwd: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'DirChanged'
    No parameter description is present in the pinned declaration.
    handler: (cwd: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  21. Signature 21
    events.on(event: 'OptionSet' | 'GlobalChange', handler: (option: string, oldVal: OptionValue, newVal: OptionValue) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'OptionSet' | 'GlobalChange'
    No parameter description is present in the pinned declaration.
    handler: (option: string, oldVal: OptionValue, newVal: OptionValue) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  22. Signature 22
    events.on(event: 'InputChar', handler: (session: string, character: string, mode: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'InputChar'
    No parameter description is present in the pinned declaration.
    handler: (session: string, character: string, mode: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  23. Signature 23
    events.on(event: 'PromptInsert', handler: (value: string, bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'PromptInsert'
    No parameter description is present in the pinned declaration.
    handler: (value: string, bufnr: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  24. Signature 24
    events.on(event: 'Command', handler: (name: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'Command'
    No parameter description is present in the pinned declaration.
    handler: (name: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  25. Signature 25
    events.on(event: 'WinScrolled', handler: (winid: number, bufnr: number, region: Readonly<[number, number]>) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'WinScrolled'
    No parameter description is present in the pinned declaration.
    handler: (winid: number, bufnr: number, region: Readonly<[number, number]>) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  26. Signature 26
    events.on(event: 'WindowVisible', handler: (event: VisibleEvent) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'WindowVisible'
    No parameter description is present in the pinned declaration.
    handler: (event: VisibleEvent) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  27. Signature 27
    events.on(event: 'TextInsert', handler: (bufnr: number, info: InsertChange, character: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'TextInsert'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, info: InsertChange, character: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  28. Signature 28
    events.on(event: EmptyEvents, handler: () => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: EmptyEvents
    No parameter description is present in the pinned declaration.
    handler: () => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  29. Signature 29
    events.on(event: AllEvents[], handler: (...args: unknown[]) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: AllEvents[]
    No parameter description is present in the pinned declaration.
    handler: (...args: unknown[]) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable

API signature

events.on(event: BufEvents, handler: (bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable

Parameters

ParameterType
eventBufEvents
handler(bufnr: number) => EventResult
thisArg?any
disposables?Disposable[]
Returns
Disposable
Declaration
typings/index.d.ts:8248
API module

languages API

All 31 public APIs exported from the languages module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

languages

languages.createDiagnosticCollection

Create a diagnostics collection.

Source

API signature

languages.createDiagnosticCollection(name?: string): DiagnosticCollection

Parameters

ParameterTypeDescription
name?string

The name of the collection.

Returns
DiagnosticCollection

A new diagnostic collection.

Declaration
typings/index.d.ts:8498
languages

languages.registerOnTypeFormattingEditProvider

Register a formatting provider that works on type. The provider is active when the user enables the setting coc.preferences.formatOnType.

Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

Source

API signature

languages.registerOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, triggerCharacters: string[]): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerOnTypeFormattingEditProvider

An on type formatting edit provider.

triggerCharactersstring[]

Trigger character that should trigger format on type.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8512
languages

languages.registerCompletionItemProvider

Registers an asynchronous in-memory or external completion source.

Source

API signature

languages.registerCompletionItemProvider(name: string, shortcut: string, selector: DocumentSelector | null, provider: CompletionItemProvider, triggerCharacters?: string[], priority?: number, allCommitCharacters?: string[]): Disposable

Example

import { languages, CompletionItem, CompletionItemKind, DocumentSelector } from 'coc.nvim';

export function activate(context) {
  const selector: DocumentSelector = [{ scheme: 'file', language: 'typescript' }];
  context.subscriptions.push(
    languages.registerCompletionItemProvider('customSource', 'MY', selector, {
      async provideCompletionItems(doc, position) {
        return [
          {
            label: 'awesomeCustomHelper',
            kind: CompletionItemKind.Function,
            detail: 'Custom fast utility',
            insertText: 'awesomeCustomHelper()'
          }
        ];
      }
    }, ['.'])
  );
}

Parameters

ParameterTypeDescription
namestring

Name of completion source.

shortcutstring

Shortcut used in completion menu.

selectorDocumentSelector | null

Document selector of created completion source.

providerCompletionItemProvider

A completion provider.

triggerCharacters?string[]

Trigger completion when the user types one of the characters.

priority?number

Higher priority would shown first.

allCommitCharacters?string[]

Commit characters of completion source.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8537
languages

languages.registerCodeActionProvider

Register a code action provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerCodeActionProvider(selector: DocumentSelector, provider: CodeActionProvider, clientId: string | undefined, codeActionKinds?: ReadonlyArray<string>): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerCodeActionProvider

A code action provider.

clientIdstring | undefined

Optional id of language client.

codeActionKinds?ReadonlyArray<string>

Optional supported code action kinds.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8552
languages

languages.registerHoverProvider

Register a hover provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerHoverProvider(selector: DocumentSelector, provider: HoverProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerHoverProvider

A hover provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8565
languages

languages.registerSelectionRangeProvider

Register a selection range provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerSelectionRangeProvider(selector: DocumentSelector, provider: SelectionRangeProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerSelectionRangeProvider

A selection range provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8578
languages

languages.registerSignatureHelpProvider

Register a signature help provider.

Multiple providers can be registered for a language. In that case providers are sorted by their score and called sequentially until a provider returns a valid result.

Source

API signature

languages.registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, triggerCharacters?: string[]): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerSignatureHelpProvider

A signature help provider.

triggerCharacters?string[]

Trigger signature help when the user types one of the characters, like , or (.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8592
languages

languages.registerDocumentSymbolProvider

Register a document symbol provider.

Multiple providers can be registered for a language. In that case providers only first provider are asked for result.

Source

API signature

languages.registerDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider, metadata?: DocumentSymbolProviderMetadata): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDocumentSymbolProvider

A document symbol provider.

metadata?DocumentSymbolProviderMetadata

Optional meta data.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8605
languages

languages.registerFoldingRangeProvider

Register a folding range provider.

Multiple providers can be registered for a language. In that case providers only first provider are asked for result.

A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerFoldingRangeProvider

A folding range provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8620
languages

languages.registerDocumentHighlightProvider

Register a document highlight provider.

Multiple providers can be registered for a language. In that case providers are sorted by their score and groups sequentially asked for document highlights. The process stops when a provider returns a non-falsy or non-failure result.

Source

API signature

languages.registerDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDocumentHighlightProvider

A document highlight provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8633
languages

languages.registerCodeLensProvider

Register a code lens provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerCodeLensProvider(selector: DocumentSelector, provider: CodeLensProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerCodeLensProvider

A code lens provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8646
languages

languages.registerDocumentLinkProvider

Register a document link provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDocumentLinkProvider

A document link provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8659
languages

languages.registerDocumentColorProvider

Register a color provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerDocumentColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDocumentColorProvider

A color provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8672
languages

languages.registerDefinitionProvider

Register a definition provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDefinitionProvider

A definition provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8685
languages

languages.registerDeclarationProvider

Register a declaration provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerDeclarationProvider(selector: DocumentSelector, provider: DeclarationProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDeclarationProvider

A declaration provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8698
languages

languages.registerTypeDefinitionProvider

Register a type definition provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerTypeDefinitionProvider

A type definition provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8712
languages

languages.registerImplementationProvider

Register an implementation provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerImplementationProvider

An implementation provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8725
languages

languages.registerReferencesProvider

Register a reference provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerReferencesProvider(selector: DocumentSelector, provider: ReferenceProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerReferenceProvider

A reference provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8738
languages

languages.registerRenameProvider

Register a rename provider.

Multiple providers can be registered for a language. In that case providers are sorted by their score and asked in sequence. The first provider producing a result defines the result of the whole operation.

Source

API signature

languages.registerRenameProvider(selector: DocumentSelector, provider: RenameProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerRenameProvider

A rename provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8751
languages

languages.registerWorkspaceSymbolProvider

Register a workspace symbol provider.

Multiple providers can be registered. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerWorkspaceSymbolProvider(provider: WorkspaceSymbolProvider): Disposable

Parameters

ParameterTypeDescription
providerWorkspaceSymbolProvider

A workspace symbol provider.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8763
languages

languages.registerDocumentFormatProvider

Register a formatting provider for a document.

Multiple providers can be registered for a language. In that case providers are sorted by their priority. Failure of the selected provider will cause a failure of the whole operation.

Source

API signature

languages.registerDocumentFormatProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider, priority?: number): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDocumentFormattingEditProvider

A document formatting edit provider.

priority?number

default to 0.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8776
languages

languages.registerDocumentRangeFormatProvider

Register a formatting provider for a document range.

Note: A document range provider is also a document formatter which means there is no need to register a document formatter when also registering a range provider.

Multiple providers can be registered for a language. In that case provider with highest priority is used. Failure of the selected provider will cause a failure of the whole operation.

Source

API signature

languages.registerDocumentRangeFormatProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider, priority?: number): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDocumentRangeFormattingEditProvider

A document range formatting edit provider.

priority?number

default to 0.

Returns
Disposable

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8793
languages

languages.registerCallHierarchyProvider

Register a call hierarchy provider.

Source

API signature

languages.registerCallHierarchyProvider(selector: DocumentSelector, provider: CallHierarchyProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerCallHierarchyProvider

A call hierarchy provider.

Returns
Disposable

A Disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8802
languages

languages.registerDocumentSemanticTokensProvider

Register a semantic tokens provider for a whole document.

Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

Source

API signature

languages.registerDocumentSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDocumentSemanticTokensProvider

A document semantic tokens provider.

legendSemanticTokensLegend
Returns
Disposable

A Disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8815
languages

languages.registerDocumentRangeSemanticTokensProvider

Register a semantic tokens provider for a document range.

Note: If a document has both a DocumentSemanticTokensProvider and a DocumentRangeSemanticTokensProvider, the range provider will be invoked only initially, for the time in which the full document provider takes to resolve the first request. Once the full document provider resolves the first request, the semantic tokens provided via the range provider will be discarded and from that point forward, only the document provider will be used.

Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

Source

API signature

languages.registerDocumentRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerDocumentRangeSemanticTokensProvider

A document range semantic tokens provider.

legendSemanticTokensLegend
Returns
Disposable

A Disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8834
languages

languages.registerLinkedEditingRangeProvider

Register a linked editing range provider.

Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider that has a result is used. Failure of the selected provider will cause a failure of the whole operation.

Source

API signature

languages.registerLinkedEditingRangeProvider(selector: DocumentSelector, provider: LinkedEditingRangeProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerLinkedEditingRangeProvider

A linked editing range provider.

Returns
Disposable

A Disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8847
languages

languages.registerInlayHintsProvider

Register a inlay hints provider.

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

Source

API signature

languages.registerInlayHintsProvider(selector: DocumentSelector, provider: InlayHintsProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerInlayHintsProvider

An inlay hints provider.

Returns
Disposable

A Disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8860
languages

languages.registerTypeHierarchyProvider

Register a type hierarchy provider.

Source

API signature

languages.registerTypeHierarchyProvider(selector: DocumentSelector, provider: TypeHierarchyProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerTypeHierarchyProvider

A type hierarchy provider.

Returns
Disposable

A Disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8869
languages

languages.registerInlineCompletionItemProvider

Register a inline completion item provider.

Source

API signature

languages.registerInlineCompletionItemProvider(selector: DocumentSelector, provider: InlineCompletionItemProvider): Disposable

Parameters

ParameterTypeDescription
selectorDocumentSelector

A selector that defines the documents this provider is applicable to.

providerInlineCompletionItemProvider

A InlineCompletion provider.

Returns
Disposable

A Disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8878
API module

services API

All 7 public APIs exported from the services module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

services

services.getService

Get service by id.

Source

API signature

services.getService(id: string): IServiceProvider

Parameters

ParameterType
idstring
Declaration
typings/index.d.ts:8958
services

services.stop

Stop service by id.

Source

API signature

services.stop(id: string): Promise<void>

Parameters

ParameterType
idstring
Returns
Promise<void>
Declaration
typings/index.d.ts:8962
services

services.toggle

Stop running service or start stopped service.

Source

API signature

services.toggle(id: string): Promise<void>

Parameters

ParameterType
idstring
Returns
Promise<void>
Declaration
typings/index.d.ts:8966
API module

sources API

All 10 public APIs exported from the sources module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

sources

sources.names

Names of registered sources.

Source

API signature

sources.names: ReadonlyArray<string>
Returns
ReadonlyArray<string>
Declaration
typings/index.d.ts:9268
sources

sources.sources

Field/Property sources.sources exported by sources.

Source

API signature

sources.sources: ReadonlyArray<ISource>
Returns
ReadonlyArray<ISource>
Declaration
typings/index.d.ts:9269
sources

sources.has

Check if source exists by name.

Source

API signature

sources.has(name: string): boolean

Parameters

ParameterType
namestring
Returns
boolean
Declaration
typings/index.d.ts:9273
sources

sources.getSource

Get source by name.

Source

API signature

sources.getSource(name: string): ISource | null

Parameters

ParameterType
namestring
Returns
ISource | null
Declaration
typings/index.d.ts:9277
sources

sources.addSource

Add source to sources list.

Note: Use sources.createSource() to register new source is recommended for user configuration support.

Source

API signature

sources.addSource(source: ISource): Disposable

Parameters

ParameterType
sourceISource
Returns
Disposable
Declaration
typings/index.d.ts:9285
sources

sources.createSource

Create source by source config, configurations starts with coc.source.{name} are automatically supported.

name and doComplete() must be provided in config.

Source

API signature

sources.createSource(config: SourceConfig): Disposable

Parameters

ParameterType
configSourceConfig
Returns
Disposable
Declaration
typings/index.d.ts:9293
sources

sources.sourceStats

Get list of all source stats.

Source

API signature

sources.sourceStats(): SourceStat[]
Returns
SourceStat[]
Declaration
typings/index.d.ts:9298
sources

sources.refresh

Call refresh for name source or all sources.

Source

API signature

sources.refresh(name?: string): Promise<void>

Parameters

ParameterType
name?string
Returns
Promise<void>
Declaration
typings/index.d.ts:9303
sources

sources.toggleSource

Toggle state of name source.

Source

API signature

sources.toggleSource(name: string): void

Parameters

ParameterType
namestring
Returns
void
Declaration
typings/index.d.ts:9308
sources

sources.removeSource

Remove source by name.

Source

API signature

sources.removeSource(name: string): void

Parameters

ParameterType
namestring
Returns
void
Declaration
typings/index.d.ts:9313
API module

workspace API

All 80 public APIs exported from the workspace module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

workspace

workspace.nvim

Type of pattern used by workspace folder.

Source

API signature

workspace.nvim: Neovim
Returns
Neovim
Declaration
typings/index.d.ts:10364
workspace

workspace.bufnr

Current buffer number, could be wrong since vim could not send autocmd as expected.

Deprecated will be removed in the feature.
Source

API signature

workspace.bufnr: number
Returns
number
Declaration
typings/index.d.ts:10371
workspace

workspace.document

Returns a Promise that resolves to the active buffer/document instance in Vim/Neovim.

Source

API signature

workspace.document: Promise<Document>

Example

import { workspace, ExtensionContext } from 'coc.nvim';

export async function activate(context: ExtensionContext) {
  // workspace.document returns a Promise, use await to get the active Document
  const doc = await workspace.document;
  if (doc) {
    console.log('Active document URI:', doc.uri);
    console.log('Language ID:', doc.filetype);
    console.log('Line count:', doc.lineCount);
  }
}
Returns
Promise<Document>
Declaration
typings/index.d.ts:10375
workspace

workspace.env

Environments or current (neo)vim.

Source

API signature

workspace.env: Env
Returns
Env
Declaration
typings/index.d.ts:10379
workspace

workspace.floatSupported

Float window or popup can work.

Source

API signature

workspace.floatSupported: boolean
Returns
boolean
Declaration
typings/index.d.ts:10383
workspace

workspace.cwd

Current working directory of vim.

Source

API signature

workspace.cwd: string
Returns
string
Declaration
typings/index.d.ts:10387
workspace

workspace.root

Current workspace root.

Source

API signature

workspace.root: string
Returns
string
Declaration
typings/index.d.ts:10391
workspace

workspace.rootPath

Field/Property workspace.rootPath exported by workspace.

Deprecated aliased to root.
Source

API signature

workspace.rootPath: string
Returns
string
Declaration
typings/index.d.ts:10395
workspace

workspace.isVim

Not neovim when true.

Source

API signature

workspace.isVim: boolean
Returns
boolean
Declaration
typings/index.d.ts:10399
workspace

workspace.isNvim

Is neovim when true.

Source

API signature

workspace.isNvim: boolean
Returns
boolean
Declaration
typings/index.d.ts:10403
workspace

workspace.filetypes

All filetypes of loaded documents.

Source

API signature

workspace.filetypes: ReadonlySet<string>
Returns
ReadonlySet<string>
Declaration
typings/index.d.ts:10407
workspace

workspace.languageIds

All languageIds of loaded documents.

Source

API signature

workspace.languageIds: ReadonlySet<string>
Returns
ReadonlySet<string>
Declaration
typings/index.d.ts:10411
workspace

workspace.pluginRoot

Root directory of coc.nvim

Source

API signature

workspace.pluginRoot: string
Returns
string
Declaration
typings/index.d.ts:10415
workspace

workspace.channelNames

Exists channel names.

Source

API signature

workspace.channelNames: ReadonlyArray<string>
Returns
ReadonlyArray<string>
Declaration
typings/index.d.ts:10419
workspace

workspace.documents

Loaded documents that attached.

Source

API signature

workspace.documents: ReadonlyArray<Document>
Returns
ReadonlyArray<Document>
Declaration
typings/index.d.ts:10423
workspace

workspace.textDocuments

Current document array.

Source

API signature

workspace.textDocuments: ReadonlyArray<LinesTextDocument>
Returns
ReadonlyArray<LinesTextDocument>
Declaration
typings/index.d.ts:10427
workspace

workspace.workspaceFolders

Current workspace folders.

Source

API signature

workspace.workspaceFolders: ReadonlyArray<WorkspaceFolder>
Returns
ReadonlyArray<WorkspaceFolder>
Declaration
typings/index.d.ts:10431
workspace

workspace.folderPaths

Directory paths of workspaceFolders.

Source

API signature

workspace.folderPaths: ReadonlyArray<string>
Returns
ReadonlyArray<string>
Declaration
typings/index.d.ts:10435
workspace

workspace.workspaceFolder

Current workspace folder, could be null when vim started from user's home.

Deprecated This API is deprecated.
Source

API signature

workspace.workspaceFolder: WorkspaceFolder | null
Returns
WorkspaceFolder | null
Declaration
typings/index.d.ts:10441
workspace

workspace.onDidCreateFiles

Field/Property workspace.onDidCreateFiles exported by workspace.

Source

API signature

workspace.onDidCreateFiles: Event<FileCreateEvent>
Declaration
typings/index.d.ts:10442
workspace

workspace.onDidRenameFiles

Field/Property workspace.onDidRenameFiles exported by workspace.

Source

API signature

workspace.onDidRenameFiles: Event<FileRenameEvent>
Declaration
typings/index.d.ts:10443
workspace

workspace.onDidDeleteFiles

Field/Property workspace.onDidDeleteFiles exported by workspace.

Source

API signature

workspace.onDidDeleteFiles: Event<FileDeleteEvent>
Declaration
typings/index.d.ts:10444
workspace

workspace.onDidOpenTextDocument

Event fired after document create.

Source

API signature

workspace.onDidOpenTextDocument: Event<LinesTextDocument & { bufnr: number }>
Returns
Event<LinesTextDocument & { bufnr: number }>
Declaration
typings/index.d.ts:10455
workspace

workspace.onDidCloseTextDocument

Event fired after document unload.

Source

API signature

workspace.onDidCloseTextDocument: Event<LinesTextDocument & { bufnr: number }>
Returns
Event<LinesTextDocument & { bufnr: number }>
Declaration
typings/index.d.ts:10459
workspace

workspace.onDidChangeConfiguration

Event fired on configuration change. Configuration change could by many reasons, including:

  • Changes detected from coc-settings.json.
  • Change to document that using another configuration file.
  • Configuration change by call update API of WorkspaceConfiguration.
Source

API signature

workspace.onDidChangeConfiguration: Event<ConfigurationChangeEvent>
Declaration
typings/index.d.ts:10481
workspace

workspace.onDidRuntimePathChange

Fired when vim's runtimepath change detected.

Source

API signature

workspace.onDidRuntimePathChange: Event<ReadonlyArray<string>>
Returns
Event<ReadonlyArray<string>>
Declaration
typings/index.d.ts:10486
workspace

workspace.asRelativePath

Returns a path that is relative to the workspace folder or folders.

When there are no workspace folders or when the path is not contained in them, the input is returned.

Source

API signature

workspace.asRelativePath(pathOrUri: string | Uri, includeWorkspaceFolder?: boolean): string

Parameters

ParameterTypeDescription
pathOrUristring | Uri

A path or uri. When a uri is given its fsPath is used.

includeWorkspaceFolder?boolean

When true and when the given path is contained inside a workspace folder the name of the workspace is prepended. Defaults to true when there are multiple workspace folders and false otherwise.

Returns
string

A path relative to the root or the input.

Declaration
typings/index.d.ts:10500
workspace

workspace.fixWin32unixFilepath

Returns converted unix path when the vim is built with win32unix enabled. Original fullpath is returned when the convert is not necessary. Only needed when the fullpath is passed vim directly.

Source

API signature

workspace.fixWin32unixFilepath(fullpath: string): string

Parameters

ParameterTypeDescription
fullpathstring

The filepath to fix, only windows absolute filepath is fixed.

Returns
string
Declaration
typings/index.d.ts:10508
workspace

workspace.openTextDocument

Opens a document. Will return early if this document is already open. Otherwise the document is loaded and the didOpen-event fires.

The document is denoted by an Uri. Depending on the scheme the following rules apply:

  • file-scheme: Open a file on disk (openTextDocument(Uri.file(path))). Will be rejected if the file does not exist or cannot be loaded.
  • untitled-scheme: Open a blank untitled file with associated path (openTextDocument(Uri.file(path).with({ scheme: 'untitled' }))). The language will be derived from the file name.
  • For all other schemes contributed TextDocumentContentProvider text document content providers and file system providers are consulted.

Note that the lifecycle of the returned document is owned by the editor and not by the extension. That means an onDidClose-event can occur at any time after opening it.

Source

Overloads (2)

  1. Signature 1
    workspace.openTextDocument(uri: Uri): Thenable<Document>
    uri: Uri

    Identifies the resource to open.

  2. Signature 2
    workspace.openTextDocument(fileName: string): Thenable<Document>
    fileName: string

    A name of a file on disk.

API signature

workspace.openTextDocument(uri: Uri): Thenable<Document>

Parameters

ParameterTypeDescription
uriUri

Identifies the resource to open.

Returns
Thenable<Document>

A promise that resolves to a document.

Declaration
typings/index.d.ts:10529
workspace

workspace.getDisplayWidth

Get display cell count of text on vim. Control character below 0x80 are considered as 1.

Source

API signature

workspace.getDisplayWidth(text: string, cache?: boolean): number

Parameters

ParameterTypeDescription
textstring

Text to display.

cache?boolean
Returns
number

The cells count.

Declaration
typings/index.d.ts:10547
workspace

workspace.has

Like vim's has(), but for version check only. Check patch on neovim and check nvim on vim would return false.

For example:

  • has('nvim-0.6.0')
  • has('patch-7.4.248')
Source

API signature

workspace.has(feature: string): boolean

Parameters

ParameterType
featurestring
Returns
boolean
Declaration
typings/index.d.ts:10557
workspace

workspace.registerAutocmd

Register autocmd on vim.

Note: avoid request autocmd when possible since vim could be blocked forever when request triggered during request.

Source

API signature

workspace.registerAutocmd(autocmd: Autocmd, disposables?: Disposable[]): Disposable

Parameters

ParameterType
autocmdAutocmd
disposables?Disposable[]
Returns
Disposable
Declaration
typings/index.d.ts:10565
workspace

workspace.watchOption

Watch for vim's global option change.

Source

API signature

workspace.watchOption(key: string, callback: (oldValue: any, newValue: any) => Thenable<void> | void, disposables?: Disposable[]): void

Parameters

ParameterType
keystring
callback(oldValue: any, newValue: any) => Thenable<void> | void
disposables?Disposable[]
Returns
void
Declaration
typings/index.d.ts:10570
workspace

workspace.watchGlobal

Watch for vim's global variable change, works on neovim only.

Source

API signature

workspace.watchGlobal(key: string, callback?: (oldValue: any, newValue: any) => Thenable<void> | void, disposables?: Disposable[]): void

Parameters

ParameterType
keystring
callback?(oldValue: any, newValue: any) => Thenable<void> | void
disposables?Disposable[]
Returns
void
Declaration
typings/index.d.ts:10575
workspace

workspace.findUp

Findup from filename or filenames from current filepath or root.

Source

API signature

workspace.findUp(filename: string | string[]): Promise<string | null>

Parameters

ParameterType
filenamestring | string[]
Returns
Promise<string | null>

fullpath of file or null when not found.

Declaration
typings/index.d.ts:10587
workspace

workspace.getWatchmanPath

Get possible watchman binary path.

Source

API signature

workspace.getWatchmanPath(): string | null
Returns
string | null
Declaration
typings/index.d.ts:10592
workspace

workspace.getConfiguration

Retrieve scoped user or workspace settings from coc-settings.json.

Source

API signature

workspace.getConfiguration(section?: string, scope?: ConfigurationScope): WorkspaceConfiguration

Example

import { workspace } from 'coc.nvim';

export function activate() {
  const config = workspace.getConfiguration('myextension');
  const isEnabled = config.get<boolean>('enable', true);
  console.log('Feature enabled:', isEnabled);
}

Parameters

ParameterType
section?string
scope?ConfigurationScope
Declaration
typings/index.d.ts:10597
workspace

workspace.resolveJSONSchema

Resolve internal json schema, uri should starts with vscode://

Source

API signature

workspace.resolveJSONSchema(uri: string): any

Parameters

ParameterType
uristring
Returns
any
Declaration
typings/index.d.ts:10602
workspace

workspace.getDocument

Get created document by uri or bufnr.

Source

API signature

workspace.getDocument(uri: number | string): Document | null | undefined

Parameters

ParameterType
urinumber | string
Returns
Document | null | undefined
Declaration
typings/index.d.ts:10606
workspace

workspace.applyEdit

Applies workspace file edits across open and unopened files using coc.nvim buffer handling.

Source

API signature

workspace.applyEdit(edit: WorkspaceEdit, metadata?: WorkspaceEditMetadata): Promise<boolean>

Example

import { workspace, WorkspaceEdit } from 'coc.nvim';

export async function activate() {
  const edit: WorkspaceEdit = {
    changes: {
      'file:///path/to/file.ts': [
        {
          range: { start: { line: 0, character: 0 }, end: { line: 0, character: 5 } },
          newText: 'const'
        }
      ]
    }
  };
  await workspace.applyEdit(edit);
}

Parameters

ParameterType
editWorkspaceEdit
metadata?WorkspaceEditMetadata
Returns
Promise<boolean>
Declaration
typings/index.d.ts:10611
workspace

workspace.getQuickfixItem

Convert location to quickfix item.

Source

API signature

workspace.getQuickfixItem(loc: Location | LocationLink, text?: string, type?: string, module?: string): Promise<QuickfixItem>

Parameters

ParameterType
locLocation | LocationLink
text?string
type?string
module?string
Returns
Promise<QuickfixItem>
Declaration
typings/index.d.ts:10616
workspace

workspace.getQuickfixList

Convert locations to quickfix list.

Source

API signature

workspace.getQuickfixList(locations: Location[]): Promise<ReadonlyArray<QuickfixItem>>

Parameters

ParameterType
locationsLocation[]
Returns
Promise<ReadonlyArray<QuickfixItem>>
Declaration
typings/index.d.ts:10621
workspace

workspace.showLocations

Populate locations to UI.

Source

API signature

workspace.showLocations(locations: Location[]): Promise<void>

Parameters

ParameterType
locationsLocation[]
Returns
Promise<void>
Declaration
typings/index.d.ts:10626
workspace

workspace.getLine

Get content of line by uri and line.

Source

API signature

workspace.getLine(uri: string, line: number): Promise<string>

Parameters

ParameterType
uristring
linenumber
Returns
Promise<string>
Declaration
typings/index.d.ts:10631
workspace

workspace.getWorkspaceFolder

Get WorkspaceFolder of uri

Source

API signature

workspace.getWorkspaceFolder(uri: string | Uri): WorkspaceFolder | undefined

Parameters

ParameterType
uristring | Uri
Returns
WorkspaceFolder | undefined
Declaration
typings/index.d.ts:10636
workspace

workspace.readFile

Get content from buffer or file by uri.

Source

API signature

workspace.readFile(uri: string): Promise<string>

Parameters

ParameterType
uristring
Returns
Promise<string>
Declaration
typings/index.d.ts:10641
workspace

workspace.getCurrentState

Get current document and position.

Source

API signature

workspace.getCurrentState(): Promise<EditerState>
Returns
Promise<EditerState>
Declaration
typings/index.d.ts:10646
workspace

workspace.getFormatOptions

Get format options of uri or current buffer.

Source

API signature

workspace.getFormatOptions(uri?: string): Promise<FormattingOptions>

Parameters

ParameterType
uri?string
Returns
Promise<FormattingOptions>
Declaration
typings/index.d.ts:10651
workspace

workspace.jumpTo

Jump to location.

Source

API signature

workspace.jumpTo(uri: string | Uri, position?: Position | null, openCommand?: string): Promise<void>

Parameters

ParameterType
uristring | Uri
position?Position | null
openCommand?string
Returns
Promise<void>
Declaration
typings/index.d.ts:10656
workspace

workspace.createFile

Create a file in vim and disk

Source

API signature

workspace.createFile(filepath: string, opts?: CreateFileOptions): Promise<void>

Parameters

ParameterType
filepathstring
opts?CreateFileOptions
Returns
Promise<void>
Declaration
typings/index.d.ts:10661
workspace

workspace.loadFile

Load uri as document, buffer would be invisible if not loaded.

Source

API signature

workspace.loadFile(uri: string, cmd?: string): Promise<Document>

Parameters

ParameterTypeDescription
uristring

Uri of the document.

cmd?string

Open command used to load the resource, e.g. edit, tabe or drop.

Returns
Promise<Document>
Declaration
typings/index.d.ts:10669
workspace

workspace.loadFiles

Load the files that not loaded

Source

API signature

workspace.loadFiles(uris: string[]): Promise<(Document | undefined)[]>

Parameters

ParameterType
urisstring[]
Returns
Promise<(Document | undefined)[]>
Declaration
typings/index.d.ts:10674
workspace

workspace.renameFile

Rename file in vim and disk

Source

API signature

workspace.renameFile(oldPath: string, newPath: string, opts?: RenameFileOptions): Promise<void>

Parameters

ParameterType
oldPathstring
newPathstring
opts?RenameFileOptions
Returns
Promise<void>
Declaration
typings/index.d.ts:10679
workspace

workspace.deleteFile

Delete file from vim and disk.

Source

API signature

workspace.deleteFile(filepath: string, opts?: DeleteFileOptions): Promise<void>

Parameters

ParameterType
filepathstring
opts?DeleteFileOptions
Returns
Promise<void>
Declaration
typings/index.d.ts:10684
workspace

workspace.openResource

Open resource by uri

Source

API signature

workspace.openResource(uri: string): Promise<void>

Parameters

ParameterType
uristring
Returns
Promise<void>
Declaration
typings/index.d.ts:10689
workspace

workspace.resolveModule

Resolve full path of module from yarn or npm global directory.

Source

API signature

workspace.resolveModule(name: string): Promise<string>

Parameters

ParameterType
namestring
Returns
Promise<string>
Declaration
typings/index.d.ts:10694
workspace

workspace.runCommand

Run nodejs command

Source

API signature

workspace.runCommand(cmd: string, cwd?: string, timeout?: number): Promise<string>

Parameters

ParameterType
cmdstring
cwd?string
timeout?number
Returns
Promise<string>
Declaration
typings/index.d.ts:10699
workspace

workspace.expand

Expand filepath with ~ and/or environment placeholders

Source

API signature

workspace.expand(filepath: string): string

Parameters

ParameterType
filepathstring
Returns
string
Declaration
typings/index.d.ts:10704
workspace

workspace.callAsync

Call a function by use notifications, useful for functions like |input| that could block vim.

Source

API signature

workspace.callAsync<T>(method: string, args: any[]): Promise<T>

Parameters

ParameterType
methodstring
argsany[]
Returns
Promise<T>
Declaration
typings/index.d.ts:10709
workspace

workspace.registerKeymap

Register unique global key-mapping with <Plug>(coc-{key}) as lhs. 'noremap' is always used, Throw error when {key} already exists.

Source

API signature

workspace.registerKeymap(modes: MapMode[], key: string, fn: () => ProviderResult<any>, opts?: KeymapOption): Disposable

Parameters

ParameterTypeDescription
modesMapMode[]

Array of map mode short-name.

keystring

Unique name, should only use alphabetical characters and '-'.

fn() => ProviderResult<any>

Callback function.

opts?KeymapOption

Optional option.

Returns
Disposable
Declaration
typings/index.d.ts:10726
workspace

workspace.registerExprKeymap

Register expr mapping global or local to buffer.

Unlike :map, space in {lhs} is accepted as part of the {lhs}, keycodes are replaced are usual. 'noremap' and map arguments <silent>, <nowait> are always used.

Source

API signature

workspace.registerExprKeymap(mode: MapMode, rhs: string, fn: () => ProviderResult<string>, buffer?: number | boolean, cancel?: boolean): Disposable

Parameters

ParameterTypeDescription
modeMapMode

Mode short-name.

rhsstring

rhs of key-mapping.

fn() => ProviderResult<string>

callback function.

buffer?number | boolean

Buffer number or current buffer by use true or 0, default to false.

cancel?boolean

Cancel pupop menu before invoke callback, insert mode only, define to true.

Returns
Disposable
Declaration
typings/index.d.ts:10742
workspace

workspace.registerInsertKeymap

Register a dynamic insert-mode mapping.

The callback runs at the mapping's execution point and returns literal text and special keys to execute in order. Use option.arglist to pass current editor state without making nested editor requests. The callback must not change text, switch windows, or run :normal while the expression mapping is being evaluated.

Vim cannot guarantee ordering for channel-backed expression results during batched :normal or macro input.

Source

API signature

workspace.registerInsertKeymap(key: string, fn: (...args: any[]) => ProviderResult<InsertKeymapResult>, option?: InsertKeymapOption): Disposable

Parameters

ParameterTypeDescription
keystring

lhs of the insert-mode mapping.

fn(...args: any[]) => ProviderResult<InsertKeymapResult>

callback receiving evaluated arglist values and returning ordered text/key parts.

option?InsertKeymapOption

Mapping options.

Returns
Disposable
Declaration
typings/index.d.ts:10760
workspace

workspace.registerLocalKeymap

Register local keymap with callback.

Unlike :map, space in {lhs} is accepted as part of the {lhs}, keycodes are replaced are usual. 'noremap' and map arguments <nowait> are always used.

Source

API signature

workspace.registerLocalKeymap(bufnr: number, mode: 'n' | 'i' | 'v' | 's' | 'x', lhs: string, fn: () => ProviderResult<any>, opts?: KeymapOption | boolean): Disposable

Parameters

ParameterTypeDescription
bufnrnumber

buffer number, use 0 for current buffer.

mode'n' | 'i' | 'v' | 's' | 'x'

mode short-name.

lhsstring

lhs of key-mapping.

fn() => ProviderResult<any>

callback function.

opts?KeymapOption | boolean

Optional option, when it's boolean value, indicate use notification or not.

Returns
Disposable
Declaration
typings/index.d.ts:10776
workspace

workspace.registerBufferSync

Register for buffer sync objects, created sync object should be disposable and provide optional event handlers:

  • onChange called on onDidChangeTextDocument event.
  • onTextChange called on line change event from vim.
  • onVisible called on WindowVisible event.

The document is always attached and not command line buffer.

Source

API signature

workspace.registerBufferSync<T extends BufferSyncItem>(create: (doc: Document) => T | undefined): BufferSync<T>

Parameters

ParameterTypeDescription
create(doc: Document) => T | undefined

Called for each attached document and on document create.

Returns
BufferSync<T>

Disposable

Declaration
typings/index.d.ts:10791
workspace

workspace.createFuzzyMatch

Create a FuzzyMatch instance using wasm module. The FuzzyMatch does the same match algorithm as vim's :h matchfuzzypos()

Source

API signature

workspace.createFuzzyMatch(): FuzzyMatch
Returns
FuzzyMatch
Declaration
typings/index.d.ts:10797
workspace

workspace.computeWordRanges

Compute word ranges of opened document in specified range.

Source

API signature

workspace.computeWordRanges(uri: string | number, range: Range, token?: CancellationToken): Promise<{ [word: string]: Range[] } | null>

Parameters

ParameterTypeDescription
uristring | number

Uri of resource

rangeRange

Range of resource

token?CancellationToken
Returns
Promise<{ [word: string]: Range[] } | null>

| null>}

Declaration
typings/index.d.ts:10807
workspace

workspace.createFileSystemWatcher

Create a FileSystemWatcher instance, when watchman doesn't exist, the returned FileSystemWatcher can still be used, but not work at all.

Source

API signature

workspace.createFileSystemWatcher(globPattern: GlobPattern, ignoreCreate?: boolean, ignoreChange?: boolean, ignoreDelete?: boolean): FileSystemWatcher

Parameters

ParameterType
globPatternGlobPattern
ignoreCreate?boolean
ignoreChange?boolean
ignoreDelete?boolean
Declaration
typings/index.d.ts:10812
workspace

workspace.findFiles

Find files across all workspace folders in the workspace.

Source

API signature

workspace.findFiles(include: GlobPattern, exclude?: GlobPattern | null, maxResults?: number, token?: CancellationToken): Thenable<Uri[]>

Example

findFiles('**​/*.js', '**​/node_modules/**', 10)

Parameters

ParameterTypeDescription
includeGlobPattern

A glob pattern that defines the files to search for. The glob pattern will be matched against the file paths of resulting matches relative to their workspace. Use a relative pattern to restrict the search results to a workspace folder.

exclude?GlobPattern | null

A glob pattern that defines files and folders to exclude. The glob pattern will be matched against the file paths of resulting matches relative to their workspace. When undefined ornull, no excludes will apply.

maxResults?number

An upper-bound for the result.

token?CancellationToken

A token that can be used to signal cancellation to the underlying search engine.

Returns
Thenable<Uri[]>

A thenable that resolves to an array of resource identifiers. Will return no results if no workspace folders are opened.

Declaration
typings/index.d.ts:10830
workspace

workspace.createMru

Create persistence Mru instance.

Source

API signature

workspace.createMru(name: string): Mru

Parameters

ParameterType
namestring
Returns
Mru
Declaration
typings/index.d.ts:10835
workspace

workspace.createTask

Create Task instance that runs in (neo)vim, no shell.

Source

API signature

workspace.createTask(id: string): Task

Parameters

ParameterTypeDescription
idstring

Unique id string, like TSC

Returns
Task
Declaration
typings/index.d.ts:10842
workspace

workspace.createDatabase

Create DB instance at extension root.

Source

API signature

workspace.createDatabase(name: string): JsonDB

Parameters

ParameterType
namestring
Returns
JsonDB
Declaration
typings/index.d.ts:10847
API module

window API

All 40 public APIs exported from the window module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

window

window.activeTextEditor

The currently active editor or undefined. The active editor is the one that currently has focus or, when none has focus, the one that has changed input most recently.

Source

API signature

window.activeTextEditor: TextEditor | undefined
Returns
TextEditor | undefined
Declaration
typings/index.d.ts:11689
window

window.visibleTextEditors

The currently visible editors or an empty array.

Source

API signature

window.visibleTextEditors: readonly TextEditor[]
Returns
readonly TextEditor[]
Declaration
typings/index.d.ts:11694
window

window.onDidChangeActiveTextEditor

An Event which fires when the active editor has changed. Note that the event also fires when the active editor changes to undefined.

Source

API signature

window.onDidChangeActiveTextEditor: Event<TextEditor | undefined>
Returns
Event<TextEditor | undefined>
Declaration
typings/index.d.ts:11701
window

window.terminals

The currently opened terminals or an empty array. onDidChangeTerminalState doesn't exist since we can't detect window resize on vim.

Source

API signature

window.terminals: readonly Terminal[]
Returns
readonly Terminal[]
Declaration
typings/index.d.ts:11713
window

window.onDidOpenTerminal

Event fired after terminal created, only fired with Terminal that created by window.createTerminal

Source

API signature

window.onDidOpenTerminal: Event<Terminal>
Returns
Event<Terminal>
Declaration
typings/index.d.ts:11719
window

window.onDidCloseTerminal

Event fired on terminal close, only fired with Terminal that created by window.createTerminal

Source

API signature

window.onDidCloseTerminal: Event<Terminal>
Returns
Event<Terminal>
Declaration
typings/index.d.ts:11725
window

window.createTerminal

Creates a Terminal with a backing shell process. The terminal is created by (neo)vim.

Source

API signature

window.createTerminal(opts: TerminalOptions): Promise<Terminal>

Parameters

ParameterTypeDescription
optsTerminalOptions

A TerminalOptions object describing the characteristics of the new terminal.

Returns
Promise<Terminal>

A new Terminal. @throws When running in an environment where a new process cannot be started.

Declaration
typings/index.d.ts:11735
window

window.createFloatFactory

Create float window factory for create float window/popup around current cursor. Configuration "floatFactory.floatConfig" is used as default float config. Configuration "coc.preferences.excludeImageLinksInMarkdownDocument" is also used.

Float windows are automatic reused and hidden on specific events including:

  • BufEnter
  • InsertEnter
  • InsertLeave
  • MenuPopupChanged
  • CursorMoved
  • CursorMovedI
Source

API signature

window.createFloatFactory(conf: FloatWinConfig): FloatFactory

Parameters

ParameterTypeDescription
confFloatWinConfig

Configuration of float window.

Returns
FloatFactory

FloatFactory

Declaration
typings/index.d.ts:11754
window

window.runTerminalCommand

Run command in vim terminal for result

Source

API signature

window.runTerminalCommand(cmd: string, cwd?: string, keepfocus?: boolean): Promise<TerminalResult>

Parameters

ParameterTypeDescription
cmdstring

Command to run.

cwd?string

Cwd of terminal, default to result of |getcwd()|.

keepfocus?boolean
Returns
Promise<TerminalResult>
Declaration
typings/index.d.ts:11771
window

window.openTerminal

Open terminal window.

Source

API signature

window.openTerminal(cmd: string, opts?: OpenTerminalOption): Promise<number>

Parameters

ParameterTypeDescription
cmdstring

Command to run.

opts?OpenTerminalOption

Terminal option.

Returns
Promise<number>

buffer number of terminal.

Declaration
typings/index.d.ts:11780
window

window.showQuickpick

Show quickpick for single item, use window.menuPick for menu at current current position. Use window.showPickerDialog() for multiple selection.

Deprecated use window.showQuickPick() instead.
Source

API signature

window.showQuickpick(items: string[], placeholder?: string): Promise<number>

Parameters

ParameterTypeDescription
itemsstring[]

Label list.

placeholder?string

Prompt text, default to 'choose by number'.

Returns
Promise<number>

Index of selected item, or -1 when canceled.

Declaration
typings/index.d.ts:11791
window

window.showQuickPick

Shows a selection list allowing multiple selections.

Source

Overloads (4)

  1. Signature 1
    window.showQuickPick(items: readonly string[] | Thenable<readonly string[]>, options: QuickPickOptions & { canPickMany: true }, token?: CancellationToken): Thenable<string[] | undefined>
    items: readonly string[] | Thenable<readonly string[]>

    An array of strings, or a promise that resolves to an array of strings.

    options: QuickPickOptions & { canPickMany: true }

    Configures the behavior of the selection list.

    token?: CancellationToken

    A token that can be used to signal cancellation.

    Returns
    Thenable<string[] | undefined>
  2. Signature 2
    window.showQuickPick(items: readonly string[] | Thenable<readonly string[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<string | undefined>
    items: readonly string[] | Thenable<readonly string[]>

    An array of strings, or a promise that resolves to an array of strings.

    options?: QuickPickOptions

    Configures the behavior of the selection list.

    token?: CancellationToken

    A token that can be used to signal cancellation.

    Returns
    Thenable<string | undefined>
  3. Signature 3
    window.showQuickPick<T extends QuickPickItem>(items: readonly T[] | Thenable<readonly T[]>, options: QuickPickOptions & { canPickMany: true }, token?: CancellationToken): Thenable<T[] | undefined>
    items: readonly T[] | Thenable<readonly T[]>

    An array of items, or a promise that resolves to an array of items.

    options: QuickPickOptions & { canPickMany: true }

    Configures the behavior of the selection list.

    token?: CancellationToken

    A token that can be used to signal cancellation.

    Returns
    Thenable<T[] | undefined>
  4. Signature 4
    window.showQuickPick<T extends QuickPickItem>(items: readonly T[] | Thenable<readonly T[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<T | undefined>
    items: readonly T[] | Thenable<readonly T[]>

    An array of items, or a promise that resolves to an array of items.

    options?: QuickPickOptions

    Configures the behavior of the selection list.

    token?: CancellationToken

    A token that can be used to signal cancellation.

    Returns
    Thenable<T | undefined>

API signature

window.showQuickPick(items: readonly string[] | Thenable<readonly string[]>, options: QuickPickOptions & { canPickMany: true }, token?: CancellationToken): Thenable<string[] | undefined>

Parameters

ParameterTypeDescription
itemsreadonly string[] | Thenable<readonly string[]>

An array of strings, or a promise that resolves to an array of strings.

optionsQuickPickOptions & { canPickMany: true }

Configures the behavior of the selection list.

token?CancellationToken

A token that can be used to signal cancellation.

Returns
Thenable<string[] | undefined>

A promise that resolves to the selected items or undefined.

Declaration
typings/index.d.ts:11801
window

window.showMenuPicker

Show menu picker at current cursor position, |inputlist()| is used as fallback.

Source

API signature

window.showMenuPicker(items: string[] | MenuItem[], option?: MenuOption | string, token?: CancellationToken): Promise<number>

Parameters

ParameterTypeDescription
itemsstring[] | MenuItem[]

Array of texts or menu items.

option?MenuOption | string

Optional config of the picker, a string is treated as the title of the window.

token?CancellationToken

A token that can be used to signal cancellation.

Returns
Promise<number>

Selected index (0 based), -1 when canceled.

Declaration
typings/index.d.ts:11841
window

window.showPrompt

Prompt user for confirm, a float/popup window would be used when possible, use vim's |confirm()| function as callback.

Source

API signature

window.showPrompt(title: string): Promise<boolean>

Parameters

ParameterTypeDescription
titlestring

The prompt text.

Returns
Promise<boolean>

Result of confirm.

Declaration
typings/index.d.ts:11850
window

window.showDialog

Show dialog window at the center of screen. Note that the dialog would always be closed after button click.

Source

API signature

window.showDialog(config: DialogConfig): Promise<Dialog | null>

Parameters

ParameterTypeDescription
configDialogConfig

Dialog configuration.

Returns
Promise<Dialog | null>

Dialog or null when dialog can't work.

Declaration
typings/index.d.ts:11859
window

window.requestInput

Request input from user, input() is used when window.env.dialog not true.

Source

API signature

window.requestInput(title: string, defaultValue?: string, option?: InputOptions): Promise<string>

Parameters

ParameterTypeDescription
titlestring

Title text of prompt window.

defaultValue?string

Default value of input, empty text by default.

option?InputOptions

for input window, other preferences are read from user configuration.

Returns
Promise<string>
Declaration
typings/index.d.ts:11868
window

window.createInputBox

Creates and show a InputBox to let the user enter some text input.

Source

API signature

window.createInputBox(title: string, defaultValue?: string, option?: InputPreference): Promise<InputBox>

Parameters

ParameterType
titlestring
defaultValue?string
option?InputPreference
Returns
Promise<InputBox>

A new InputBox.

Declaration
typings/index.d.ts:11875
window

window.createQuickPick

Creates and show a QuickPick to let the user pick an item or items from a list of items of type T.

Note that in many cases the more convenient window.showQuickPick is easier to use. window.createQuickPick should be used when window.showQuickPick does not offer the required flexibility.

Note that unlike VSCode, promise is returned for wait other inputs finished.

Source

API signature

window.createQuickPick<T extends QuickPickItem>(config?: QuickPickConfig<T>): Promise<QuickPick<T>>

Parameters

ParameterTypeDescription
config?QuickPickConfig<T>

Deprecated: config of quickpick, use properties of QuickPick instance instead.

Returns
Promise<QuickPick<T>>

A new QuickPick.

Declaration
typings/index.d.ts:11890
window

window.createStatusBarItem

Create statusbar item that would be included in g:coc_status.

Source

API signature

window.createStatusBarItem(priority?: number, option?: StatusItemOption): StatusBarItem

Parameters

ParameterTypeDescription
priority?number

Higher priority item would be shown right.

option?StatusItemOption
Returns
StatusBarItem

A new status bar item.

Declaration
typings/index.d.ts:11899
window

window.openLocalConfig

Open local config file

Source

API signature

window.openLocalConfig(): Promise<void>
Returns
Promise<void>
Declaration
typings/index.d.ts:11904
window

window.createOutputChannel

Create a new output channel

Source

API signature

window.createOutputChannel(name: string): OutputChannel

Parameters

ParameterTypeDescription
namestring

Unique name of output channel.

Returns
OutputChannel

A new output channel.

Declaration
typings/index.d.ts:11912
window

window.createTreeView

Create a TreeView instance, call show() method to render.

Source

API signature

window.createTreeView<T>(viewId: string, options: TreeViewOptions<T>): TreeView<T>

Parameters

ParameterTypeDescription
viewIdstring

Id of the view, used as title of TreeView when title doesn't exist.

optionsTreeViewOptions<T>

Options for creating the TreeView

Returns
TreeView<T>
Declaration
typings/index.d.ts:11921
window

window.showOutputChannel

Reveal buffer of output channel.

Source

API signature

window.showOutputChannel(name: string, cmd?: string, preserveFocus?: boolean): void

Parameters

ParameterTypeDescription
namestring

Name of output channel.

cmd?string

Command used to reveal the output channel, default to vs.

preserveFocus?boolean

Preserve window focus when true.

Returns
void
Declaration
typings/index.d.ts:11930
window

window.echoLines

Echo lines at the bottom of vim.

Source

API signature

window.echoLines(lines: string[], truncate?: boolean): Promise<void>

Parameters

ParameterTypeDescription
linesstring[]

Line list.

truncate?boolean

Truncate the lines to avoid 'press enter to continue' when true

Returns
Promise<void>
Declaration
typings/index.d.ts:11938
window

window.getCursorPosition

Get current cursor position (line, character both 0 based).

Source

API signature

window.getCursorPosition(): Promise<Position>
Returns
Promise<Position>

Cursor position.

Declaration
typings/index.d.ts:11945
window

window.moveTo

Move cursor to position (line, character both 0 based).

Source

API signature

window.moveTo(position: Position): Promise<void>

Parameters

ParameterTypeDescription
positionPosition

LSP position.

Returns
Promise<void>
Declaration
typings/index.d.ts:11952
window

window.getOffset

Get current cursor character offset in document, length of line break would always be 1.

Source

API signature

window.getOffset(): Promise<number>
Returns
Promise<number>

Character offset.

Declaration
typings/index.d.ts:11960
window

window.getCursorScreenPosition

Get screen position of current cursor(relative to editor), both row and col are 0 based.

Source

API signature

window.getCursorScreenPosition(): Promise<ScreenPosition>
Returns
Promise<ScreenPosition>

Cursor screen position.

Declaration
typings/index.d.ts:11968
window

window.showPickerDialog

Show multiple picker at center of screen.

Source

Overloads (2)

  1. Signature 1
    window.showPickerDialog(items: string[], title: string, token?: CancellationToken): Promise<string[] | undefined>
    items: string[]

    A set of items that will be rendered as actions in the message.

    title: string

    Title of picker dialog.

    token?: CancellationToken

    A token that can be used to signal cancellation.

    Returns
    Promise<string[] | undefined>
  2. Signature 2
    window.showPickerDialog<T extends QuickPickItem>(items: T[], title: string, token?: CancellationToken): Promise<T[] | undefined>
    items: T[]

    A set of items that will be rendered as actions in the message.

    title: string

    Title of picker dialog.

    token?: CancellationToken

    A token that can be used to signal cancellation.

    Returns
    Promise<T[] | undefined>

API signature

window.showPickerDialog(items: string[], title: string, token?: CancellationToken): Promise<string[] | undefined>

Parameters

ParameterTypeDescription
itemsstring[]

A set of items that will be rendered as actions in the message.

titlestring

Title of picker dialog.

token?CancellationToken

A token that can be used to signal cancellation.

Returns
Promise<string[] | undefined>

A promise that resolves to the selected items or undefined.

Declaration
typings/index.d.ts:11978
window

window.showInformationMessage

Shows an information message using coc.nvim message behavior and returns the selected action, when provided.

Source

Overloads (2)

  1. Signature 1
    window.showInformationMessage(message: string, ...items: string[]): Promise<string | undefined>
    message: string

    The message to show.

    ...items?: string[]

    A set of items that will be rendered as actions in the message.

    Returns
    Promise<string | undefined>
  2. Signature 2
    window.showInformationMessage<T extends MessageItem>(message: string, ...items: T[]): Promise<T | undefined>
    message: string

    The message to show.

    ...items?: T[]

    A set of items that will be rendered as actions in the message.

    Returns
    Promise<T | undefined>

API signature

window.showInformationMessage(message: string, ...items: string[]): Promise<string | undefined>

Example

import { window } from 'coc.nvim';

export async function activate() {
  const choice = await window.showInformationMessage(
    'Build completed successfully. Run tests now?',
    'Yes',
    'No'
  );
  if (choice === 'Yes') {
    // run tests
  }
}

Parameters

ParameterTypeDescription
messagestring

The message to show.

...items?string[]

A set of items that will be rendered as actions in the message.

Returns
Promise<string | undefined>

Promise that resolves to the selected item or undefined when being dismissed.

Declaration
typings/index.d.ts:11998
window

window.showWarningMessage

Show an warning message to users. Optionally provide an array of items which will be presented as clickable buttons.

Source

Overloads (2)

  1. Signature 1
    window.showWarningMessage(message: string, ...items: string[]): Promise<string | undefined>
    message: string

    The message to show.

    ...items?: string[]

    A set of items that will be rendered as actions in the message.

    Returns
    Promise<string | undefined>
  2. Signature 2
    window.showWarningMessage<T extends MessageItem>(message: string, ...items: T[]): Promise<T | undefined>
    message: string

    The message to show.

    ...items?: T[]

    A set of items that will be rendered as actions in the message.

    Returns
    Promise<T | undefined>

API signature

window.showWarningMessage(message: string, ...items: string[]): Promise<string | undefined>

Parameters

ParameterTypeDescription
messagestring

The message to show.

...items?string[]

A set of items that will be rendered as actions in the message.

Returns
Promise<string | undefined>

Promise that resolves to the selected item or undefined when being dismissed.

Declaration
typings/index.d.ts:12017
window

window.showErrorMessage

Show an error message to users. Optionally provide an array of items which will be presented as clickable buttons.

Source

Overloads (2)

  1. Signature 1
    window.showErrorMessage(message: string, ...items: string[]): Promise<string | undefined>
    message: string

    The message to show.

    ...items?: string[]

    A set of items that will be rendered as actions in the message.

    Returns
    Promise<string | undefined>
  2. Signature 2
    window.showErrorMessage<T extends MessageItem>(message: string, ...items: T[]): Promise<T | undefined>
    message: string

    The message to show.

    ...items?: T[]

    A set of items that will be rendered as actions in the message.

    Returns
    Promise<T | undefined>

API signature

window.showErrorMessage(message: string, ...items: string[]): Promise<string | undefined>

Parameters

ParameterTypeDescription
messagestring

The message to show.

...items?string[]

A set of items that will be rendered as actions in the message.

Returns
Promise<string | undefined>

Promise that resolves to the selected item or undefined when being dismissed.

Declaration
typings/index.d.ts:12036
window

window.showNotification

Show notification window at bottom right of screen.

Source

API signature

window.showNotification(config: NotificationConfig): Promise<void>

Parameters

ParameterType
configNotificationConfig
Returns
Promise<void>
Declaration
typings/index.d.ts:12050
window

window.getSelectedRange

Get selected range for current document

Source

API signature

window.getSelectedRange(visualmode: string): Promise<Range | null>

Parameters

ParameterType
visualmodestring
Returns
Promise<Range | null>
Declaration
typings/index.d.ts:12075
window

window.selectRange

Visual select range of current document

Source

API signature

window.selectRange(range: Range): Promise<void>

Parameters

ParameterType
rangeRange
Returns
Promise<void>
Declaration
typings/index.d.ts:12080
window

window.diffHighlights

Get diff between new highlight items and current highlights requested from vim

Source

API signature

window.diffHighlights(bufnr: number, ns: string, items: ExtendedHighlightItem[], region?: [number, number] | undefined, token?: CancellationToken): Promise<HighlightDiff | null>

Parameters

ParameterTypeDescription
bufnrnumber

Buffer number

nsstring

Highlight namespace

itemsExtendedHighlightItem[]

Highlight items

region?[number, number] | undefined

0 based start line and end line (end inclusive)

token?CancellationToken

CancellationToken

Returns
Promise<HighlightDiff | null>
Declaration
typings/index.d.ts:12092
window

window.applyDiffHighlights

Apply highlight diffs, normally used with window.diffHighlights

Timer is used to add highlights when there're too many highlight items to add, the highlight process won't be finished on that case.

Source

API signature

window.applyDiffHighlights(bufnr: number, ns: string, priority: number, diff: HighlightDiff, notify?: boolean): Promise<void>

Parameters

ParameterTypeDescription
bufnrnumber

Buffer name

nsstring

Namespace

prioritynumber
diffHighlightDiff
notify?boolean

Use notification, default false.

Returns
Promise<void>
Declaration
typings/index.d.ts:12107
window

window.getVisibleRanges

Get visible ranges of bufnr, when winid specified, only visible range of winid returned. Return empty array when buffer is hidden or window with winid not exists.

Source

API signature

window.getVisibleRanges(bufnr: number, winid?: number): Promise<[number, number][]>

Parameters

ParameterTypeDescription
bufnrnumber

Buffer number

winid?number

Window ID.

Returns
Promise<[number, number][]>

List with [topline, botline], both 1 based and inclusive (returned by getwininfo()).

Declaration
typings/index.d.ts:12117
API module

extensions API

All 8 public APIs exported from the extensions module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

extensions

extensions.onDidLoadExtension

Fired on extension loaded, extension not activated yet.

Source

API signature

extensions.onDidLoadExtension: Event<Extension<any>>
Returns
Event<Extension<any>>
Declaration
typings/index.d.ts:12390
extensions

extensions.onDidActiveExtension

Fired on extension activated.

Source

API signature

extensions.onDidActiveExtension: Event<Extension<any>>
Returns
Event<Extension<any>>
Declaration
typings/index.d.ts:12395
extensions

extensions.onDidUnloadExtension

Fired with extension id on extension unload.

Source

API signature

extensions.onDidUnloadExtension: Event<string>
Returns
Event<string>
Declaration
typings/index.d.ts:12400
extensions

extensions.all

Get all loaded extensions, without disabled extensions, extension may not activated.

Source

API signature

extensions.all: ReadonlyArray<Extension<any>>
Returns
ReadonlyArray<Extension<any>>
Declaration
typings/index.d.ts:12405
extensions

extensions.getExtensionById

Get an extension by its full identifier in the form of: publisher.name.

Source

API signature

extensions.getExtensionById<T = any>(extensionId: string): Extension<T> | undefined

Parameters

ParameterTypeDescription
extensionIdstring

An extension identifier.

Returns
Extension<T> | undefined

An extension or undefined.

Declaration
typings/index.d.ts:12413
extensions

extensions.getExtensionState

Get state of specific extension.

Source

API signature

extensions.getExtensionState(id: string): ExtensionState

Parameters

ParameterType
idstring
Declaration
typings/index.d.ts:12418
extensions

extensions.getExtensionStates

Get state of all extensions, including disabled extensions.

Source

API signature

extensions.getExtensionStates(): Promise<ExtensionInfo[]>
Returns
Promise<ExtensionInfo[]>
Declaration
typings/index.d.ts:12423
extensions

extensions.isActivated

Check if extension is activated.

Source

API signature

extensions.isActivated(id: string): boolean

Parameters

ParameterType
idstring
Returns
boolean
Declaration
typings/index.d.ts:12428
API module

listmanager API

All 2 public APIs exported from the listmanager module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

listmanager

listManager.names

Registered list names set.

Source

API signature

listManager.names: ReadonlyArray<string>
Returns
ReadonlyArray<string>
Declaration
typings/index.d.ts:12751
listmanager

listManager.registerList

Register list, list session can be created by CocList [name] after registered.

Source

API signature

listManager.registerList(list: IList, internal?: boolean): Disposable

Parameters

ParameterType
listIList
internal?boolean
Returns
Disposable
Declaration
typings/index.d.ts:12755
API module

snippetmanager API

All 9 public APIs exported from the snippetmanager module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

snippetmanager

snippetManager.getSession

Get snippet session by bufnr, only returns active session.

Source

API signature

snippetManager.getSession(bufnr: number): SnippetSession | undefined

Parameters

ParameterType
bufnrnumber
Returns
SnippetSession | undefined
Declaration
typings/index.d.ts:12906
snippetmanager

snippetManager.resolveSnippet

Resolve snippet string to text.

Source

API signature

snippetManager.resolveSnippet(body: string, ultisnip?: UltiSnippetOption): Promise<string>

Parameters

ParameterType
bodystring
ultisnip?UltiSnippetOption
Returns
Promise<string>
Declaration
typings/index.d.ts:12910
snippetmanager

snippetManager.insertBufferSnippet

Insert snippet to specific buffer, ultisnips not supported, and the placeholder is not selected.

Source

API signature

snippetManager.insertBufferSnippet(bufnr: number, snippet: string | SnippetString, range: Range, insertTextMode?: InsertTextMode): Promise<boolean>

Parameters

ParameterTypeDescription
bufnrnumber

Buffer number for snippet to insert.

snippetstring | SnippetString

Textmate snippet or snippet string.

rangeRange

Range to replace.

insertTextMode?InsertTextMode

The insert text mode.

Returns
Promise<boolean>

Whether the snippet is activated.

Declaration
typings/index.d.ts:12920
snippetmanager

snippetManager.insertSnippet

Insert snippet to current buffer.

Source

API signature

snippetManager.insertSnippet(snippet: string | SnippetString, select?: boolean, range?: Range, insertTextMode?: InsertTextMode, ultisnip?: UltiSnippetOption): Promise<boolean>

Parameters

ParameterTypeDescription
snippetstring | SnippetString

Textmate snippet string.

select?boolean

Not select first placeholder when false, default true.

range?Range

Replace range, insert to current cursor position when undefined.

insertTextMode?InsertTextMode

The insert text mode.

ultisnip?UltiSnippetOption

Option of UltiSnips snippet.

Returns
Promise<boolean>

Whether the snippet is activated.

Declaration
typings/index.d.ts:12931
snippetmanager

snippetManager.insertBufferSnippets

Insert multiple snippets to a specific buffer, the buffer must be attached buffer. The buffer could be hidden, ranges of inserted snippets should not have overlap, snippets are inserted as nested snippets of a top snippet. No ultisnip snippet support, selection is disabled by default. When not selected, the first placeholder is selected on BufEnter event.

Source

API signature

snippetManager.insertBufferSnippets(bufnr: number, edits: SnippetEdit[], select?: boolean): Promise<boolean>

Parameters

ParameterTypeDescription
bufnrnumber

Buffer number of attached buffer.

editsSnippetEdit[]

snippet edits with range and snippet.

select?boolean
Returns
Promise<boolean>

True when snippet is activated.

Declaration
typings/index.d.ts:12947
snippetmanager

snippetManager.nextPlaceholder

Jump to next placeholder, only works when snippet session activated.

Source

API signature

snippetManager.nextPlaceholder(): Promise<void>
Returns
Promise<void>
Declaration
typings/index.d.ts:12952
snippetmanager

snippetManager.previousPlaceholder

Jump to previous placeholder, only works when snippet session activated.

Source

API signature

snippetManager.previousPlaceholder(): Promise<void>
Returns
Promise<void>
Declaration
typings/index.d.ts:12956
snippetmanager

snippetManager.cancel

Cancel snippet session of current buffer, does nothing when no session activated.

Source

API signature

snippetManager.cancel(): void
Returns
void
Declaration
typings/index.d.ts:12960
snippetmanager

snippetManager.isActivated

Check if snippet activated for bufnr.

Source

API signature

snippetManager.isActivated(bufnr: number): boolean

Parameters

ParameterType
bufnrnumber
Returns
boolean
Declaration
typings/index.d.ts:12964
API module

diagnosticmanager API

All 7 public APIs exported from the diagnosticmanager module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

diagnosticmanager

diagnosticManager.create

Create collection by name

Source

API signature

diagnosticManager.create(name: string): DiagnosticCollection

Parameters

ParameterType
namestring
Declaration
typings/index.d.ts:13113
diagnosticmanager

diagnosticManager.getDiagnostics

Get readonly diagnostics for uri

Source

API signature

diagnosticManager.getDiagnostics(uri: string): { [collection: string]: Diagnostic[] }

Parameters

ParameterType
uristring
Returns
{ [collection: string]: Diagnostic[] }
Declaration
typings/index.d.ts:13118
diagnosticmanager

diagnosticManager.getDiagnosticList

Get all sorted diagnostics

Source

API signature

diagnosticManager.getDiagnosticList(): Promise<ReadonlyArray<DiagnosticItem>>
Returns
Promise<ReadonlyArray<DiagnosticItem>>
Declaration
typings/index.d.ts:13127
diagnosticmanager

diagnosticManager.getCurrentDiagnostics

All diagnostics at current cursor position.

Source

API signature

diagnosticManager.getCurrentDiagnostics(): Promise<ReadonlyArray<Diagnostic>>
Returns
Promise<ReadonlyArray<Diagnostic>>
Declaration
typings/index.d.ts:13132
diagnosticmanager

diagnosticManager.getCollectionByName

Get diagnostic collection.

Source

API signature

diagnosticManager.getCollectionByName(name: string): DiagnosticCollection

Parameters

ParameterType
namestring
Declaration
typings/index.d.ts:13137