# Coc Nvim > **coc-api.txt** NodeJS client for Vim & Neovim. --- # Source: https://github.com/neoclide/coc.nvim/blob/master/doc/coc-api.txt **coc-api.txt** NodeJS client for Vim & Neovim. CONTENTS Vim sources |coc-api-vim-source| Extension introduction |coc-api-intro| Extension package json |coc-api-json| Single file extensions |coc-api-single| Create custom Extensions |coc-api-extension| Debug extensions |coc-api-debug| ============================================================================== The guide for extend coc.nvim by create vim completion sources and coc.nvim extensions. ------------------------------------------------------------------------------ VIM SOURCES **coc-api-vim-source** During initialization, coc.nvim searches vim's |runtimepath| for file pattern `autoload/coc/source/${name}.vim`, matched files would be loaded as vim completion sources. Note: LSP completion features like `TextEdit`, `additionalTextEdits`, `command` are not supported by vim sources, use the NodeJS API `languages.registerCompletionItemProvider` for LSP completion. For example, create a file `autoload/coc/source/email.vim` inside your plugin folder. With code: > " vim source for emails function! coc#source#email#init() abort return { \ 'priority': 9, \ 'shortcut': 'Email', \ 'triggerCharacters': ['@'] \} endfunction function! coc#source#email#complete(option, cb) abort let items = ['foo@gmail.com', 'bar@yahoo.com'] call a:cb(items) endfunction < `init` and `complete` are required functions for vim sources, error message will be shown when not exists. vim9script can be also used on vim9 (not supported on neovim), the function first letter need to be uppercased, like: > vim9script export def Init(): dict return { priority: 9, shortcut: 'Email', triggerCharacters: ['@'] } enddef export def Complete(option: dict, Callback: func(list)) const items = ['foo@gmail.com', 'bar@yahoo.com'] Callback(items) enddef < # Source option: ~ The source option object is returned by `coc#source#{name}#init` function, available properties: • shortcut: The shortcut characters shown in popup menu, first three characters from the source name would be used when not exists. • priority: The priority of source, default to `9`. • filetypes: Array of filetype names this source should be triggered by. Available for all filetypes when not exists. • firstMatch: When is truthy value, only the completion item that has the first letter matching the user input will be shown. • triggerCharacters: Trigger characters for this source, default to `[]`. • triggerOnly: The source should only be triggered by trigger characters, when trigger characters is false or empty, the source would only be triggered by api |coc#start()|. • isSnippet: All complete items returned by `complete` are snippets, which would have snippet indicator text added to the label in popup menu. The "isSnippet" property of completion item override this option. All options are optional. # Source configurations: ~ Vim sources register |coc-configuration| for allow the user to customize the source behavior. • `coc.source.${name}.enable` Enable the source, default to `true`. • `coc.source.${name}.disableSyntaxes` Disabled syntax names when trigger completion. • `coc.source.${name}.firstMatch` Default to "firstMatch" of source option. • `coc.source.${name}.priority` Default to "priority" of source option. • `coc.source.${name}.shortcut` Default to "shortcut" of source option. • `coc.source.${name}.filetypes` Default to "filetypes" of source option. # Complete function: ~ The complete function is called with complete option as the first argument and a callback function as the second argument, the callback function should be called with list of complete item or `v:null` synchronously or asynchronously. Note: synchronously compute complete items blocks vim's operation. Note: Error during completion is not thrown, use |:CocOpenLog| to check the error log. Complete option have following properties: • bufnr: Current buffer number. • line: Content line when trigger completion. • col: Start col of completion, start col of the keywords before cursor by default, 0 based. • input: Input text between start col and cursor col. • filetype: Filetype of current buffer. • filepath: Fullpath of current buffer. • changedtick: b:changedtick value when trigger completion. • triggerCharacter: The character which trigger the completion, could be empty string. • colnr: Cursor col when trigger completion, 1 based. • linenr: Line number of cursor, 1 based. Complete items extends vim's |complete-items| with the following properties: • deprecated: The complete item would be rendered with strike through highlight when truthy. • labelDetails: Additional details for a completion item label, which have optional `detail` and/or `description` text. • sortText: A string that should be used when comparing this item with other items, word is used when not exists. • filterText: A string that should be used when filtering a set of complete items, word is used when not exists. • insertText: The text to insert, could be textmate snippet text, word is used when not exists. • isSnippet: The text to insert is snippet when is truthy value, when truthy and `on_complete` not provided by vim source, the `insertText` is expanded as textmate snippet when confirm completion. • documentation: Array of `Documentation`, which provide `filetype` and `content` text to be displayed in preview window. Only the "word" property is mandatory for complete items. # Optional functions: ~ The vim source could provide some optional functions which would be invoked by coc.nvim: • `coc#source#{name}#get_startcol(option)` Used to alter the start col of completion, the returned col must <= current cursor col. • `coc#source#{name}#on_complete(item)` Called with selected complete item when user confirm the completion by |coc#pum#confirm()| or |coc#pum#select_confirm()|. Normally used for apply necessary edits to the buffer. • `coc#source#{name}#on_enter(option)` Called on |BufEnter| with option contains: • bufnr: The buffer number. • uri: The uri text of buffer. • languageId: The mapped filetype of buffer, see |coc-document-filetype|. • `coc#source#{name}#refresh()` Called when the user trigger refresh action for the source. ------------------------------------------------------------------------------ EXTENSION INTRODUCTION **coc-api-intro** Every extension of coc.nvim has a JavaScript entry file, that file is loaded by NodeJS API `vm.runInContext` with an identical global context (like iframe in browser). The JavaScript entry file should be a CommonJS module with `activate` method exported, and `require('coc.nvim')` can be used to access modules exported by coc.nvim, for example: > const {window} = require('coc.nvim') exports.activate = async context => { window.showInformationMessage('extension activated') } < When `exports.deactivate` is exported from the JavaScript entry file as a function, it would be called on extension deactivate. # Limitation of extension context: ~ Some methods/properties provided by NodeJS can't be used inside extension context, including: • `process.reallyExit()` • `process.abort()` • `process.setuid()` • `process.setgid()` • `process.setgroups()` • `process._fatalException()` • `process.exit()` • `process.kill()` • `process.umask()` Could only be used to get umask value. • `process.chdir()` Could be called, but no effect at all. Some globals may can't be accessed directly, for example `TextDecoder`, `TextEncoder`, use `globalThis` like `globalThis.TextDecoder` to access them. ``` *coc-api-console* ``` Stdin and stdout of the NodeJS process is used for communication between vim and NodeJS process, use the methods related to `process.stdin` and `process.stdout` may cause unexpected behavior. However, some methods of `console` are provided for debugging purpose. Messages from `console` of extension would be redirected to the log file |:CocOpenLog|. Available methods: • `debug(...args: any[])` Write debug message to the log file. • `log(...args: any[])` Write info message to the log file. • `info(...args: any[])` Write info message to the log file. • `error(...args: any[])` Write error message to the log file. • `warn(...args: any[])` Write warning message to the log file. Check the full NodeJS API interfaces at: https://github.com/neoclide/coc.nvim/blob/master/typings/index.d.ts ------------------------------------------------------------------------------ EXTENSION PACKAGE JSON **coc-api-json** The package.json file inside extension root defines the meta data of the extension. For example: > { "name": "coc-my-extension", "version": "1.0.0", "main": "lib/index.js", "engines": { "coc": "^0.0.82" }, "activationEvents": [ "**", ], "contributes": { "rootPatterns": [{ "filetype": "myfiletype", "patterns": [ "project_root.json" ] }], "commands": [{ "title": "My command", "category": "myextension", "id": "myextension.myCommand" }], "configuration": { "type": "object", "properties": { "myextension.enable": { "type": "boolean", "default": true, "scope": "resource", "description": "Enable running of my extension." } } } } } < Required properties of package.json: • name: The unique name of extension, to publish the extension, the name should not be taken by exists packages at https://www.npmjs.com/ • version: The semver version of extension. • engines: Should have `coc` property with minimal required coc.nvim version. The `main` property contains the relative filepath of the javascript entry file, `index.js` would be used when not exists. The `activationEvents` property tell coc.nvim when to activate the extension, when the property not exists or `**` is included, the extension would be activated during coc.nvim initialize. Other possible events: • onLanguage: Activate the extension when document of specific languageId exists, ex: `"onLanguage:vim"` activate the extension when there's buffer with languageId as vim loaded. • onFileSystem: Activate the extension when document with custom schema loaded, ex: `"onFileSystem:fugitive"` activate the extension when there's buffer with schema `fugitive` loaded. • onCommand: activate the extension when specific command invoked by user, ex: `"onCommand:tsserver.reloadProjects"` • workspaceContains: activate the extension when the glob pattern match one of the file in current workspace folder, ex: `"workspaceContains:****/package.json"` Optional `contributes` property contains the meta data that contributed to coc.nvim, including: • rootPatterns: The patterns to resolve |coc-workspace-folders| for associated filetype. • commands: List of commands with `id` and `title` that can be invoked by |:CocCommand|. • configuration: Contains `properties` object or a list of configurations that each one provide `properties` objects which define the configuration properties contributed by this extension. The `contributes` property could also contains other properties that used by other extensions, for example: the `jsonValidation` property could be used by coc-json. It's recommended to install `coc-json` for json intellisense support. ------------------------------------------------------------------------------ SINGLE FILE EXTENSIONS **coc-api-single** The easiest way to access the NodeJS API is make use of single file extensions. All Javascript files that ends with `.js` inside the folder "coc-extensions" under |g:coc_config_home| are considered as coc extensions. The javascript files would be loaded during coc.nvim initialize by default. To contribute extension meta data, create file `${name}.json` aside with `${name}.js`, the json file works the same as package.json of extension |coc-api-json|, except that only `activationEvents` and `contributes` properties are used. Single file extensions can't be managed by extensions list. ------------------------------------------------------------------------------ CREATE CUSTOM EXTENSIONS **coc-api-extension** To make an extension installable by |:CocInstall|, the easiest way is make use of https://github.com/fannheyward/create-coc-extension. Simply run command > ``` npm init coc-extension [extension-name] ``` < or > ``` yarn create coc-extension [extension-name] ``` < in terminal and you will be prompted for create a javascript/typescript extension step by step. To manually create an extension, follow these step: • Create an empty folder and goto that folder. • Create the package.json file |coc-api-json|. • Create a javascript file with name `index.js` and write code. • Add the created folder to your vim's runtimepath by add `set runtimepath^=/path/to/folder` in your vimrc. Recommended steps: • Install types of NodeJS and coc.nvim by terminal command `npm install @types/node@latest coc.nvim` in extension folder. • Bundle the javascript files when using multiple node dependencies by esbuild to save the time of installation. A typical build script looks like: > async function start() { await require('esbuild').build({ entryPoints: ['src/index.ts'], bundle: true, minify: process.env.NODE_ENV === 'production', sourcemap: process.env.NODE_ENV === 'development', mainFields: ['module', 'main'], external: ['coc.nvim'], platform: 'node', target: 'node16.18', outfile: 'lib/index.js' }) } start().catch(e => { console.error(e) }) < ------------------------------------------------------------------------------ DEBUG EXTENSIONS **coc-api-debug** ``` *coc-api-channel* # Channel errors: ~ ``` Channel feature on vim9 is used by coc.nvim to communicate between vim and NodeJS, the error messages caused by channel commands are not displayed on the screen. Most of the time the error should be caught by coc.nvim and can be checked by |CocOpenLog|. But for some API functions including `callVim()` `exVim()` and `evalVim()`, the errors only update the |v:errmsg| and appears in vim's channel log, which can be checked by use |g:node_client_debug| or set environment variable `$COC_VIM_CHANNEL_ENABLE` to `"1"`. # Uncaught errors: ~ When an uncaught error raised on the NodeJS process, the error message would be send to vim through stderr, and echoed by vim (unless |g:coc_disable_uncaught_error| is enabled). The error messages are not stored by vim's message history, use |:CocPrintErrors| to show previous errors. When error happens on the vim side, the promise would be rejected when sending request to vim, for notifications, vim would send `nvim_error_event` to the NodeJS process, and the node-client would create error log for it (could be opened by |:CocOpenLog|). # Use the log file: ~ • Configure `NVIM_COC_LOG_LEVEL` to `trace` in vimrc: `let $NVIM_COC_LOG_LEVEL='trace'` • Configure `NVIM_COC_LOG_FILE` to a fixed in vimrc: `let $NVIM_COC_LOG_FILE=/tmp/coc.log`, otherwise it would be different for each vim instance. • Use |coc-api-console| to add console statements in javascript/typescript code and compile the extension when needed. • Tail the log file by `tail` command and make the issue happen. # Add source map support: ~ When the javascript code is bundled by esbuild, it would be useful to have correct source map support for the error stack. • Install global source-map-support by `npm install -g source-map-support` • Find out the npm root by `npm root -g` • Load source-map-support with coc.nvim by append arguments to node in vimrc: `let g:coc_node_args = ['-r', '/path/to/npm/root/source-map-support/register']` Replace the part `/path/to/npm/root` with result from `npm root -g` terminal command. Note: the source-map-support module slows down the coc.nvim initialization. # Debug javascript code with chrome: ~ • Add `let g:coc_node_args = ['--nolazy', '--inspect-brk=5858']` • Open vim and you will get the error message indicate that the debugger is listening. • Open Chrome browser with url chrome://inspect/#devices, configure the `Target discovery settings` and you will get the remote target to inspect. • Click the inspect link to open the devtools. • Click the sources label to debug javascript code. Other debugger clients can be used as well, see: https://nodejs.org/en/docs/guides/debugging-getting-started/ ============================================================================== vim:tw=78:sta:noet:ts=8:sts=0:ft=help:fen: --- # Source: https://github.com/neoclide/coc.nvim/blob/master/doc/coc-config.txt **coc-config.txt** NodeJS client for Vim & Neovim. CONTENTS Core features ``` Workspace |coc-config-workspace| File system watch |coc-config-fileSystemWatch| Extensions |coc-config-extensions| Preferences |coc-config-preferences| Editor |coc-config-editor| Float factory |coc-config-floatFactory| Float |coc-config-float| Tree |coc-config-tree| Dialog |coc-config-dialog| Http |coc-config-http| Npm |coc-config-npm| Language server |coc-config-languageserver| ``` LSP features ``` Call hierarchy |coc-config-callHierarchy| CodeLens |coc-config-codeLens| Colors |coc-config-colors| Completion |coc-config-suggest| Inline completion |coc-config-inlineSuggest| Cursors |coc-config-cursors| Diagnostics |coc-config-diagnostic| Document highlight |coc-config-documentHighlight| Hover |coc-config-hover| Inlay hint |coc-config-inlayHint| Links |coc-config-links| List |coc-config-list| Notification |coc-config-notification| Outline |coc-config-outline| Pull diagnostics |coc-config-pullDiagnostic| Refactor |coc-config-refactor| Semantic tokens |coc-config-semanticTokens| Signature |coc-config-signature| Type hierarchy |coc-config-typeHierarchy| ``` ============================================================================== BUILTIN CONFIGURATIONS **coc-config** Builtin configurations of coc.nvim, it's recommended to use `coc-json` extension for completion and validation support. ============================================================================== CORE FEATURES Configurations of builtin features. ------------------------------------------------------------------------------ WORKSPACE ``` *coc-config-workspace* ``` "workspace.rootPatterns" **coc-config-workspace-rootPatterns** ``` Root patterns to resolve workspaceFolder from parent folders of opened files, resolved from up to down. ``` ``` Scope: `application`, default: `[".git",".hg",".projections.json"]` ``` "workspace.bottomUpFiletypes" **coc-config-workspace-bottomUpFiletypes** ``` Filetypes that should have workspace folder should resolved from base directory of file, or ["*"] for any filetype. ``` ``` Scope: `application`, default: `[]` ``` "workspace.ignoredFiletypes" **coc-config-workspace-ignoredFiletypes** ``` Filetypes that should be ignored for workspace folder resolve. ``` ``` Scope: `resource`, default: `[]` ``` "workspace.ignoredFolders" **coc-config-workspace-ignoredFolders** ``` List of folders that should not be resolved as workspace folder, environment variables and minimatch patterns can be used. ``` ``` Scope: `application`, default: `["$HOME"]` ``` "workspace.openOutputCommand" **coc-config-workspace-openOutputCommand** ``` Command used to open output channel. ``` ``` Scope: `resource`, default: `"vs"` ``` "workspace.openResourceCommand" **coc-config-workspace-openResourceCommand** ``` Command to open files that not loaded, load files as hidden buffers when empty. ``` ``` Scope: `application`, default: `"tab drop"` ``` "workspace.workspaceFolderCheckCwd" **coc-config-workspace-workspaceFolderCheckCwd** ``` Whether the current working directory should be used first when checking patterns match for workspace folder. ``` ``` Scope: `application`, default: `true` ``` "workspace.workspaceFolderFallbackCwd" **coc-config-workspace-workspaceFolderFallbackCwd** ``` Use current working directory as workspace folder when no root patterns resolved. ``` ``` Scope: `application`, default: `true` ``` "workspace.removeEmptyWorkspaceFolder" **coc-config-workspace-removeEmptyWorkspaceFolder** ``` Automatically remove the workspace folder when no buffer associated with it. ``` ``` Scope: `application`, default: `false` ``` ------------------------------------------------------------------------------ FILESYSTEMWATCH **coc-config-fileSystemWatch** "fileSystemWatch.watchmanPath" **coc-config-filesystemwatch-watchmanPath** ``` executable path for https://facebook.github.io/watchman/, detected from $PATH by default Scope: `application`, default: `null` ``` "fileSystemWatch.enable" **coc-config-filesystemwatch-enable** ``` Enable file system watch support for workspace folders. Scope: `application`, default: `true` ``` "fileSystemWatch.ignoredFolders" **coc-config-filesystemwatch-ignoredFolders** ``` List of folders that should not be watched for file changes, environment variables and minimatch patterns can be used. ``` ``` Scope: `application`, default: `["/private/tmp", "/", "${tmpdir}"]` ``` ------------------------------------------------------------------------------ EXTENSIONS ``` *coc-config-extensions* ``` "extensions.updateCheck" **coc-config-extensions-updateCheck** ``` Interval for check extension update, could be "daily", "weekly" or "never" ``` ``` Scope: `application`, default: `"never"` ``` "extensions.silentAutoupdate" **coc-config-extensions-silentAutoupdate** ``` Not open split window with update status when performing auto update. ``` ``` Scope: `application`, default: `true` ``` "extensions.updateUIInTab" **coc-config-extensions-updateUIInTab** ``` Open `CocUpdate` UI in new tab. ``` ``` Scope: `application`, default: `false` ``` "extensions.recommendations" **coc-config-extensions-recommendations** ``` List of extensions recommended for installation in the current project. Only works as workspace folder configuration. ``` ``` Scope: `resource`, default: `[]` ``` ------------------------------------------------------------------------------ PREFERENCES ``` *coc-config-preferences* ``` "coc.preferences.bracketEnterImprove" **coc-preferences-bracketEnterImprove** ``` Improve enter inside bracket `<> {} [] ()` by add new empty line below and place cursor to it. Works with `coc#on_enter()` ``` ``` Scope: `language-overridable`, default: `true` ``` "coc.preferences.currentFunctionSymbolAutoUpdate" **coc-preferences-currentFunctionSymbolAutoUpdate** ``` Automatically update the value of b:coc_current_function on CursorMove event ``` ``` Scope: `language-overridable`, default: `false` ``` "coc.preferences.currentFunctionSymbolDebounceTime" **coc-preferences-currentFunctionSymbolDebounceTime** ``` Set debounce timer for the update of b:coc_current_function on CursorMove event ``` ``` Scope: `application`, default: `300` ``` "coc.preferences.enableLinkedEditing" **coc-preferences-enableLinkedEditing** ``` Enable linked editing support. ``` ``` Scope: `language-overridable`, default: `false` ``` "coc.preferences.enableMarkdown" **coc-preferences-enableMarkdown** ``` Tell the language server that markdown text format is supported, note that markdown text may not rendered as expected. ``` ``` Scope: `application`, default: `true` ``` "coc.preferences.enableMessageDialog" **coc-preferences-enableMessageDialog** ``` Enable messages shown in notification dialog. Deprecated, prefer configuration 'coc.preferences.messageDialogKind' instead. ``` ``` Scope: `application`, default: `false` ``` "coc.preferences.messageDialogKind" **coc-preferences-messageDialogKind** ``` Configure the type of user interaction when an interactive message dialog occurs with more than zero actions to trigger. ``` ``` Scope: `application`, default: `confirm` ``` "coc.preferences.messageReportKind" **coc-preferences-messageReportKind** ``` Configure the type of user interaction when a non-interactive message dialog occurs with zero actions to trigger. ``` ``` Scope: `application`, default: `echo` ``` "coc.preferences.excludeImageLinksInMarkdownDocument" **coc-preferences-excludeImageLinksInMarkdownDocument** ``` Exclude image links from markdown text in float window. ``` ``` Scope: `application`, default: `true` ``` "coc.preferences.enableGFMBreaksInMarkdownDocument" **coc-preferences-enableGFMBreaksInmakrdownDocument** ``` Exclude GFM breaks in markdown document. ``` ``` Scope: `application`, default: `true` ``` "coc.preferences.floatActions" **coc-preferences-floatActions** ``` Set to false to disable float/popup support for actions menu. ``` ``` Scope: `application`, default: `true` ``` "coc.preferences.formatOnSave" **coc-preferences-formatOnSave** ``` Set to true to enable formatting on save. ``` ``` Scope: `language-overridable`, default: `false` ``` "coc.preferences.formatOnSaveTimeout" **coc-preferences-formatOnSaveTimeout** ``` How long before the format command run on save will time out. ``` ``` Scope: `language-overridable`, default: `200` ``` "coc.preferences.formatOnType" **coc-preferences-formatOnType** ``` Set to true to enable formatting on typing ``` ``` Scope: `language-overridable`, default: `false` ``` "coc.preferences.formatterExtension" **coc-preferences-formatterExtension** ``` Extension used for formatting documents. When set to null, the formatter with highest priority is used. ``` ``` Scope: `language-overridable`, default: `null` ``` "coc.preferences.jumpCommand" **coc-preferences-jumpCommand** ``` Command used for location jump, like goto definition, goto references etc. Can be also a custom command that gives file as an argument. ``` ``` Scope: `application`, default: `"edit"` ``` "coc.preferences.maxFileSize" **coc-preferences-maxFileSize** ``` Maximum file size in bytes that coc.nvim should handle, default '10MB'. ``` ``` Scope: `application`, default: `"10MB"` ``` "coc.preferences.messageLevel" **coc-preferences-messageLevel** ``` Message level for filter echoed messages, could be 'more', 'warning' and 'error' ``` ``` Scope: `application`, default: `"more"` ``` "coc.preferences.promptInput" **coc-preferences-promptInput** ``` Use prompt buffer in float window for user input. ``` ``` Scope: `application`, default: `true` ``` "coc.preferences.renameFillCurrent" **coc-preferences-renameFillCurrent** ``` Disable to stop Refactor-Rename float/popup window from populating with old name in the New Name field. ``` ``` Scope: `application`, default: `true` ``` "coc.preferences.silentAutoupdate" **coc-preferences-silentAutoupdate** ``` Not open split window with update status when performing auto update. ``` ``` Scope: `application`, default: `true` ``` "coc.preferences.useQuickfixForLocations" **coc-preferences-useQuickfixForLocations** ``` Use vim's quickfix list for jump locations, need restart on change. ``` ``` Scope: `application`, default: `false` ``` "coc.preferences.watchmanPath" **coc-preferences-watchmanPath** ``` executable path for https://facebook.github.io/watchman/, detected from $PATH by default. Required by features which need file watch to work, eg: update import path on file move. ``` ``` Scope: `application`, default: `null` ``` "coc.preferences.willSaveHandlerTimeout" **coc-preferences-willSaveHandlerTimeout** ``` Will save handler timeout. ``` ``` Scope: `application`, default: `500` ``` "coc.preferences.tagDefinitionTimeout" **coc-preferences-tagDefinitionTimeout** ``` The timeout of CocTagFunc. Scope: `application`, default: `0` ``` ------------------------------------------------------------------------------ EDITOR ``` *coc-config-editor* *coc-config-editor-codeActionsOnSave* ``` "editor.codeActionsOnSave" ``` Run Code Actions for the buffer on save, normally source actions, Example: `\"source.organizeImports\": \"always\"`, |coc-preferences-willSaveHandlerTimeout| is used for timeout control. ``` ``` Scope: `language-overridable`, default: `{}` ``` ``` *coc-config-editor-autocmdTimeout* ``` "editor.autocmdTimeout" ``` Timeout for execute request autocmd registered by coc extensions. ``` ``` Scope: `application`, default: `1000` ``` ------------------------------------------------------------------------------ FLOATfACTORY ``` *coc-config-floatFactory* ``` "floatFactory.floatConfig" **coc-config-floatFactory-floatConfig** ``` Configure default float window/popup style created by float factory (created around cursor and automatically closed), see |coc-config-float| for supported properties. ``` ``` Scope: `application`, default: `null` ``` ------------------------------------------------------------------------------ FLOAT CONFIGURATION ``` *coc-config-float* ``` Used by `floatFactory.floatConfig`, `suggest.floatConfig`, `diagnostic.floatConfig`, `signature.floatConfig` and `hover.floatConfig`, following properties are supported: ``` - "border": Change to `true` to enable border. - "rounded": Use rounded borders when border is `true`. - "highlight": Background highlight group of float window, default: `"CocFloating"`. - "title": Title text used by float window, default: `""`. - "borderhighlight": Border highlight group of float window, default: `"CocFloatBorder"`. - "close": Set to `true` to draw close icon. - "maxWidth": Maximum width of float window, contains border. - "maxHeight": Maximum height of float window, contains border. - "winblend": Set 'winblend' option of window, neovim only, default: `0`. - "focusable": Set to false to make window not focusable, neovim only. - "shadow": Set to true to enable shadow, neovim only. - "position": Controls how floating windows are positioned. When set to `'fixed'`, the window will be positioned according to the `top`, `bottom`, `left`, and `right` settings. When set to `'auto'`, the window follows the default position. - "top": Distance from the top of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Will be ignored if `bottom` is set. - "bottom": Distance from the bottom of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Takes precedence over `top` if both are set. - "left": Distance from the left edge of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Will be ignored if `right` is set. - "right": "Distance from the right edge of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Takes precedence over `left` if both are set." ``` ------------------------------------------------------------------------------ TREE ``` *coc-config-tree* ``` Configurations for tree view. "tree.openedIcon" **coc-config-tree-openedIcon** ``` Opened icon of tree view. ``` ``` Scope: `application`, default: `"-"` ``` "tree.closedIcon" **coc-config-tree-closedIcon** ``` Closed icon of tree view. ``` ``` Scope: `application`, default: `"+"` ``` "tree.key.actions" **coc-config-tree-key-actions** ``` Trigger key to invoke actions. ``` ``` Scope: `application`, default: `""` ``` "tree.key.activeFilter" **coc-config-tree-key-activeFilter** ``` Trigger key active filter. ``` ``` Scope: `application`, default: `"f"` ``` "tree.key.close" **coc-config-tree-key-close** ``` Trigger key to dispose the tree and close tree window. ``` ``` Scope: `application`, default: `""` ``` "tree.key.collapseAll" **coc-config-tree-key-collapseAll** ``` Trigger key to collapse all tree node. ``` ``` Scope: `application`, default: `"M"` ``` "tree.key.invoke" **coc-config-tree-key-invoke** ``` Trigger key to invoke default command of current node or selection. ``` ``` Scope: `application`, default: `""` ``` "tree.key.selectNext" **coc-config-tree-key-selectNext** ``` Trigger key to select next item during filter. ``` ``` Scope: `application`, default: `""` ``` "tree.key.selectPrevious" **coc-config-tree-key-selectPrevious** ``` Trigger key to select previous item during filter. ``` ``` Scope: `application`, default: `""` ``` "tree.key.toggle" **coc-config-tree-key-toggle** ``` Trigger key to toggle expand state of tree node, does nothing with leaf node. ``` ``` Scope: `application`, default: `"t"` ``` "tree.key.toggleSelection" **coc-config-tree-key-toggleSelection** ``` Trigger key to select/unselect item. ``` ``` Scope: `application`, default: `""` ``` ------------------------------------------------------------------------------ DIALOG ``` *coc-config-dialog* ``` Configurations for dialog windows. "dialog.confirmKey" **coc-config-dialog-confirmKey** ``` Confirm key for confirm selection used by menu and picker, you can always use to cancel. ``` ``` Scope: `application`, default: `""` ``` "dialog.floatBorderHighlight" **coc-config-dialog-floatBorderHighlight** ``` Highlight group for border of dialog window/popup, use 'CocFloating' when not specified. ``` ``` Scope: `application`, default: `null` ``` "dialog.floatHighlight" **coc-config-dialog-floatHighlight** ``` Highlight group for dialog window/popup, use 'CocFloating' when not specified. ``` ``` Scope: `application`, default: `null` ``` "dialog.maxHeight" **coc-config-dialog-maxHeight** ``` Maximum height of dialog window, for quickpick, it's content window's height. ``` ``` Scope: `application`, default: `30` ``` "dialog.maxWidth" **coc-config-dialog-maxWidth** ``` Maximum width of dialog window. ``` ``` Scope: `application`, default: `80` ``` "dialog.pickerButtonShortcut" **coc-config-dialog-pickerButtonShortcut** ``` Show shortcut in buttons of picker dialog window/popup, used when dialog .pickerButtons is true. ``` ``` Scope: `application`, default: `true` ``` "dialog.pickerButtons" **coc-config-dialog-pickerButtons** ``` Show buttons for picker dialog window/popup. ``` ``` Scope: `application`, default: `true` ``` "dialog.rounded" **coc-config-dialog-rounded** ``` use rounded border for dialog window. ``` ``` Scope: `application`, default: `true` ``` "dialog.shortcutHighlight" **coc-config-dialog-shortcutHighlight** ``` Highlight group for shortcut character in menu dialog. ``` ``` Scope: `application`, default: `"MoreMsg"` ``` ------------------------------------------------------------------------------ HTTP PROXY ``` *coc-config-http* ``` Configurations for http requests, used by coc.nvim and some coc extensions. "http.proxy" **coc-config-http-proxy** ``` The proxy setting to use. If not set, will be inherited from the ` http_proxy` and `https_proxy` environment variables. ``` ``` Scope: `application`, default: `""` ``` "http.proxyAuthorization" **coc-config-http-proxyAuthorization** ``` The value to send as the `Proxy-Authorization` header for every network request. ``` ``` Scope: `application`, default: `null` ``` "http.proxyCA" **coc-config-http-proxyCA** ``` CA (file) to use as Certificate Authority> ``` ``` Scope: `application`, default: `null` ``` "http.proxyStrictSSL" **coc-config-http-proxyStrictSSL** ``` Controls whether the proxy server certificate should be verified against the list of supplied CAs. ``` ``` Scope: `application`, default: `true` ``` ------------------------------------------------------------------------------ NPM ``` *coc-config-npm* ``` "npm.binPath" **coc-config-npm-binPath** ``` Command or absolute path to npm or yarn for global extension install/uninstall. ``` ``` Scope: `application`, default: `"npm"` ``` ------------------------------------------------------------------------------ LANGUAGESERVER ``` *coc-config-languageserver* ``` ``` Dictionary of Language Servers, key is the ID of corresponding server, and value is configuration of languageserver. Default: `{}` ``` ``` Properties of languageserver configuration: ``` ``` - "enable": Change to `false` to disable that languageserver. ``` ``` - "filetypes": Supported filetypes, add * in array for all filetypes. Note: it's required for start the languageserver, please make sure your filetype is expected by `:CocCommand document.echoFiletype` command ``` ``` - 'maxRestartCount': Maximum restart count when server closed in the last 3 minutes, default to `4`. ``` ``` - "additionalSchemes": Additional URI schemes, default schemes including file & untitled. Note: you have to setup vim provide content for custom URI as well. ``` ``` - "cwd": Working directory used to start languageserver, vim's cwd is used by default. ``` ``` - "env": Environment variables for child process. ``` ``` - "settings": Settings for languageserver, received on server initialization. ``` ``` - "trace.server": Trace level of communication between server and client that showed with output channel, open output channel by command `:CocCommand workspace.showOutput` ``` ``` - "stdioEncoding": Encoding used for stdio of child process. ``` ``` - "initializationOptions": Initialization options passed to languageserver (it's deprecated) ``` ``` - "rootPatterns": Root patterns used to resolve rootPath from current file. ``` ``` - "requireRootPattern": If true, doesn't start server when root pattern not found. ``` ``` - "ignoredRootPaths": Absolute root paths that language server should not use as rootPath, higher priority than rootPatterns. ``` ``` - "disableDynamicRegister": Disable dynamic registerCapability feature for this languageserver to avoid duplicated feature registration. ``` ``` - "disableSnippetCompletion": Disable snippet completion feature for this languageserver. ``` ``` - "disabledFeatures": Disable features for this languageserver, valid keys: > ``` ``` ["completion", "configuration", "workspaceFolders", "diagnostics", "willSave", "willSaveUntil", "didSaveTextDocument", "fileSystemWatcher", "hover", "signatureHelp", "definition", "references", "documentHighlight", "documentSymbol", "workspaceSymbol", "codeAction", "codeLens", "formatting", "documentFormatting", "documentRangeFormatting", "documentOnTypeFormatting", "rename", "documentLink", "executeCommand", "pullConfiguration", "typeDefinition", "implementation", "declaration", "color", "foldingRange", "selectionRange", "progress", "callHierarchy", "linkedEditing", "fileEvents", "semanticTokens"] ``` < ``` - "formatterPriority": Priority of this languageserver's formatter. ``` ``` - "revealOutputChannelOn": Configure message level to show the output channel buffer. ``` ``` - "progressOnInitialization": Enable progress report on languageserver initialize. ``` # Language server start with command: ~ ``` Additional fields can be used for a command languageserver: ``` ``` - "command": Executable program name in $PATH or absolute path of executable used for start languageserver. ``` ``` - "args": Command line arguments of command. ``` ``` - "detached": Detach language server when is true. ``` ``` - "shell": Use shell for server process, default: `false` ``` # Language server start with module: ~ ``` Additional fields can be used for a languageserver started by node module: ``` ``` - "module": Absolute filepath of Javascript file. ``` ``` - "args": Extra arguments used on fork Javascript module. ``` ``` - "runtime": Absolute path of node runtime, node runtime of coc.nvim is used by default. ``` ``` - "execArgv": ARGV passed to node on fork, normally used for debugging, example: `["--nolazy", "--inspect-brk=6045"]` ``` ``` - "transport": Transport kind used by server, could be 'ipc', 'stdio', 'socket' and 'pipe'. 'ipc' is used by default (recommended). ``` ``` - "transportPort": Port number used when transport is 'socket'. ``` # Language server use initialized socket server: ~ ``` - "port": Port number of socket server. ``` ``` - "host": Host of socket server, default to `127.0.0.1`. ``` ============================================================================== LSP FEATURES Configurations for features provided by language server. ------------------------------------------------------------------------------ CALLHIERARCHY ``` *coc-config-callHierarchy* ``` "callHierarchy.enableTooltip" **coc-config-callHierarchy-enableTooltip** ``` Enable tooltip to show relative filepath of call hierarchy item. ``` ``` Scope: `application`, default: `true` ``` "callHierarchy.openCommand" **coc-config-callHierarchy-openCommand** ``` Open command for call hierarchy tree view. ``` ``` Scope: `application`, default: `"edit"` ``` "callHierarchy.splitCommand" **coc-config-callHierarchy-splitCommand** ``` Window split command used by call hierarchy tree view. ``` ``` Scope: `application`, default: `"botright 30vs"` ``` ------------------------------------------------------------------------------ CODELENS ``` *coc-config-codeLens* ``` "codeLens.enable" **coc-config-codeLens-enable** ``` Enable codeLens feature, require neovim with set virtual text feature. ``` ``` Scope: `language-overridable`, default: `false` ``` "codeLens.display" **coc-config-codeLens-display** ``` Display codeLens. Toggle with :CocCommand document.toggleCodeLens ``` ``` Scope: `language-overridable`, default: `true` ``` "codeLens.position" **coc-config-codeLens-position** ``` Display position of codeLens virtual text. ``` ``` Scope: `resource`, default: `"top"` ``` "codeLens.separator" **coc-config-codeLens-separator** ``` Separator text for codeLens in virtual text. ``` ``` Scope: `resource`, default: `""` ``` "codeLens.subseparator" **coc-config-codeLens-subseparator** ``` Subseparator between codeLenses in virtual text. ``` ``` Scope: `resource`, default: `" | "` ``` ------------------------------------------------------------------------------ COLORS ``` *coc-config-colors* ``` "colors.enable" **coc-config-colors-enable** ``` Enable colors highlight feature, for terminal vim, 'termguicolors' option should be enabled and the terminal support gui colors. ``` ``` Scope: `language-overridable`, default: `false` ``` "colors.highlightPriority" **coc-config-colors-highlightPriority** ``` Priority for colors highlights, works on vim8 and neovim >= 0.6.0. ``` ``` Scope: `application`, default: `1000` ``` ------------------------------------------------------------------------------ CURSORS ``` *coc-config-cursors* ``` "cursors.cancelKey" **coc-config-cursors-cancelKey** ``` Key used for cancel cursors session. ``` ``` Scope: `application`, default: `""` ``` "cursors.nextKey" **coc-config-cursors-nextKey** ``` Key used for jump to next cursors position. ``` ``` Scope: `application`, default: `""` ``` "cursors.previousKey" **coc-config-cursors-previousKey** ``` Key used for jump to previous cursors position. ``` ``` Scope: `application`, default: `""` ``` "cursors.wrapscan" **coc-config-cursors-wrapscan** ``` Searches wrap around the first or last cursors range. ``` ``` Scope: `application`, default: `true` ``` ------------------------------------------------------------------------------ DIAGNOSTIC ``` *coc-config-diagnostic* ``` "diagnostic.autoRefresh" **coc-config-diagnostic-autoRefresh** ``` Enable automatically refresh diagnostics, use diagnosticRefresh action when it's disabled. ``` ``` Scope: `language-overridable`, default: `true` ``` "diagnostic.checkCurrentLine" **coc-config-diagnostic-checkCurrentLine** ``` When enabled, show all diagnostics of current line if there are none at the current position. ``` ``` Scope: `language-overridable`, default: `false` ``` "diagnostic.displayByAle" **coc-config-diagnostic-displayByAle** ``` Use Ale, coc-diagnostics-shim.nvim, or other provider to display diagnostics in vim. This setting will disable diagnostic display using coc's handler. A restart required on change. ``` ``` Scope: `language-overridable`, default: `false` ``` "diagnostic.displayByVimDiagnostic" **coc-config-diagnostic-displayByVimDiagnostic** ``` Set diagnostics to nvim's `vim.diagnostic`, and prevent coc.nvim's handler to display in virtualText/floating window etc. ``` ``` Scope: `language-overridable`, default: `false` ``` "diagnostic.enable" **coc-config-diagnostic-enable** ``` Set to false to disable diagnostic display. ``` ``` Scope: `language-overridable`, default: `true` ``` "diagnostic.enableHighlightLineNumber" **coc-config-diagnostic-enableHighlightLineNumber** ``` Enable highlighting line numbers for diagnostics, only works with neovim. ``` ``` Scope: `application`, default: `true` ``` "diagnostic.enableMessage" **coc-config-diagnostic-enableMessage** ``` When to enable show messages of diagnostics. ``` ``` Scope: `application`, default: `"always"` ``` "diagnostic.enableSign" **coc-config-diagnostic-enableSign** ``` Enable signs for diagnostics. ``` ``` Scope: `language-overridable`, default: `true` ``` "diagnostic.errorSign" **coc-config-diagnostic-errorSign** ``` Text of error sign. ``` ``` Scope: `application`, default: `">>"` ``` "diagnostic.filetypeMap" **coc-config-diagnostic-filetypeMap** ``` A map between buffer filetype and the filetype assigned to diagnostics. To syntax highlight diagnostics with their parent buffer type use `" default": "bufferType"`. ``` ``` Scope: `application`, default: `{}` ``` "diagnostic.floatConfig" **coc-config-diagnostic-floatConfig** ``` Configuration of floating window/popup for diagnostic messages, see |coc-config-float|. ``` ``` Scope: `application`, default: `null` ``` "diagnostic.format" **coc-config-diagnostic-format** ``` Define the diagnostic format that shown in float window or echoed, available parts: source, code, severity, message. ``` ``` Scope: `language-overridable`, default: `"%message (%source%code)"` ``` "diagnostic.highlightLimit" **coc-config-diagnostic-highlightLimit** ``` Limit count for highlighted diagnostics, too many diagnostic highlights could make vim stop responding. ``` ``` Scope: `language-overridable`, default: `1000` ``` "diagnostic.highlightPriority" **coc-config-diagnostic-highlightPriority** ``` Priority for diagnostic highlights, works on vim8 and neovim >= 0.6.0. ``` ``` Scope: `language-overridable`, default: `4096` ``` "diagnostic.hintSign" **coc-config-diagnostic-hintSign** ``` Text of hint sign. ``` ``` Scope: `application`, default: `">>"` ``` "diagnostic.infoSign" **coc-config-diagnostic-infoSign** ``` Text of info sign. ``` ``` Scope: `application`, default: `">>"` ``` "diagnostic.level" **coc-config-diagnostic-level** ``` Used for filter diagnostics by diagnostic severity. ``` ``` Scope: `resource`, default: `"hint"` ``` "diagnostic.locationlistLevel" **coc-config-diagnostic-locationlistLevel** ``` Filter diagnostics in locationlist. ``` ``` Scope: `language-overridable`, default: `null` ``` "diagnostic.locationlistUpdate" **coc-config-diagnostic-locationlistUpdate** ``` Update locationlist on diagnostics change, only works with locationlist opened by :CocDiagnostics command and first window of associated buffer. ``` ``` Scope: `language-overridable`, default: `true` ``` "diagnostic.messageDelay" **coc-config-diagnostic-messageDelay** ``` How long to wait (in milliseconds) before displaying the diagnostic message with echo or float ``` ``` Scope: `application`, default: `200` ``` "diagnostic.messageLevel" **coc-config-diagnostic-messageLevel** ``` Filter diagnostic message in float window/popup. ``` ``` Scope: `language-overridable`, default: `null` ``` "diagnostic.messageTarget" **coc-config-diagnostic-messageTarget** ``` Diagnostic message target. ``` ``` Scope: `language-overridable`, default: `"float"` ``` "diagnostic.refreshOnInsertMode" **coc-config-diagnostic-refreshOnInsertMode** ``` Enable diagnostic refresh on insert mode, default false. ``` ``` Scope: `language-overridable`, default: `false` ``` "diagnostic.showDeprecated" **coc-config-diagnostic-showDeprecated** ``` Show diagnostics with deprecated tag. ``` ``` Scope: `language-overridable`, default: `true` ``` "diagnostic.showUnused" **coc-config-diagnostic-showUnused** ``` Show diagnostics with unused tag, affects highlight, sign, virtual text , message. ``` ``` Scope: `language-overridable`, default: `true` ``` "diagnostic.signLevel" **coc-config-diagnostic-signLevel** ``` Filter diagnostics displayed in signcolumn. ``` ``` Scope: `language-overridable`, default: `null` ``` "diagnostic.signPriority" **coc-config-diagnostic-signPriority** ``` Priority of diagnostic signs. ``` ``` Scope: `resource`, default: `10` ``` "diagnostic.virtualText" **coc-config-diagnostic-virtualText** ``` Use virtual text to display diagnostics. ``` ``` Scope: `language-overridable`, default: `false` ``` "diagnostic.virtualTextAlign" **coc-config-diagnostic-virtualTextAlign** ``` Position of virtual text. ``` ``` Scope: `language-overridable`, default: `"after"` ``` "diagnostic.virtualTextCurrentLineOnly" **coc-config-diagnostic-virtualTextCurrentLineOnly** ``` Only show virtualText diagnostic on current cursor line. ``` ``` Scope: `language-overridable`, default: `true` ``` "diagnostic.virtualTextFormat" **coc-config-diagnostic-virtualTextFormat** ``` Define the virtual text diagnostic format, available parts: source, code , severity, message. ``` ``` Scope: `language-overridable`, default: `"%message"` ``` "diagnostic.virtualTextLevel" **coc-config-diagnostic-virtualTextLevel** ``` Filter diagnostic message in virtual text by level. ``` ``` Scope: `language-overridable`, default: `null` ``` "diagnostic.virtualTextLimitInOneLine" **coc-config-diagnostic-virtualTextLimitInOneLine** ``` The maximum number of diagnostic messages to display in one line. ``` ``` Scope: `language-overridable`, default: `999` ``` "diagnostic.virtualTextLineSeparator" **coc-config-diagnostic-virtualTextLineSeparator** ``` The text that will mark a line end from the diagnostic message. ``` ``` Scope: `language-overridable`, default: `" \ "` ``` "diagnostic.virtualTextLines" **coc-config-diagnostic-virtualTextLines** ``` The number of non empty lines from a diagnostic to display. ``` ``` Scope: `language-overridable`, default: `3` ``` "diagnostic.virtualTextPrefix" **coc-config-diagnostic-virtualTextPrefix** ``` The prefix added virtual text diagnostics. ``` ``` Scope: `language-overridable`, default: `" "` ``` "diagnostic.virtualTextWinCol" **coc-config-diagnostic-virtualTextWinCol** ``` Window column number to align virtual text, neovim only. ``` ``` Scope: `language-overridable`, default: `null` ``` "diagnostic.warningSign" **coc-config-diagnostic-warningSign** ``` Text of warning sign. ``` ``` Scope: `application`, default: `"⚠"` ``` "diagnostic.showRelatedInformation" **coc-config-diagnostic-showRelatedInformation** ``` Display related information in the diagnostic floating window. ``` ``` Scope: `language-overridable`, default: `true` ``` ------------------------------------------------------------------------------ DOCUMENTHIGHLIGHT ``` *coc-config-documentHighlight* ``` "documentHighlight.priority" **coc-config-documentHighlight-priority** ``` Match priority used by document highlight, see ':h matchadd'. ``` ``` Scope: `resource`, default: `-1` ``` "documentHighlight.limit" **coc-config-documentHighlight-limit** ``` Limit the highlights added by matchaddpos, too many positions could cause vim slow. ``` ``` Scope: `resource`, default: `100` ``` "documentHighlight.timeout" **coc-config-documentHighlight-timeout** ``` Timeout for document highlight, in milliseconds. ``` ``` Scope: `resource`, default: `300` ``` ------------------------------------------------------------------------------ HOVER ``` *coc-config-hover* ``` "hover.autoHide" **coc-config-hover-autoHide** ``` Automatically hide hover float window on CursorMove or InsertEnter. ``` ``` Scope: `application`, default: `true` ``` "hover.floatConfig" **coc-config-hover-floatConfig** ``` Configuration of floating window/popup for hover documents, see |coc-config-float|. ``` ``` Scope: `application`, default: `null` ``` "hover.previewMaxHeight" **coc-config-hover-previewMaxHeight** ``` Max height of preview window for hover. ``` ``` Scope: `resource`, default: `12` ``` "hover.target" **coc-config-hover-target** ``` Target to show hover information, could be `float`, `echo` or `preview`. ``` ``` Scope: `resource`, default: `float` ``` ------------------------------------------------------------------------------ INLAYHINT ``` *coc-config-inlayHint* ``` "inlayHint.enable" **coc-config-inlayHint-enable** ``` Enable inlay hint support. ``` ``` Scope: `language-overridable`, default: `true` ``` "inlayHint.enableParameter" **coc-config-inlayHint-enableParameter** ``` Enable inlay hints for parameters. ``` ``` Scope: `language-overridable`, default: `true` ``` "inlayHint.display" **coc-config-inlayHint-display** ``` Display inlay hints. Toggle with :CocCommand document.toggleInlayHint ``` ``` Scope: `language-overridable`, default: `true` ``` "inlayHint.refreshOnInsertMode" **coc-config-inlayHint-refreshOnInsertMode** ``` Refresh inlayHints on insert mode. ``` ``` Scope: `language-overridable`, default: `false` ``` "inlayHint.position" **coc-config-inlayHint-position** ``` Controls the position of inlay hint, supports `inline` and `eol`. ``` ``` Scope: `language-overridable`, default: `inline` ``` ------------------------------------------------------------------------------ LINK ``` *coc-config-links* ``` "links.enable" **coc-config-links-enable** ``` Enable document links. ``` ``` Scope: `language-overridable`, default: `true` ``` "links.highlight" **coc-config-links-highlight** ``` Use CocLink highlight group to highlight links. ``` ``` Scope: `application`, default: `false` ``` "links.tooltip" **coc-config-links-tooltip** ``` Show tooltip of link under cursor on CursorHold. ``` ``` Scope: `application`, default: `false` ``` ------------------------------------------------------------------------------ LIST ``` *coc-config-list* ``` "list.alignColumns" **coc-config-list-alignColumns** ``` Whether to align lists in columns. ``` ``` Scope: `application`, default: `false` ``` "list.extendedSearchMode" **coc-config-list-extendedSearchMode** ``` Enable extended search mode which allows multiple search patterns delimited by spaces. ``` ``` Scope: `application`, default: `true` ``` "list.floatPreview" **coc-config-list-floatPreview** ``` Enable preview with float window/popup, default: `false`. ``` ``` Scope: `application`, default: `false` ``` "list.height" **coc-config-list-height** ``` Height of split list window. ``` ``` Scope: `application`, default: `10` ``` "list.indicator" **coc-config-list-indicator** ``` The character used as first character in prompt line. ``` ``` Scope: `application`, default: `">"` ``` "list.insertMappings" **coc-config-list-insertMappings** ``` Custom keymappings on insert mode. ``` ``` Scope: `application`, default: `{}` ``` "list.interactiveDebounceTime" **coc-config-list-interactiveDebounceTime** ``` Debounce time for input change on interactive mode. ``` ``` Scope: `application`, default: `100` ``` "list.limitLines" **coc-config-list-limitLines** ``` Limit lines for list buffer. ``` ``` Scope: `application`, default: `null` ``` "list.maxPreviewHeight" **coc-config-list-maxPreviewHeight** ``` Max height for preview window of list. ``` ``` Scope: `application`, default: `12` ``` "list.menuAction" **coc-config-list-menuAction** ``` Use menu picker instead of confirm() for choose action. ``` ``` Scope: `application`, default: `false` ``` "list.nextKeymap" **coc-config-list-nextKeymap** ``` Key used for select next line on insert mode. ``` ``` Scope: `application`, default: `""` ``` "list.normalMappings" **coc-config-list-normalMappings** ``` Custom keymappings on normal mode. ``` ``` Scope: `application`, default: `{}` ``` "list.previewHighlightGroup" **coc-config-list-previewHighlightGroup** ``` Highlight group used for highlight the range in preview window. ``` ``` Scope: `application`, default: `"Search"` ``` "list.previewSplitRight" **coc-config-list-previewSplitRight** ``` Use vsplit for preview window. ``` ``` Scope: `application`, default: `false` ``` "list.previewToplineOffset" **coc-config-list-previewToplineOffset** ``` Topline offset for list previews ``` ``` Scope: `application`, default: `3` ``` "list.previewToplineStyle" **coc-config-list-previewToplineStyle** ``` Topline style for list previews, could be "offset" or "middle". ``` ``` Scope: `application`, default: `"offset"` ``` "list.previousKeymap" **coc-config-list-previousKeymap** ``` Key used for select previous line on insert mode. ``` ``` Scope: `application`, default: `""` ``` "list.selectedSignText" **coc-config-list-selectedSignText** ``` Sign text for selected lines. ``` ``` Scope: `application`, default: `"*"` ``` "list.signOffset" **coc-config-list-signOffset** ``` Sign offset of list, should be different from other plugins. ``` ``` Scope: `application`, default: `900` ``` "list.smartCase" **coc-config-list-smartCase** ``` Use smartcase match for fuzzy match and strict match, --ignore-case will be ignored, may not affect interactive list. ``` ``` Scope: `application`, default: `false` ``` "list.source.diagnostics.includeCode" **coc-config-list-source-diagnostics-includeCode** ``` Whether to show the diagnostic code in the list. ``` ``` Scope: `application`, default: `true` ``` "list.source.diagnostics.pathFormat" **coc-config-list-source-diagnostics-pathFormat** ``` Decide how the filepath is shown in the list. ``` ``` Scope: `application`, default: `"full"` ``` "list.source.outline.ctagsFiletypes" **coc-config-list-source-outline-ctagsFiletypes** ``` Filetypes that should use ctags for outline instead of language server. ``` ``` Scope: `application`, default: `[]` ``` "list.source.symbols.excludes" **coc-config-list-source-symbols-excludes** ``` Patterns of minimatch for filepath to exclude from symbols list. ``` ``` Scope: `application`, default: `[]` ``` "list.statusLineSegments" **coc-config-list-statusLineSegments** ``` An array of statusline segments that will be used to draw the status line for list windows. ``` ``` Scope: `application`. ``` ------------------------------------------------------------------------------ NOTIFICATION ``` *coc-config-notification* ``` "notification.border" **coc-config-notification-border** ``` Enable rounded border for notification windows. ``` ``` Scope: `application`, default: `true` ``` "notification.disabledProgressSources" **coc-config-notification-disabledProgressSources** ``` Sources that should be disabled for message progress, use * to disable all progresses. ``` ``` Scope: `application`, default: `[]` ``` "notification.focusable" **coc-config-notification-focusable** ``` Enable focus by user actions (wincmds, mouse events), neovim only. ``` ``` Scope: `application`, default: `true` ``` "notification.highlightGroup" **coc-config-notification-highlightGroup** ``` Highlight group of notification dialog. ``` ``` Scope: `application`, default: `"Normal"` ``` "notification.marginRight" **coc-config-notification-marginRight** ``` Margin right to the right of editor window. ``` ``` Scope: `application`, default: `10` ``` "notification.maxHeight" **coc-config-notification-maxHeight** ``` Maximum content height of notification dialog. ``` ``` Scope: `application`, default: `10` ``` "notification.maxWidth" **coc-config-notification-maxWidth** ``` Maximum content width of notification dialog. ``` ``` Scope: `application`, default: `60` ``` "notification.minProgressWidth" **coc-config-notification-minProgressWidth** ``` Minimal with of progress notification. ``` ``` Scope: `application`, default: `30` ``` "notification.statusLineProgress" **coc-config-notification-statusLineProgress** ``` Show progress notification in status line, instead of use float window/popup. ``` "notification.timeout" **coc-config-notification-timeout** ``` Timeout for auto close notifications, in milliseconds. ``` ``` Scope: `application`, default: `10000` ``` "notification.winblend" **coc-config-notification-winblend** ``` Winblend option of notification window, neovim only. ``` ``` Scope: `application`, default: `30` ``` ------------------------------------------------------------------------------ OUTLINE ``` *coc-config-outline* ``` "outline.autoPreview" **coc-config-outline-autoPreview** ``` Enable auto preview on cursor move. ``` ``` Scope: `application`, default: `false` ``` "outline.autoHide" **coc-config-outline-autoHide** ``` Automatically hide the outline window when an item is clicked. ``` ``` Scope: `application`, default: `false` ``` "outline.autoWidth" **coc-config-outline-autoWidth** ``` Automatically increase window width to avoid wrapped lines. ``` ``` Scope: `application`, default: `true` ``` "outline.checkBufferSwitch" **coc-config-outline-checkBufferSwitch** ``` Recreate outline view after user changed to another buffer on current tab. ``` ``` Scope: `application`, default: `true` ``` "outline.codeActionKinds" **coc-config-outline-codeActionKinds** ``` Filter code actions in actions menu by kinds. ``` ``` Scope: `application`, default: `["","quickfix","refactor"]` ``` "outline.detailAsDescription" **coc-config-outline-detailAsDescription** ``` Show detail as description aside with label, when false detail will be shown in tooltip on cursor hold. ``` ``` Scope: `application`, default: `true` ``` "outline.expandLevel" **coc-config-outline-expandLevel** ``` Expand level of tree nodes. ``` ``` Scope: `application`, default: `1` ``` "outline.followCursor" **coc-config-outline-followCursor** ``` Reveal item in outline tree on cursor hold. ``` ``` Scope: `application`, default: `true` ``` "outline.keepWindow" **coc-config-outline-keepWindow** ``` Jump back to original window after outline is shown. ``` ``` Scope: `application`, default: `false` ``` "outline.previewBorder" **coc-config-outline-previewBorder** ``` Use border for preview window. ``` ``` Scope: `application`, default: `true` ``` "outline.previewBorderHighlightGroup" **coc-config-outline-previewBorderHighlightGroup** ``` Border highlight group of preview window. ``` ``` Scope: `application`, default: `"Normal"` ``` "outline.previewBorderRounded" **coc-config-outline-previewBorderRounded** ``` Use rounded border for preview window. ``` ``` Scope: `application`, default: `false` ``` "outline.previewHighlightGroup" **coc-config-outline-previewHighlightGroup** ``` Highlight group of preview window. ``` ``` Scope: `application`, default: `"Normal"` ``` "outline.previewMaxWidth" **coc-config-outline-previewMaxWidth** ``` Max width of preview window. ``` ``` Scope: `application`, default: `80` ``` "outline.previewWinblend" **coc-config-outline-previewWinblend** ``` Enables pseudo-transparency by set 'winblend' option of window, neovim only. ``` ``` Scope: `application`, default: `0` ``` "outline.showLineNumber" **coc-config-outline-showLineNumber** ``` Show line number of symbols. ``` ``` Scope: `application`, default: `true` ``` "outline.sortBy" **coc-config-outline-sortBy** ``` Default sort method for symbols outline. ``` ``` Scope: `application`, default: `"category"` ``` "outline.splitCommand" **coc-config-outline-splitCommand** ``` Window split command used by outline. ``` ``` Scope: `application`, default: `"botright 30vs"` ``` "outline.switchSortKey" **coc-config-outline-switchSortKey** ``` The key used to switch sort method for symbols provider of current tree view. ``` ``` Scope: `application`, default: `""` ``` "outline.togglePreviewKey" **coc-config-outline-togglePreviewKey** ``` The key used to toggle auto preview feature. ``` ``` Scope: `application`, default: `"p"` ``` ------------------------------------------------------------------------------ PULLDIAGNOSTIC ``` *coc-config-pullDiagnostic* ``` "pullDiagnostic.ignored" **coc-config-pullDiagnostic-ignored** ``` Minimatch patterns to match full filepath that should be ignored for pullDiagnostic. ``` ``` Scope: `application`, default: `[]` ``` "pullDiagnostic.onChange" **coc-config-pullDiagnostic-onChange** ``` Whether to pull for diagnostics on document change. ``` ``` Scope: `language-overridable`, default: `true` ``` "pullDiagnostic.onSave" **coc-config-pullDiagnostic-onSave** ``` Whether to pull for diagnostics on document save. ``` ``` Scope: `language-overridable`, default: `false` ``` "pullDiagnostic.workspace" **coc-config-pullDiagnostic-workspace** ``` Whether to pull for workspace diagnostics when possible. ``` ``` Scope: `application`, default: `true` ``` ------------------------------------------------------------------------------ REFACTOR ``` *coc-config-refactor* ``` "refactor.afterContext" **coc-config-refactor-afterContext** ``` Print num lines of trailing context after each match. ``` ``` Scope: `application`, default: `3` ``` "refactor.beforeContext" **coc-config-refactor-beforeContext** ``` Print num lines of leading context before each match. ``` ``` Scope: `application`, default: `3` ``` "refactor.openCommand" **coc-config-refactor-openCommand** ``` Open command for refactor window. ``` ``` Scope: `application`, default: `"vsplit"` ``` "refactor.saveToFile" **coc-config-refactor-saveToFile** ``` Save changed buffer to file when write refactor buffer with ':noa wa' command. ``` ``` Scope: `application`, default: `true` ``` "refactor.showMenu" **coc-config-refactor-showMenu** ``` Refactor buffer local mapping to bring up menu for this chunk. ``` ``` Scope: `application`, default: `""` ``` ------------------------------------------------------------------------------ SEMANTICTOKENS ``` *coc-config-semanticTokens* ``` "semanticTokens.combinedModifiers" **coc-config-semanticTokens-combinedModifiers** ``` Semantic token modifiers that should have highlight combined with syntax highlights. ``` ``` Scope: `language-overridable`, default: `["deprecated"]` ``` "semanticTokens.enable" **coc-config-semanticTokens-enable** ``` Enable semantic tokens support. ``` ``` Scope: `language-overridable`, default: `false` ``` "semanticTokens.highlightPriority" **coc-config-semanticTokens-highlightPriority** ``` Priority for semantic tokens highlight. ``` ``` Scope: `language-overridable`, default: `2048` ``` "semanticTokens.incrementTypes" **coc-config-semanticTokens-incrementTypes** ``` Semantic token types that should increase highlight when insert at the start and end position of token. ``` ``` Scope: `language-overridable`, default: `["variable","string","parameter"]` ``` ------------------------------------------------------------------------------ SIGNATURE ``` *coc-config-signature* ``` "signature.enable" **coc-config-signature-enable** ``` Enable show signature help when trigger character typed. ``` ``` Scope: `language-overridable`, default: `true` ``` "signature.floatConfig" **coc-config-signature-floatConfig** ``` Configuration of floating window/popup for signature documents, see |coc-config-float|. ``` ``` Scope: `application`, default: `null` ``` "signature.hideOnTextChange" **coc-config-signature-hideOnTextChange** ``` Hide signature float window when text changed on insert mode. ``` ``` Scope: `language-overridable`, default: `false` ``` "signature.preferShownAbove" **coc-config-signature-preferShownAbove** ``` Show signature help float window above cursor when possible, require restart coc.nvim on change. ``` ``` Scope: `application`, default: `true` ``` "signature.target" **coc-config-signature-target** ``` Target of signature help, use float when possible by default. ``` ``` Scope: `language-overridable`, default: `"float"` ``` "signature.triggerSignatureWait" **coc-config-signature-triggerSignatureWait** ``` Timeout for trigger signature help, in milliseconds. ``` ``` Scope: `language-overridable`, default: `500` ``` ------------------------------------------------------------------------------ SNIPPET ``` *coc-config-snippet* ``` "snippet.highlight" **coc-config-snippet-highlight** ``` Use highlight group 'CocSnippetVisual' to highlight placeholders with same index of current one. ``` ``` Scope: `resource`, default: `false` ``` "snippet.nextPlaceholderOnDelete" **coc-config-snippet-nextPlaceholderOnDelete** ``` Automatically jump to the next placeholder when the current one is completely deleted. ``` ``` Scope: `resource`, default: `false` ``` "snippet.statusText" **coc-config-snippet-statusText** ``` Text shown in statusline to indicate snippet session is activated. ``` ``` Scope: `application`, default: `"SNIP"` ``` ------------------------------------------------------------------------------ SUGGEST ``` *coc-config-suggest* ``` "suggest.acceptSuggestionOnCommitCharacter" **coc-config-suggest-acceptSuggestionOnCommitCharacter** ``` Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character. ``` ``` Scope: `language-overridable`, default: `false` ``` "suggest.asciiCharactersOnly" **coc-config-suggest-asciiCharactersOnly** ``` Trigger suggest with ASCII characters only. ``` ``` Scope: `language-overridable`, default: `false` ``` "suggest.segmenterLocales" **coc-config-suggest-segmenterLocales** ``` Locales used for divide sentence into segments for around and buffer source, works when NodeJS built with intl support, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/Segmenter#parameters default empty string means auto detect, use null to disable this feature. ``` ``` Scope: `language-overridable`, default: `""` ``` "suggest.asciiMatch" **coc-config-suggest-asciiMatch** ``` Convert unicode characters to ascii for match. ``` ``` Scope: `language-overridable`, default: `true` ``` "suggest.autoTrigger" **coc-config-suggest-autoTrigger** ``` How should completion be triggered, could be `"always"`, `"trigger"` or `"none"`. ``` ``` Scope: `language-overridable`, default: `"always"` ``` "suggest.completionItemKindLabels" **coc-config-suggest-completionItemKindLabels** ``` Set custom labels to completion items' kinds. Default value: > { "text": "v", "method": "f", "function": "f", "constructor": "f", "field": "m", "variable": "v", "class": "C", "interface": "I", "module": "M", "property": "m", "unit": "U", "value": "v", "enum": "E", "keyword": "k", "snippet": "S", "color": "v", "file": "F", "reference": "r", "folder": "F", "enumMember": "m", "constant": "v", "struct": "S", "event": "E", "operator": "O", "typeParameter": "T", "default": "" } ``` < ``` Scope: `application` ``` "suggest.defaultSortMethod" **coc-config-suggest-defaultSortMethod** ``` Default sorting behavior when trigger is empty, could be `"length"`, `"alphabetical"` or `"none"`. ``` ``` Scope: `language-overridable`, default: `"length"` ``` "suggest.detailField" **coc-config-suggest-detailField** ``` Where to show the detail text of CompleteItem from language server. ``` ``` Scope: `application`, default: `"preview"` ``` "suggest.enableFloat" **coc-config-suggest-enableFloat** ``` Enable float window with documentation aside with popupmenu. ``` ``` Scope: `language-overridable`, default: `true` ``` "suggest.enablePreselect" **coc-config-suggest-enablePreselect** ``` Enable preselect feature, works when |coc-config-suggest-noselect| is false. ``` ``` Scope: `application`, default: `true` ``` "suggest.filterGraceful" **coc-config-suggest-filterGraceful** ``` Controls whether filtering and sorting suggestions accounts for small typos. ``` ``` Scope: `language-overridable`, default: `true` ``` "suggest.filterOnBackspace" **coc-config-suggest-filterOnBackspace** ``` Filter complete items on backspace. ``` ``` Scope: `language-overridable`, default: `true` ``` "suggest.floatConfig" **coc-config-suggest-floatConfig** ``` Configure style of popup menu and documentation window for completion, see |coc-config-float|. ``` ``` Note: some properties not work, including: "focusable", "close" and "maxHeight" (use 'pumheight' option for maximum height of popup menu). ``` ``` Note: "maxWidth" not works for popup menu, use |coc-config-suggest-labelMaxLength| instead. ``` "suggest.formatItems" **coc-config-suggest-formatItems** ``` Items shown in popup menu in order. ``` ``` Scope: `application`, default: `["abbr","menu","kind","shortcut"]` ``` "suggest.highPrioritySourceLimit" **coc-config-suggest-highPrioritySourceLimit** ``` Max items count for source priority bigger than or equal to 90. ``` ``` Scope: `language-overridable`, default: `null` ``` "suggest.insertMode" **coc-config-suggest-insertMode** ``` Controls whether words are overwritten when accepting completions. ``` ``` Scope: `language-overridable`, default: `“replace"` ``` "suggest.ignoreRegexps" **coc-config-suggest-ignoreRegexps** ``` Regexps to ignore when trigger suggest. ``` ``` Scope: `language-overridable`, default: `[]` ``` "suggest.invalidInsertCharacters" **coc-config-suggest-invalidInsertCharacters** ``` Invalid character for strip valid word when inserting text of complete item. ``` ``` Scope: `application`, default: `["\r","\n"]` ``` "suggest.labelMaxLength" **coc-config-suggest-labelMaxLength** ``` Max length of abbr that shown as label of complete item. ``` ``` Scope: `application`, default: `200` ``` "suggest.languageSourcePriority" **coc-config-suggest-languageSourcePriority** ``` Priority of language sources. ``` ``` Scope: `language-overridable`, default: `99` ``` "suggest.localityBonus" **coc-config-suggest-localityBonus** ``` Boost suggestions that appear closer to the cursor position. ``` ``` Scope: `language-overridable`, default: `true` ``` "suggest.lowPrioritySourceLimit" **coc-config-suggest-lowPrioritySourceLimit** ``` Max items count for source priority lower than 90. ``` ``` Scope: `language-overridable`, default: `null` ``` "suggest.maxCompleteItemCount" **coc-config-suggest-maxCompleteItemCount** ``` Maximum number of complete items shown in vim. ``` ``` Scope: `language-overridable`, default: `256` ``` "suggest.minTriggerInputLength" **coc-config-suggest-minTriggerInputLength** ``` Minimal input length for trigger completion. ``` ``` Scope: `language-overridable`, default: `1` ``` "suggest.noselect" **coc-config-suggest-noselect** ``` Not make vim select first item on popupmenu shown. ``` ``` Scope: `application`, default: `false` ``` "suggest.preferCompleteThanJumpPlaceholder" **coc-config-suggest-preferCompleteThanJumpPlaceholder** ``` Confirm completion instead of jump to next placeholder when completion is activated. ``` ``` Scope: `resource`, default: `false` ``` "suggest.pumFloatConfig" **coc-config-suggest-pumFloatConfig** ``` Configure style of popup menu, |coc-config-suggest-floatConfig| is used when not specified, see |coc-config-float|. ``` ``` Available properties: "border", "rounded", "highlight", "borderhighlight", "winblend", "title" and "shadow". ``` ``` Note: 'winblend' option is used for custom popup menu when not configured (neovim only), use 'pumwidth' for minimal width of popup menu and 'pumheight' for maximum height of popup menu. ``` ``` Scope: `application`, default: `null` ``` "suggest.removeDuplicateItems" **coc-config-suggest-removeDuplicateItems** ``` Remove completion items with duplicated word for all sources, snippet items are excluded. ``` ``` Scope: `language-overridable`, default: `false` ``` "suggest.removeCurrentWord" **coc-config-suggest-removeCurrentWord** ``` Remove word item (from around and buffer source) that is identical to current input ``` ``` Scope: `language-overridable`, default: `false` ``` "suggest.reTriggerAfterIndent" **coc-config-suggest-reTriggerAfterIndent** ``` Controls re-trigger or not after indent changes. ``` ``` Scope: `application`, default: `true` ``` "suggest.reversePumAboveCursor" **coc-config-suggest-reversePumAboveCursor** ``` Reverse order of complete items when pum shown above cursor. ``` ``` Scope: `application`, default: `false` ``` "suggest.selection" **coc-config-suggest-selection** ``` Controls how suggestions are pre-selected when showing the suggest list. ``` ``` Scope: `application`, default: `"first"` ``` "suggest.snippetIndicator" **coc-config-suggest-snippetIndicator** ``` The character used in abbr of complete item to indicate the item could be expand as snippet. ``` # Scope: `application`, default: `"~"` "suggest.snippetsSupport" **coc-config-suggest-snippetsSupport** ``` Set to false to disable snippets support of completion. ``` ``` Scope: `language-overridable`, default: `true` ``` "suggest.timeout" **coc-config-suggest-timeout** ``` Timeout for completion, in milliseconds. ``` ``` Scope: `language-overridable`, default: `5000` ``` "suggest.triggerAfterInsertEnter" **coc-config-suggest-triggerAfterInsertEnter** ``` Trigger completion after InsertEnter, |coc-config-suggest-autoTrigger| should be 'always' to enable this option ``` ``` Scope: `language-overridable`, default: `false` ``` "suggest.triggerCompletionWait" **coc-config-suggest-triggerCompletionWait** ``` Wait time between text change and completion start, cancel completion when text changed during wait. ``` ``` Scope: `language-overridable`, default: `0` ``` "suggest.virtualText" **coc-config-suggest-virtualText** ``` Show virtual text after cursor for insert word of current selected complete item. ``` ``` Scope: `application`, default: `false` ``` ------------------------------------------------------------------------------ INLINE COMPLETION ``` *coc-config-inlineSuggest* ``` "inlineSuggest.autoTrigger" **coc-config-inlineSuggest-autoTrigger** ``` Enable automatically trigger inline completion after completion done or cursor hold. ``` ``` Scope: `language-overridable`, default: `true` ``` "inlineSuggest.triggerCompletionWait" **coc-config-inlineSuggest-triggerCompletionWait** ``` Wait time in milliseconds between text synchronize and trigger inline completion. ``` ``` Scope: `language-overridable`, default: `10` ``` ------------------------------------------------------------------------------ TYPEHIERARCHY ``` *coc-config-typeHierarchy* ``` "typeHierarchy.enableTooltip" **coc-config-typeHierarchy-enableTooltip** ``` Enable tooltip to show relative filepath of type hierarchy item. ``` ``` Scope: `application`, default: `true` ``` "typeHierarchy.openCommand" **coc-config-typeHierarchy-openCommand** ``` Open command for type hierarchy tree view. ``` ``` Scope: `application`, default: `"edit"` ``` "typeHierarchy.splitCommand" **coc-config-typeHierarchy-splitCommand** ``` Window split command used by type hierarchy tree view. ``` ``` Scope: `application`, default: `"botright 30vs"` ``` ============================================================================== vim:tw=78:nosta:noet:ts=8:sts=0:ft=help:noet:fen: --- # Source: https://github.com/neoclide/coc.nvim/blob/master/doc/coc.txt **coc-nvim.txt** NodeJS client for Vim & Neovim. Version: 0.0.82 Author: Qiming Zhao CONTENTS **coc-contents** Introduction |coc-introduction| Requirements |coc-requirements| Installation |coc-installation| File system watch |coc-filesystemwatch| Language server |coc-languageserver| Extensions |coc-extensions| Configuration |coc-configuration| Floating windows |coc-floating| LSP features |coc-lsp| Document |coc-document| Hover |coc-hover| Completion |coc-completion| Inline completion |coc-inlineCompletion| Diagnostics |coc-diagnostics| Pull diagnostics |coc-pullDiagnostics| Locations |coc-locations| Rename |coc-rename| Signature help |coc-signature| Inlay hint |coc-inlayHint| Format |coc-format| Code action |coc-code-actions| Document highlights |coc-document-highlights| Document colors |coc-document-colors| Document links |coc-document-links| Snippets |coc-snippets| Workspace |coc-workspace| Cursors |coc-cursors| Outline |coc-outline| Call hierarchy |coc-callHierarchy| Type hierarchy |coc-typeHierarchy| Semantic highlights |coc-semantic-highlights| Fold |coc-fold| Selection range |coc-selection-range| Code Lens |coc-code-lens| Linked editing |coc-linked-editing| Interface |coc-interface| Key mappings |coc-key-mappings| Variables |coc-variables| Environment variables |coc-environment-variables| Buffer variables |coc-buffer-variables| Window variables |coc-window-variables| Global variables |coc-global-variables| Functions |coc-functions| Commands |coc-commands| Autocmds |coc-autocmds| Highlights |coc-highlights| Tree |coc-tree| Tree mappings |coc-tree-mappings| Tree filter |coc-tree-filter| List |coc-list| List command |coc-list-command| List command options |coc-list-options| List configuration |coc-list-configuration| List mappings |coc-list-mappings| list sources |coc-list-sources| Dialog |coc-dialog| Dialog basic |coc-dialog-basic| Dialog confirm |coc-dialog-confirm| Dialog input |coc-dialog-input| Dialog menu |coc-dialog-menu| Dialog picker |coc-dialog-picker| Notification |coc-notification| Statusline integration |coc-status| Manual |coc-status-manual| Airline |coc-status-airline| Lightline |coc-status-lightline| Create plugins |coc-plugins| FAQ |coc-faq| Change log |coc-changelog| ============================================================================== INTRODUCTION **coc-introduction** Coc.nvim enhances your (Neo)Vim to match the user experience provided by VSCode through a rich extension ecosystem and implemented the client features specified by Language Server Protocol (3.17 for now), see |coc-lsp|. Some features (like completion and inline completion) automatically works by default, all of them can be disabled by |coc-configuration|. # Some key features: ~ • Typescript APIs compatible with both Vim8 and Neovim. • Loading VSCode-like extensions |coc-api-extension|. • Configuring coc.nvim and its extensions with JSON configuration |coc-configuration|. • Configuring Language Servers that using Language Server Protocol (LSP) |coc-config-languageserver|. It is designed for best possible integration with other Vim plugins. Note: coc.nvim doesn't come with support for any specific language. You will need to install coc.nvim extensions |coc-extensions| or set up the language server by use |coc-config-languageserver|. Note: multiple language servers for same document is allowed, but you should avoid configure same language server that already used by coc.nvim extension. Note: automatic completion plugins can't play nicely together, you can disable automatic completion of coc.nvim by use `"suggest.autoTrigger": "none"` (or `"suggest.autoTrigger": "trigger"`) in your |coc-configuration|. ============================================================================== REQUIREMENTS **coc-requirements** Neovim >= 0.8.0 or Vim >= 9.0.0483. NodeJS https://nodejs.org/ >= 16.18.0. For neovim user, use command |:checkhealth| to check issue with current environment. ============================================================================== INSTALLATION **coc-installation** If you're using [vim-plug](https://github.com/junegunn/vim-plug), add this to your `init.vim` or `.vimrc`: > Plug 'neoclide/coc.nvim', {'branch': 'release'} < And run: > :PlugInstall For other plugin managers, make sure to use the release branch (unless you need to build from typescript source code). To use Vim's native |packages| on Linux or macOS, use script like: > #!/bin/sh # for vim8 # mkdir -p ~/.vim/pack/coc/start # cd ~/.vim/pack/coc/start curl --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz|tar xzfv - # vim -c 'helptags ~/.vim/pack/coc/start/doc|q' # for neovim # mkdir -p ~/.local/share/nvim/site/pack/coc/start # cd ~/.local/share/nvim/site/pack/coc/start curl --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz|tar xzfv - # nvim -c 'helptags ~/.local/share/nvim/site/pack/coc/start|q' when using source code of coc.nvim, you'll have to run `npm install` in project root of coc.nvim. ============================================================================== File system watch **coc-filesystemwatch** Watchman https://facebook.github.io/watchman/ is used by coc.nvim to provide file change detection to extensions and languageservers. The watchman command is detected from your `$PATH`, the feature will silently fail when watchman can't work. Watchman automatically watch |coc-workspace-folders| for file events by default. Use command: > ``` :CocCommand workspace.showOutput watchman ``` < to open output channel of watchman. Use configuration |coc-config-fileSystemWatch| to change behavior of file system watch. Note: The default filesystem watch limit can be easily exceeded for many projects, checkout https://facebook.github.io/watchman/docs/install#system-specific-preparation ============================================================================== LANGUAGESERVER **coc-languageserver** Language servers are services which provide LSP features, the servers are provided by |coc-extensions| or |coc-config-languageserver|. To get language server for your language, see: https://github.com/neoclide/coc.nvim/wiki/Language-servers To debug language server, see: https://github.com/neoclide/coc.nvim/wiki/Debug-language-server ============================================================================== EXTENSIONS **coc-extensions** Compare to |coc-config-languageserver| extensions are more powerful since they could contribute json schemes, commands, and use middleware methods of languageserver to provide better results. Extensions could provide more features by make use of NodeJS and coc.nvim's API. ``` *coc-extensions-folder* ``` Extensions are loaded from `"extensions"` folder inside |coc#util#get_data_home()| and folders in 'runtimepath' when detected. Use `let $COC_NO_PLUGINS = '1'` in vimrc to disable the load of extensions. See |coc-api-extension| for the guide to create coc.nvim extension. # Install extensions from git (not recommended): ~ • Download the source code. • In project root, install dependencies and compile the code by `npm install` (needed by most coc extensions). • Add the project root to vim's runtimepath by `set runtimepath^=/path/to/project` Plugin manager like [vim-plug] can be used as well. Note: use coc.nvim extensions from source code requires install dependencies, which may take huge disk usage. ``` *coc-extensions-npm* # Install global extensions from npm (recommended): ~ ``` Use |:CocInstall| to install coc extensions from vim's command line. To make coc.nvim install extensions on startup, use |g:coc_global_extensions|. To use package manager other than npm (like `yarn` or `pnpm`), use |coc-config-npm-binPath|. To customize npm registry for coc.nvim add `coc.nvim:registry` in your # `~/.npmrc`, like: > ``` coc.nvim:registry=https://registry.mycompany.org/ ``` < To customize extension folder, configure |g:coc_data_home|. # Uninstall global extensions: ~ Use |:CocUninstall|. # Update global extensions: ~ Use |:CocUpdate| or |:CocUpdateSync|. To configure extension behavior, see |coc-config-extensions|. # Manage extensions: ~ Use |coc-list-extensions| or |CocAction('extensionStats')| to get list of extensions. ============================================================================== CONFIGURATION **coc-configuration** The configuration of coc.nvim is stored in file named "coc-settings.json". Configuration properties are contributed by coc.nvim itself and coc.nvim extensions. See |coc-config| for builtin configurations. The configuration files are all in JSON format (with comment supported), it's recommended to enable JSON completion and validation by install the `coc-json` extension: > ``` :CocInstall coc-json ``` < To fix the highlight of comment, use: > ``` autocmd FileType json syntax match Comment +\/\/.\+$+ ``` < in your vimrc. # Global configuration file: ~ Command |:CocConfig| will open (create when necessary) a user settings file in the folder returned by |coc#util#get_config_home()|. The user configuration value could be overwritten by API |coc#config()| or |g:coc_user_config|. The global configuration file can be created in another directory by setting |g:coc_config_home| in your vimrc like: > ``` let g:coc_config_home = '/path/to/folder' ``` # Folder configuration file: ~ To create a local configuration file for a specific workspace folder, use |:CocLocalConfig| to create and open `.vim/coc-settings.json` in current workspace folder. Folder configuration would overwrite user configuration. Note: the configuration file won't work when the parent folder is not resolved as workspace folder, it's best practice to start vim inside workspace folder, see |coc-workspace-folders|. ``` *coc-configuration-expand* # Variables expands: ~ ``` Variables would be expanded in string values of configuration, supported variables: • `${userHome}` the path of the user's home folder • `${cwd}` current working directory of vim. You can also reference environment variables through the `${env:name}` syntax (for example, `${env:USERNAME}`), no expand happens when env not exists. Configurations that requires file paths (ex: # |coc-config-workspace-ignoredFolders|) support expand `~` at the beginning of the filepath to user's home and some additional variables: • `${workspaceFolder}` the current opened file's workspace folder. • `${workspaceFolderBasename}` the name of the workspace folder opened in coc.nvim without any slashes (/). • `${file}` the current opened file. • `${fileDirname}` the current opened file's dirname. • `${fileExtname}` the current opened file's extension. • `${fileBasename}` the current opened file's basename • `${fileBasenameNoExtension}` the current opened file's basename with no file extension. ``` *coc-configuration-scope* # Configuration scope: ~ ``` A configuration could be one of three different configuration scopes: • `"application"` the configuration could only be used in user configuration file. • `"resource"` the configuration could be used in user and workspace folder configuration file. • `"language-overridable"` the configuration could be used in user and workspace folder configuration file, and can be use used in language scoped configuration section like `[typescript][json]`. For example: > // disable inlay hint for some languages "[rust][lua][c]": { "inlayHint.enable": false } < ============================================================================== FLOATING WINDOWS **coc-floating** Floating windows/popups are created by |api-floatwin| on neovim or |popupwin| on vim. ``` *coc-floating-scroll* # Scroll floating windows: ~ ``` See |coc#float#has_scroll()| for example. Note: use |coc#pum#scroll()| for scroll popup menu. ``` *coc-floating-close* # Close floating windows: ~ ``` To close all floating windows/popups use |coc#float#close_all()| or |popup_clear()| on vim. Or you can use o on neovim which close all split windows as well. To close single floating window/popup, use |coc#float#close()|. ``` *coc-floating-focus* # Focus floating windows: ~ ``` On neovim, use w (or |(coc-float-jump)|) could focus a floating window just created (if it's focusable). It's not allowed to focus popups on vim, unless it's using a terminal buffer. ``` *coc-floating-config* # Configure floating windows: ~ ``` To set custom window options on floating window create, use autocmd |CocOpenFloat| or |CocOpenFloatPrompt|. # Related variables: ~ • |g:coc_last_float_win| • |g:coc_borderchars| • |g:coc_border_joinchars| • |g:coc_markdown_disabled_languages| # Related highlight groups: ~ • |CocFloating| For floating window background. • |CocFloatBorder| Default border highlight group of floating window. • |CocFloatDividingLine| For dividing lines. • |CocFloatActive| For active parts. • |CocMenuSel| For selected line. To customize floating windows used by popup menu, use: • |coc-config-suggest-floatConfig| • |coc-config-suggest-pumFloatConfig| For floating windows created around cursor, like diagnostics, hover and signature use |coc-config-floatFactory-floatConfig| for common float configurations. For further customization, use: • |coc-config-diagnostic-floatConfig| • |coc-config-signature-floatConfig| • |coc-config-hover-floatConfig| For customize dialog windows, use |coc-config-dialog|. For customize notification windows, use |coc-config-notification|. Configure |coc-preferences-enableMessageDialog| to show user non-interactive or interactive messages as notifications. To enable a more flexible user interaction with the messages check |coc-preferences-messageDialogKind| and |coc-preferences-messageReportKind| Use |coc-preferences-messageDialogKind| to configure how interactive messages which require some user input are shown to the user this configuration supersedes the |coc-preferences-enableMessageDialog|. Use |coc-preferences-messageReportKind| to configure how regular non-interactive messages are reported to the user, that will tell coc how to show regular plain text messages to the user. ============================================================================== LSP FEATURES **coc-lsp** Most features of LSP 3.17 are supported, checkout the specification at https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/ # Features not supported: ~ • Telemetry. • Inline values for debugger. • Notebook document. LSP features only works with attached documents, see |coc-document-attached|. To check exists providers of current buffer, use command `:CocCommand document.checkBuffer` or API |CocHasProvider()|. For historic reason, some features automatically works by default, but some are not. # Features automatically work by default: ~ • Trigger completion after text insert |coc-completion|. • Trigger inline completion |coc-inlineCompletion| • Diagnostics refresh |coc-diagnostics|. • Pull diagnostics |coc-pullDiagnostics|. • Trigger signature help |coc-signature|. • Inlay hints |coc-inlayHint| Most features could be toggled by |coc-configuration| and some vim variables. To disable all features that automatically work, use configuration: > "suggest.autoTrigger": "none", "diagnostic.enable": false, "pullDiagnostic.onChange": false, "signature.enable": false, "inlayHint.enable": false, < # Features require enabled by configuration: ~ • Semantic highlights |coc-semantic-highlights|. • Document color highlights |coc-document-colors|. • Code lens, |coc-code-lens| • Linked editing, |coc-linked-editing|. • Format on type, enabled by |coc-preferences-formatOnType| • Format on save, enabled by |coc-preferences-formatOnSave|. # Features requested by user: ~ • Locations related (including definitions, references etc.) |coc-locations| • Invoke code action |coc-code-actions|. • Show call hierarchy tree |coc-callHierarchy|. • Show type hierarchy tree |coc-typeHierarchy| • Format, range format and on type format |coc-format|. • Highlight same symbol ranges |coc-document-highlights|. • Outline of document symbols |coc-outline| and |coc-list-symbols|. • Show hover information |coc-hover|. • Rename symbol under cursor |coc-rename|. • Open link under cursor |coc-document-links|. • Selection range |coc-selection-range| • Create folding ranges |coc-fold|. For convenient, some actions have associated |coc-key-mappings| provided. Prefer |CocAction()| for more options. # Features triggered by languageserver: ~ • Show message notification (use |coc-notification|). • Show message request (use |coc-dialog-menu|). • Log message notification (use `:CocCommand workspace.showOutput` to show output). • Show document request (opened by vim or your browser for url). • Work done progress (use |coc-notification|). To make coc.nvim provide LSP features for your languages, checkout https://github.com/neoclide/coc.nvim/wiki/Language-servers To debug issues with languageserver, checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server ------------------------------------------------------------------------------ DOCUMENT **coc-document** An associated document is created on buffer create, and disposed on buffer unload. # Attached document: ~ ``` *coc-document-attached* ``` An attached document means coc.nvim synchronize the lines of vim's buffer with associated document automatically. Only attached documents are synchronized with language servers and therefore LSP features could be provided for the attached buffer. The buffer may not be attached by following reasons: • The 'buftype' is neither nor 'acwrite', (could be bypassed by |b:coc_force_attach|). • Buffer variable |b:coc_enabled| is `0`. • Byte length of buffer exceed |coc-preferences-maxFileSize|. • Buffer is used for command line window. Use |CocAction('ensureDocument')| or `:CocCommand document.checkBuffer` to check attached state of current buffer. # Filetype map: ~ ``` *coc-document-filetype* ``` Some filetypes are mapped to others to match the languageId used by VSCode, including: • javascript.jsx -> javascriptreact • typescript.jsx -> typescriptreact • typescript.tsx -> typescriptreact • tex -> latex Use |g:coc_filetype_map| to create additional filetype maps. Use `:CocCommand document.echoFiletype` to echo mapped filetype of current document. Note: make sure use mapped filetypes for configurations that expect filetypes. ------------------------------------------------------------------------------ HOVER **coc-hover** Hover feature provide information at a given text document position, normally include type information and documentation of current symbol. # Hover functions: ~ • |CocAction('doHover')| Show hover information at cursor position. • |CocAction('definitionHover')||| Show hover information with definition context at cursor position. • |CocAction('getHover')| Get hover documentations at cursor position. ``` *coc-hover-example* # Hover key-mapping example: ~ ``` > nnoremap K :call ShowDocumentation() " Show hover when provider exists, fallback to vim's builtin behavior. function! ShowDocumentation() if CocAction('hasProvider', 'hover') call CocActionAsync('definitionHover') else call feedkeys('K', 'in') endif endfunction < ------------------------------------------------------------------------------ COMPLETION **coc-completion** Vim's builtin completion is not used. The default completion works like completion in VSCode: • Completion is automatically triggered by default. • Selection is enabled by default, use |coc-config-suggest-noselect| to disable default selection. • When selection is enabled and no preselect item exists, the first complete item will be selected (depends on |coc-config-suggest-selection|). • Snippet expand and additional edits only work after confirm completion |coc#pum#confirm()|. • |'completeopt'| is not used and APIs of builtin popupmenu not work. ``` *coc-completion-default* # Default Key-mappings: ~ ``` To make the new completion works like the builtin completion, without any additional configuration, the following key-mappings are used when the {lhs} is not mapped: • `` navigate to next complete item or inline complete item. • `` navigate to previous complete item or inline complete item. • `` navigate to next complete item (without word insert) or inline complete item. • `` navigate to previous complete item (without word insert) or inline complete item. • `` cancel the completion or inline completion. • `` confirm completion or accept current inline complete item. Use and to scroll: > inoremap coc#pum#visible() ? coc#pum#scroll(1) : "\" inoremap coc#pum#visible() ? coc#pum#scroll(0) : "\" < Note: and are not remapped by coc.nvim. ``` *coc-completion-variables* # Related variables: ~ ``` • Disable completion for buffer: |b:coc_suggest_disable| • Disable specific sources for buffer: |b:coc_disabled_sources| • Disable words for completion: |b:coc_suggest_blacklist| • Add additional keyword characters: |b:coc_additional_keywords|, the buffer keyword characters are used for filter completion items instead of trigger completion, see |'iskeyword'|. ``` *coc-completion-functions* # Related functions: ~ ``` • Trigger completion with options: |coc#start()|. • Trigger completion refresh: |coc#refresh()|. • Select and confirm completion: |coc#pum#select_confirm()|. • Check if the custom popupmenu is visible: |coc#pum#visible()|. • Select the next completion item: |coc#pum#next()|. • Select the previous completion item: |coc#pum#prev()|. • Cancel completion and reset trigger text: |coc#pum#cancel()|. • Confirm completion: |coc#pum#confirm()|. • Close the popupmenu only: |coc#pum#stop()|. • Get information about the popupmenu: |coc#pum#info()|. • Select specific completion item: |coc#pum#select()|. • Insert word of selected item and finish completion: |coc#pum#insert()|. • Insert one more character from current complete item: |coc#pum#one_more()|. • Scroll popupmenu: |coc#pum#scroll()|. ``` *coc-completion-customize* # Customize completion: ~ ``` Use |coc-config-suggest| to change the completion behavior. Use |'pumwidth'| for configure the minimal width of the popupmenu and |'pumheight'| for its maximum height. Related Highlight groups: ``` |CocPum| for highlight groups of customized pum. |CocSymbol| for kind icons. |CocMenuSel| for background highlight of selected item. |CocPumVirtualText| for virtual text when enabled by |coc-config-suggest-virtualText|. ``` Note: background, border, title and winblend are configured by |coc-config-suggest-floatConfig|. # Example user key-mappings: ~ ``` *coc-completion-example* ``` Note: use command `:verbose imap` to check current insert key-mappings when your key-mappings not work. Use and to navigate completion list: > function! CheckBackspace() abort let col = col('.') - 1 # return !col || getline('.')[col - 1] =~ '\s' endfunction " Insert when previous text is space, refresh completion if not. inoremap ``` \ coc#pum#visible() ? coc#pum#next(1): \ CheckBackspace() ? "\" : \ coc#refresh() ``` inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" Use to trigger completion: > if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif < Use to confirm completion, use: > inoremap coc#pum#visible() ? coc#pum#select_confirm() : "\" < To make to confirm selection of selected complete item or notify coc.nvim to format on enter, use: > inoremap coc#pum#visible() ? coc#pum#select_confirm() ``` \: "\u\\=coc#on_enter()\" ``` Map for trigger completion, completion confirm, inline completion accept, snippet expand and jump like VSCode: > inoremap \ coc#pum#visible() ? coc#pum#select_confirm() : \ coc#inline#visible() ? coc#inline#accept() : \ coc#expandableOrJumpable() ? \ "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : \ CheckBackspace() ? "\" : \ coc#refresh() function! CheckBackspace() abort let col = col('.') - 1 # return !col || getline('.')[col - 1] =~# '\s' endfunction let g:coc_snippet_next = '' < Note: the `coc-snippets` extension is required for this to work. ------------------------------------------------------------------------------ INLINE COMPLETION **coc-inlineCompletion** Inline Completion is a smart, lightweight alternative to traditional IntelliSense, offering faster, context-aware suggestions without disrupting your workflow. Inline completion is automatically triggered after document contents synchronize on insert mode by default. Use command `:CocCommand document.checkInlineCompletion` to check inline completion feature of current buffer. ``` *coc-inlineCompletion-default* # Default Key-mappings: ~ ``` Inline completion and default completion shares default key mappings for navigate and finish actions. see |coc-completion-default|. To accept inline completion when pum is visible, finish the completion first or use |coc#inline#accept()|. ``` *coc-inlineCompletion-functions* # Related functions: ~ ``` • Trigger inline completion: |coc#inline#trigger()|. • Check if inline completion visual text exists: |coc#inline#visible()|. • Cancel inline completion: |coc#inline#cancel()|. • Accept inline completion: |coc#inline#accept()|. • Navigate to next: |coc#inline#next()|. • Navigate to previous: |coc#inline#prev()|. ``` *coc-inlineCompletion-customize* # Customize completion: ~ ``` Use |coc-config-inlineSuggest| to change the inline completion behavior. To disable inline completion for special buffers, use language overridable configuration in coc-settings.json like: > ``` "[javascript][typescript]": { "inlineSuggest.autoTrigger": false } ``` < Which disable auto trigger only, or use |b:coc_inline_disable| to disable trigger inline completion completely. Related Highlight groups: ``` |CocInlineVirtualText| for virtual text highlight. |CocInlineAnnotation| for annotation highlight. ``` ------------------------------------------------------------------------------ DIAGNOSTICS SUPPORT **coc-diagnostics** Diagnostics of coc.nvim are automatically refreshed to UI by default, checkout |coc-config-diagnostic| for available configurations. Note most language servers only send diagnostics for opened buffers for performance reason, some lint tools could provide diagnostics for all files in workspace. See |coc-highlights-diagnostics| for diagnostic related highlight groups. ``` *coc-diagnostics-refresh* # Changes on diagnostics refresh ~ ``` • Add highlights for diagnostic ranges and virtual text (when enabled on neovim or vim >= 9.0.0067), see |coc-highlights-diagnostics|. • Add diagnostic signs to 'signcolumn', use `set signcolumn=yes` to avoid unnecessary UI refresh. • Update variable |b:coc_diagnostic_info|. • Refresh related |location-list| which was opened by |:CocDiagnostics|. Diagnostics are not refreshed when buffer is hidden, and refresh on insert mode is disabled by default. See |coc-highlights-diagnostics| for highlight groups used by diagnostics. ``` *coc-diagnostics-toggle* # Enable and disable diagnostics ~ ``` Use |coc-config-diagnostic-enable| to toggle diagnostics feature. Use |CocAction('diagnosticToggle')| for enable/disable diagnostics feature. Use |CocAction('diagnosticToggleBuffer')| for enable/disable diagnostics of current buffer. # Show diagnostic messages ~ Diagnostic messages would be automatically shown/hide when the diagnostics under cursor position changed (use float window/popup when possible) by default. To manually refresh diagnostics messages, use |(coc-diagnostic-info)| and |CocAction('diagnosticPreview')|. ``` *coc-diagnostics-jump* # Jump between diagnostics ~ ``` Use key-mappings: ``` |(coc-diagnostic-next)| jump to diagnostic after cursor position. |(coc-diagnostic-prev)| jump to diagnostic before cursor position. |(coc-diagnostic-next-error)| jump to next error. |(coc-diagnostic-prev-error)| jump to previous error. ``` Diagnostic may have related location, to jump to related location, use: > :CocCommand workspace.diagnosticRelated < # Check diagnostics ~ Use |coc-list-diagnostics| to open |coc-list| with all available diagnostics. Use API |CocAction('diagnosticList')| to get list of all diagnostics. Use |:CocDiagnostics| to open vim's location list with diagnostics of current buffer. To automatically close the location list window, use autocmd |CocDiagnosticChange| with |CocAction('diagnosticList')|. ------------------------------------------------------------------------------ PULL DIAGNOSTICS SUPPORT **coc-pullDiagnostics** Diagnostics are pulled for visible documents when supported by languageserver. Pull for workspace diagnostics is also enabled by default. Document diagnostics are pulled on change by default, and can be configured to be pulled on save. Checkout |coc-config-pullDiagnostic| for related configurations. ------------------------------------------------------------------------------ LOCATIONS SUPPORT **coc-locations** There're different kinds of locations, including "definitions", "declarations", "implementations", "typeDefinitions" and "references". # Key-mappings for invoke locations request ~ • |(coc-definition)| • |(coc-declaration)| • |(coc-implementation)| • |(coc-type-definition)| • |(coc-references)| • |(coc-references-used)| Error will be shown when the buffer not attached |coc-document-attached|. Message will be shown when no result found. # Location jump behavior ~ When there's only one location returned, the location is opened by command specified by |coc-preferences-jumpCommand| ("edit" by default), context mark is added by |m'|, so you can jump back previous location by . When multiple locations returned, |coc-list-location| is opened for preview and other further actions. To use |coc-list-location| for single location as well, use |coc-locations-api| (instead key-mappings provided by coc.nvim). To change default options of |coc-list-location| or use other plugin for list of locations, see |g:coc_enable_locationlist|. To use vim's quickfix for locations, use configuration |coc-preferences-useQuickfixForLocations|. To use vim's tag list for definitions, use |CocTagFunc()|. ``` *coc-locations-api* # Related APIs ~ ``` • |CocAction('jumpDefinition')| Jump to definition locations. • |CocAction('jumpDeclaration')| Jump to declaration locations. • |CocAction('jumpImplementation')| Jump to implementation locations. • |CocAction('jumpTypeDefinition')| Jump to type definition locations. • |CocAction('jumpReferences')|| Jump to references. • |CocAction('jumpUsed')| Jump to references without declarations. • |CocAction('definitions')| Get definition list. • |CocAction('declarations')| Get declaration list. • |CocAction('implementations')| Get implementation list. • |CocAction('typeDefinitions')| Get type definition list. • |CocAction('references')| Get reference list. Send custom locations request to languageserver: • |CocLocations()| • |CocLocationsAsync()| ------------------------------------------------------------------------------ RENAME **coc-rename** Rename provides workspace-wide rename of a symbol. Workspace edit |coc-workspace-edit| is requested and applied to related buffers when confirmed. Check if current buffer has rename provider with `:echo CocAction('hasProvider', 'rename')` # Rename key-mappings: ~ • |(coc-rename)| # Rename functions: ~ • |CocAction('rename')| Rename the symbol under the cursor. • |CocAction('refactor')| Open refactor buffer for all references (including definitions), recommended for function signature refactor. # Rename local variable: ~ Use command `:CocCommand document.renameCurrentWord` which uses |coc-cursors| to edit multiple locations at the same time and defaults to word extraction when rename provider doesn't exist. # Rename configuration: ~ Use |coc-preferences-renameFillCurrent| to enable/disable populating prompt window with current variable name. ------------------------------------------------------------------------------ SIGNATURE HELP **coc-signature** Signature help for functions is shown automatically when user types trigger characters defined by the provider, which will use floating window/popup to show relevant documentation. Use |CocAction('showSignatureHelp')| to trigger signature help manually. Note: error will not be thrown when provider does not exist or nothing is returned by languageserver, use `echo CocAction('hasProvider', 'signature')` to check if a signature help provider exists. Use |coc-config-signature| to change default signature help behavior. |CocFloatActive| is used to highlight activated parameter part. ------------------------------------------------------------------------------ INLAY HINT **coc-inlayHint** Inlay hint is enabled for all filetypes by default. Inlay hint uses virtual text feature of vim. Vim9 or neovim >= 0.10 required to insert the virtual text at correct position. Note: you may need configure extension or languageserver to make inlay hint works. To temporarily toggle inlay hint specific buffer, use command: > ``` :CocCommand document.enableInlayHint {bufnr} :CocCommand document.disableInlayHint {bufnr} :CocCommand document.toggleInlayHint {bufnr} ``` < current bufnr is used when `{bufnr}` not specified. # Change highlight group: ~ • |CocInlayHint| • |CocInlayHintType| • |CocInlayHintParameter| # Configure inlay hint support: ~ |coc-config-inlayHint| ------------------------------------------------------------------------------ FORMAT **coc-format** Some tools may reload buffer from disk file during format, coc.nvim only apply `TextEdit[]` to the document. Don't be confused with vim's indent feature, configure/fix the 'indentexpr' of your buffer if the indent is wrong after character insert. (use |coc-format-ontype| might helps with the indent) ``` *coc-format-options* # Format options: ~ ``` Buffer options that affect document format: 'eol', 'shiftwidth' and 'expandtab'. • |b:coc_trim_trailing_whitespace| Trim trailing whitespace on a line. • |b:coc_trim_final_newlines| Trim all newlines after the final newline at the end of the file. Those options are converted to `DocumentFormattingOptions` and transferred to languageservers before format. Note: the languageservers may only support some of those options. ``` *coc-format-document* # Format full document: ~ ``` Choose "editor.action.formatDocument" from |coc-list-commands|. Or use |CocAction('format')|, you can create a command like: > ``` command! -nargs=0 Format :call CocActionAsync('format') ``` < to format current buffer. ``` *coc-format-ontype* # Format on type: ~ ``` Format on type could be enabled by |coc-preferences-formatOnType|. Use `:CocCommand document.checkBuffer` to check if `formatOnType` provider exists for current buffer. To format on , create key-mapping of that uses |coc#on_enter()|. If you don't like the behavior on type bracket characters, configure |coc-preferences-bracketEnterImprove||. ``` *coc-format-selected* # Format selected code: ~ ``` Use 'formatexpr' for specific filetypes: > autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') So that |gq| could works for format range of lines. > Setup visual mode and operator key-mappings: > xmap f (coc-format-selected) nmap f (coc-format-selected) < ``` *coc-format-onsave* # Format on save: ~ ``` To enable format on save, use configuration |coc-preferences-formatOnSave|. Or create |BufWritePre| autocmd like: > ``` autocmd BufWritePre * call CocAction('format') ``` < Note the operation have to synchronized, avoid use |CocActionAsync()|. Note to skip the autocmd, use `:noa w` to save the buffer. The operation on save will block your vim, to not block too long time, the operation will be canceled after 0.5s, configured by |coc-preferences-willSaveHandlerTimeout| ------------------------------------------------------------------------------ CODE ACTION **coc-code-actions** Code actions are used for ask languageserver to provide specific kind code changes. Possible code action kinds: • `quickfix` used for fix diagnostic(s). • `refactor` used for code refactor. • `source` code actions apply to the entire file. • `organizeImport` organize import statements of current document. # Key-mappings for code actions: ~ • |(coc-fix-current)| Invoke quickfix action at current line if any. • |(coc-codeaction-cursor)| Choose code actions at cursor position. • |(coc-codeaction-line)| Choose code actions at current line. • |(coc-codeaction)| Choose code actions of current file. • |(coc-codeaction-source)| Choose source code action of current file. • |(coc-codeaction-selected)| Choose code actions from selected range. • |(coc-codeaction-refactor)| Choose refactor code action at cursor position. • |(coc-codeaction-refactor-selected)| Choose refactor code action with selected code. Except for |(coc-fix-current)| which invoke code action directly, |coc-dialog-menu| would be shown for pick specific code action. To invoke organize import action, use command like: > ``` command! -nargs=0 OR :call CocAction('organizeImport') ``` See |CocAction('organizeImport')| for details. # Related APIs ~ • |CocAction('codeActions')| • |CocAction('organizeImport')| • |CocAction('fixAll')| • |CocAction('quickfixes')| • |CocAction('doCodeAction')| • |CocAction('doQuickfix')| • |CocAction('codeActionRange')| ------------------------------------------------------------------------------ DOCUMENT HIGHLIGHTS **coc-document-highlights** Document highlights is used for highlight same symbols of current document under cursor. To enable highlight on CursorHold, create an autocmd like this: > ``` autocmd CursorHold * call CocActionAsync('highlight') ``` < See |coc-config-documentHighlight| for related configurations. See |coc-highlights-document| for related highlight groups. Note error will not be thrown when provider not exists or nothing returned from languageserver with |CocAction('highlight')| Install `coc-highlight` extension if you want to highlight same words under cursor without languageserver support. To jump between previous/next symbol position, use `:CocCommand document.jumpToPrevSymbol` and `:CocCommand document.jumpToNextSymbol` ------------------------------------------------------------------------------ DOCUMENT COLORS **coc-document-colors** Document colors added color highlights to vim buffers. To enable document color highlights, use |coc-config-colors-enable|. Note: the highlights define gui colors only, make use you have 'termguicolors' enabled (and your terminal support gui colors) if you're using vim in terminal. To pick a color from system color picker, use |CocAction('pickColor')| or choose `editor.action.pickColor` from |:CocCommand|. Note: pick color may not work on your system. To change color presentation, use |CocAction('colorPresentation')| or choose `editor.action.colorPresentation` from |:CocCommand|. To toggle color highlight of current buffer, choose `document.toggleColors` from |:CocCommand| To highlights colors without languageservers, install https://github.com/neoclide/coc-highlight ============================================================================== DOCUMENT LINKS **coc-document-links** Check if current buffer have documentLink provider by `:echo CocAction('hasProvider', 'documentLink')` Highlight and tooltip of the links could be configured by |coc-config-links|. Use |coc-list-links| to manage list of links in current document. # Document link key-mappings: ~ |(coc-openlink)| # Document link functions: ~ • |CocAction('openLink')| Open link under cursor. • |CocAction('links')| Get link list of current buffer. ------------------------------------------------------------------------------ SNIPPETS SUPPORT **coc-snippets** Snippets engine of coc.nvim support both VSCode snippets and ultisnips snippets format. The completion items with snippet format has label ends with # |coc-config-suggest-snippetIndicator| (`~` by default). Confirm the completion by |coc#pum#confirm()| or |coc#pum#select_confirm()| to expand the snippet and execute other possible actions of selected complete item. # Jump snippet placeholders: ~ |g:coc_snippet_next| and |g:coc_snippet_prev| are used to jump placeholders on both select mode and insert mode, which defaults to and . Buffer key-mappings are created on snippet activate, and removed on snippet deactivate. # Deactivate snippet session: ~ A snippet session would be deactivated under the following conditions: • The change affects the snippet and code outside. • Autocmd |InsertEnter| triggered outside snippet. • Jump to the final placeholder. Use |CocOpenLog| to checkout the cancel reason. Use |CocAction('snippetCancel')| for cancel snippet session manually. To load and expand custom snippets, install `coc-snippets` extension by command: > ``` :CocInstall coc-snippets ``` < # Nested snippets: ~ Snippets can be nested, when jump to tabstop of parent snippet, it's not possible to jump back again (works like UltiSnip). # Related configurations: ~ • |g:coc_snippet_prev| • |g:coc_snippet_next| • |g:coc_selectmode_mapping| • |coc-config-suggest-snippetIndicator| • |coc-config-suggest-preferCompleteThanJumpPlaceholder| • |coc-config-snippet-highlight| • |coc-config-snippet-statusText| • |coc-config-snippet-nextPlaceholderOnDelete| # Related functions: ~ • |coc#snippet#next()| • |coc#snippet#prev()| • |coc#expandable()| • |coc#jumpable()| • |coc#expandableOrJumpable()| # Related variables, highlights and autocmds: ~ • |g:coc_selected_text| Used for replace `${VISUAL}` and `${TM_SELECTED_TEXT}` placeholder of next expanded snippet. • |b:coc_snippet_active| Check if snippet session is activated. • |CocJumpPlaceholder| Autocmds triggered after placeholder jump. • |CocSnippetVisual| For highlight of current placeholders when the highlight is enabled. ------------------------------------------------------------------------------ WORKSPACE SUPPORT **coc-workspace** ``` *coc-workspace-folders* # Workspace folders ~ ``` Unlike VSCode which prompt you to open folders, workspace folders of coc.nvim are resolved from filepath after document attached. A list of file/folder names is used for resolve workspace folder, the patterns could comes from: • |b:coc_root_patterns| • "rootPatterns" field of languageserver in |coc-config-languageserver|. • "rootPatterns" contributions from coc.nvim extensions. • |coc-config-workspace-rootPatterns| Workspace folder is resolved from cwd of vim first (by default) and then from top directory to the parent directory of current filepath, when workspace folder not resolved, current working directory is used if it's parent folder of current buffer. Configurations are provided to change the default behavior: • |coc-config-workspace-ignoredFiletypes| • |coc-config-workspace-ignoredFolders| • |coc-config-workspace-bottomUpFiletypes| • |coc-config-workspace-workspaceFolderCheckCwd| • |coc-config-workspace-workspaceFolderFallbackCwd| Note for performance reason, user's home directory would never considered as workspace folder, which also means the languageserver that requires workspace folder may not work when you start vim from home directory. To preserve workspace folders across vim session, |g:WorkspaceFolders| is provided. Use `:CocCommand workspace.workspaceFolders` to echo current workspaceFolders. To manage current workspace folders, use |coc-list-folders| To get related root patterns of current buffer, use |coc#util#root_patterns()| ``` *coc-workspace-edits* # Workspace edit ~ ``` Workspace edit is used to apply changes for multiple buffers(and/or files), the edit could contains document edits and file operations (including file create, file/directory delete and file/directory rename). When the edit failed to apply, coc.nvim will revert the changes (including document edits and file operations) that previous made. Files not loaded would be loaded by `tab drop` command, configured by |coc-config-workspace-openResourceCommand|. To undo and redo workspace edit just applied, use command `:CocCommand workspace.undo` and `:CocCommand workspace.redo` To inspect previous workspace edit, use command `:CocCommand workspace.inspectEdit`, in opened buffer, use for jump to change position under cursor. ``` *coc-workspace-rename* # Rename current file ~ ``` To move or rename current file, it's recommended to use `:CocCommand workspace.renameCurrentFile` which makes vim reload current buffer and send expected events to language servers. ``` *coc-workspace-output* # Output channels ~ ``` Output channels shows logs for user to inspect. Use command `workspace.showOutput` to open output channel. Builtin channels: - `watchman` shows watchman related logs. - `extensions` shows extension install and update related logs. |coc-languageserver| and |coc-extensions| could contribute output channels. ------------------------------------------------------------------------------ CURSORS SUPPORT **coc-cursors** Multiple cursors supported is added to allow edit multiple locations at once. Cursors session could be started by following ways: • Use command `:CocCommand document.renameCurrentWord` to rename variable under cursor. • Use |(coc-refactor)| to open |coc-refactor-buffer|. • Use |:CocSearch| to open searched locations with |coc-refactor-buffer|. • Use cursors related key-mappings to add text range, including |(coc-cursors-operator)|, |(coc-cursors-word)|, |(coc-cursors-position)| and |(coc-cursors-range)| • Ranges added by command `editor.action.addRanges` from coc extensions. Default key-mappings when cursors activated: • cancel cursors session. • jump to next cursors range. • jump to previous cursors range. Use |coc-config-cursors| to change cursors related key-mappings. Use highlight group |CocCursorRange| to change default range highlight. Use |b:coc_cursors_activated| to check if cursors session is activated. ``` *coc-refactor-buffer* ``` Refactor buffer is a specific buffer with |coc-cursors| enabled, normally opened by |CocAction('refactor')| and |:CocSearch|. When the refactor buffer saved, related buffers and files would be changed at once, workspace edits would be applied, which could be undo and redo, see |coc-workspace-edits|. Check out |coc-config-refactor| for related configuration. Use to open buffer at current position in split window. Use to invoke tab open or remove action with current code chunk. -------------------------------------------------------------------------------- SYMBOLS OUTLINE **coc-outline** Outline is a split window with current document symbols rendered as |coc-tree|. To show and hide outline of current window, use |CocAction('showOutline')| and |CocAction('hideOutline')|. Outline view has |w:cocViewId| set to "OUTLINE". Following outline features are supported: • Start fuzzy filter by |coc-config-tree-key-activeFilter|. • Automatic update after document change. • Automatic reload when buffer in current window changed. • Automatic follow cursor position by default. • Different filter modes that can be changed on the fly |coc-config-outline-switchSortKey|. • Enable auto preview by |coc-config-outline-togglePreviewKey|. Outline would try to reload document symbols after 500ms when provider not registered, which avoid the necessary to check provider existence. Checkout |coc-config-tree| and |coc-config-outline| for available configurations. Checkout |CocTree| and |CocSymbol| for customize highlights. Use configuration `"suggest.completionItemKindLabels"` for custom icons. ``` *coc-outline-example* ``` To show outline for each tab automatically, use |autocmd|: > autocmd VimEnter,Tabnew ** ``` \ if empty(&buftype) | call CocActionAsync('showOutline', 1) | endif ``` < To close outline when it's the last window automatically, use |autocmd| like: > autocmd BufEnter ** call CheckOutline() function! CheckOutline() abort if &filetype ==# 'coctree' && winnr('$') == 1 if tabpagenr('$') != 1 close else bdelete endif endif endfunction < Create a key-mapping to toggle outline, like: > nnoremap o :call ToggleOutline() function! ToggleOutline() abort let winid = coc#window#find('cocViewId', 'OUTLINE') if winid == -1 call CocActionAsync('showOutline', 1) else call coc#window#close(winid) endif endfunction < -------------------------------------------------------------------------------- CALL HIERARCHY **coc-callHierarchy** A call hierarchy is a split |coc-tree| window with locations for incoming or outgoing calls of function under cursor position. Call hierarchy window is opened by |CocAction('showIncomingCalls')| and |CocAction('showOutgoingCalls')|. The tree view window has |w:cocViewId| set to "CALLS". Call hierarchy is configured by |CocSymbol|, |coc-config-callHierarchy| and |coc-config-tree|. Related ranges are highlighted with |CocSelectedRange| highlight group in opened buffer. |coc-dialog-menu| could be invoked by |coc-config-tree-key-actions| (default to ). Available actions: • Dismiss. • Open in new tab. • Show Incoming Calls. • Show Outgoing Calls. Use in call hierarchy tree to open location in original window. -------------------------------------------------------------------------------- TYPE HIERARCHY **coc-typeHierarchy** A type hierarchy is a split |coc-tree| window with locations for super types or sub types from types at current position. Type hierarchy window is opened by |CocAction('showSuperTypes')| and |CocAction('showSubTypes')|. The tree view window has |w:cocViewId| set to "TYPES". Type hierarchy is configured by |CocSymbol|, |coc-config-typeHierarchy| and |coc-config-tree|. Actions are the same as |coc-callHierarchy|. -------------------------------------------------------------------------------- SEMANTIC HIGHLIGHTS **coc-semantic-highlights** Semantic tokens are used to add additional color information to a buffer that depends on language specific symbol information. Use |coc-config-semanticTokens-enable| to enable semantic tokens highlights. Use `:CocCommand semanticTokens.checkCurrent` to check semantic highlight information with current buffer. To create custom highlights for symbol under cursor, follow these steps: • Inspect semantic token by > :CocCommand semanticTokens.inspect < to check token type and token modifiers with current symbol. • Create new highlight group by |highlight|, for example: > :hi link CocSemDeclarationVariable MoreMsg < • Refresh semantic highlight of current buffer by: > :CocCommand semanticTokens.refreshCurrent < • Clear semantic highlight by: > " Clear semantic tokens highlight of current buffer :CocCommand semanticTokens.clearCurrent " Clear semantic tokens highlight for all buffers :CocCommand semanticTokens.clearAll < See |CocSem| to customize semantic token highlight groups. See |coc-config-semanticTokens| for related configurations. -------------------------------------------------------------------------------- FOLD **coc-fold** Check if current buffer have fold provider by `:echo CocAction('hasProvider', 'foldingRange')` Use |CocAction('fold')| to create folds by request the languageserver and create manual folds on current window. -------------------------------------------------------------------------------- SELECTION RANGE **coc-selection-range** Select range forward or backward at cursor position. Check if current buffer have selection range provider by `:echo CocAction('hasProvider', 'selectionRange')` # Selection range key-mappings: ~ • |(coc-range-select)| Select range forward. • |(coc-range-select-backward)| Select range backward. # Selection range function: ~ • |CocAction('rangeSelect')| Visual select previous or next selection range -------------------------------------------------------------------------------- CODE LENS **coc-code-lens** Code lens feature shows additional information above or after specific lines. CodeLens are not shown by default, use |coc-config-codeLens-enable| to enable, you may also need enable codeLens feature by configure extension or languageserver. Check if current buffer have code lens provider by `:echo CocAction('hasProvider', 'codeLens')` To temporarily toggle codeLens of current buffer, use command `:CocCommand document.toggleCodeLens` To invoke command from codeLens, use |(coc-codelens-action)|. Use |CocCodeLens| for highlight of codeLens virtual text. Code lens are automatically requested on buffer create/change, checkout |coc-config-codeLens| for available configurations. -------------------------------------------------------------------------------- LINKED EDITING **coc-linked-editing** Linked editing feature enables editing multiple linked ranges at the same time, for example: html tags. The linked editing ranges would be highlighted with |CocLinkedEditing| when activated. Check if current buffer have linked editing provider by `:echo CocAction('hasProvider', 'linkedEditing')` Linked editing feature is disabled by default, use |coc-preferences-enableLinkedEditing| to enable. ============================================================================== INTERFACE **coc-interface** -------------------------------------------------------------------------------- Key mappings **coc-key-mappings** There're some cases that local key-mappings are enabled for current buffer. • Snippet jump key-mappings when snippet is activated: |g:coc_snippet_prev| and |g:coc_snippet_next|. • Cursor jump and cancel key-mappings when cursors is activated |coc-config-cursors|. • Dialog key-mappings for confirm and cancel dialog window |coc-config-dialog|. • Key-mappings for |CocList| buffer: |coc-list-mappings|. Note: Use |:verbose| command to check key-mappings that taking effect. Note: Use |noremap| with will make the key-mapping not work at all. Note: key-mappings are provided for convenient, use |CocActionAsync()| or |CocAction()| for more options. # Normal mode key-mappings: ~ **(coc-diagnostic-info)** Show diagnostic message of current position by invoke |CocAction('diagnosticInfo')| **(coc-diagnostic-next)** Jump to next diagnostic position after current cursor position. **(coc-diagnostic-prev)** Jump to previous diagnostic position before current cursor position. **(coc-diagnostic-next-error)** Jump to next diagnostic error position. **(coc-diagnostic-prev-error)** Jump to previous diagnostic error position. **(coc-definition)** Jump to definition(s) of current symbol by invoke |CocAction('jumpDefinition')| **(coc-declaration)** Jump to declaration(s) of current symbol by invoke |CocAction('jumpDeclaration')| **(coc-implementation)** Jump to implementation(s) of current symbol by invoke |CocAction('jumpImplementation')| **(coc-type-definition)** Jump to type definition(s) of current symbol by invoke |CocAction('jumpTypeDefinition')| **(coc-references)** Jump to references of current symbol by invoke |CocAction('jumpReferences')| **(coc-references-used)** Jump to references of current symbol exclude declarations. **(coc-format-selected)** ``` Format selected range, works on both |visual-mode| and |normal-mode|, when used in normal mode, the selection works on the motion object. ``` ``` For example: > ``` ``` vmap p (coc-format-selected) nmap p (coc-format-selected) ``` < ``` makes `p` format the visually selected range, and you can use `pap` to format a paragraph. ``` **(coc-format)** Format the whole buffer by invoke |CocAction('format')| **(coc-rename)** Rename symbol under cursor to a new word by invoke |CocAction('rename')| **(coc-refactor)** Open refactor window for refactor of current symbol by invoke |CocAction('refactor')| **(coc-command-repeat)** Repeat latest |CocCommand|. **(coc-codeaction)** Get and run code action(s) for current file, use |coc-codeaction-cursor| for same behavior as VSCode. **(coc-codeaction-source)** Get and run source code action(s) for current file. The same as 'Source action...' in context menu of VSCode. **(coc-codeaction-line)** Get and run code action(s) for current line. **(coc-codeaction-cursor)** Get and run code action(s) using empty range at current cursor. **(coc-codeaction-selected)** Get and run code action(s) with the selected code. Works on both |visual-mode| and |normal-mode|. **(coc-codeaction-refactor)** Get and run refactor code action(s) at current cursor, the same as refactor context menu in VSCode, disabled actions are not excluded. **(coc-codeaction-refactor-selected)** Get and run refactor code action(s) with selected code. Works on both |visual-mode| and |normal-mode|. **(coc-openlink)** Open link under cursor by use |CocAction('openlink')|. **(coc-codelens-action)** invoke command contributed by codeLens at the current line. **(coc-fix-current)** Try first quickfix action for diagnostics of current line. **(coc-float-hide)** Hide all float windows/popups created by coc.nvim. **(coc-float-jump)** Jump to first float window (neovim only), use |CTRL-W_p| for jump to previous window. **(coc-range-select)** ``` Select next selection range. Works on both |visual-mode| and |normal-mode|. ``` ``` Note: requires selection ranges feature of language server. ``` **(coc-funcobj-i)** ``` Select inside function. Recommend mapping: Works on both |visual-mode| and |normal-mode|. ``` > ``` xmap if (coc-funcobj-i) omap if (coc-funcobj-i) ``` < ``` Note: Requires 'textDocument.documentSymbol' support from the language server. ``` **(coc-funcobj-a)** ``` Select around function. Works on both |visual-mode| and |normal-mode|. Recommended mapping: ``` > ``` xmap af (coc-funcobj-a) omap af (coc-funcobj-a) ``` < ``` Note: Requires 'textDocument.documentSymbol' support from the language server. ``` **(coc-classobj-i)** ``` Select inside class/struct/interface. Works on both |visual-mode| and |normal-mode|. Recommended mapping: ``` > ``` xmap ic (coc-classobj-i) omap ic (coc-classobj-i) ``` < ``` Note: Requires 'textDocument.documentSymbol' support from the language server. ``` **(coc-classobj-a)** ``` Select around class/struct/interface. Works on both |visual-mode| and |normal-mode|. Recommended mapping: ``` > ``` xmap ac (coc-classobj-a) omap ac (coc-classobj-a) ``` < ``` Note: Requires 'textDocument.documentSymbol' support from the language server. ``` **(coc-cursors-operator)** Add text to cursors session by motion object. **(coc-cursors-word)** Add current word to cursors session. **(coc-cursors-position)** Add current position as empty range to cursors session. # Visual mode key-mappings: ~ **(coc-range-select-backward)** ``` Select previous selection range. ``` ``` Note: requires selection ranges feature of language server, like: coc-tsserver, coc-python ``` **(coc-cursors-range)** Add selection to cursors session. ============================================================================== VARIABLES **coc-variables** The Variables used by coc.nvim. -------------------------------------------------------------------------------- ENVIRONMENT VARIABLES **coc-environment-variables** $COC_NODE_PATH **$COC_NODE_PATH** ``` Full path of NodeJS executable to start the node process, `node` command is used when the variable not exists. ``` $VIMCONFIG ``` Full path of directory which used for contain the user configuration file, not used when |g:coc_config_home| exists. ``` $NODE_CLIENT_LOG_FILE ``` Full path of client log file, used when |g:node_client_debug| enabled. ``` $COC_VIM_CHANNEL_ENABLE **$COC_VIM_CHANNEL_ENABLE** ``` Enable vim's channel log |ch_logfile()| when is "1". ``` -------------------------------------------------------------------------------- BUFFER VARIABLES **coc-buffer-variables** b:coc_enabled **b:coc_enabled** ``` Set to `0` on buffer create if you don't want coc.nvim receive content from buffer. Normally used with |BufRead| autocmd, example: ``` > ``` " Disable file with size > 1MB autocmd BufRead * if getfsize(expand('')) > 1024*1024 | \ let b:coc_enabled=0 | \ endif ``` b:coc_disable_autoformat **b:coc_disable_autoformat** ``` Set to `1` on buffer create if you don't want coc.nvim not format the buffer automatically (when typing or saving the buffer). Normally used with |BufRead| autocmd, example: ``` > ``` " Disable automatic format with file size > 1MB autocmd BufRead * if getfsize(expand('')) > 1024*1024 | \ let b:coc_disable_autoformat = 1 | \ endif ``` < b:coc_force_attach **b:coc_force_attach** ``` When is `1`, attach the buffer without check the 'buftype' option. Should be set on buffer create. ``` b:coc_root_patterns **b:coc_root_patterns** ``` Root patterns used for resolving workspaceFolder for the current file, will be used instead of `"workspace.rootPatterns"` setting. Example: > ``` ``` autocmd FileType python let b:coc_root_patterns = \ ['.git', '.env'] ``` < b:coc_suggest_disable **b:coc_suggest_disable** ``` Disable trigger completion of buffer. Example: > ``` ``` " Disable completion for python autocmd FileType python let b:coc_suggest_disable = 1 ``` b:coc_inline_disable **b:coc_inline_disable** ``` Disable trigger inline completion of buffer. Example: > ``` ``` " Disable inline completion for python autocmd FileType python let b:coc_inline_disable = 1 ``` b:coc_disabled_sources **b:coc_disabled_sources** ``` Disabled completion sources of current buffer. Example: ``` > ``` let b:coc_disabled_sources = ['around', 'buffer', 'file'] ``` < b:coc_suggest_blacklist **b:coc_suggest_blacklist** ``` List of input words for which completion should not be triggered. Example: > ``` ``` " Disable completion for 'end' in Lua files autocmd FileType lua let b:coc_suggest_blacklist = ["end"] ``` b:coc_additional_keywords **b:coc_additional_keywords** ``` Addition keyword characters for generate keywords. Example: > ``` ``` " Add keyword characters for CSS autocmd FileType css let b:coc_additional_keywords = ["-"] ``` b:coc_trim_trailing_whitespace **b:coc_trim_trailing_whitespace** ``` Trim trailing whitespace on a line, default `0`. Use by "FormattingOptions" send to the server. ``` b:coc_trim_final_newlines **b:coc_trim_final_newlines** ``` Trim all newlines after the final newline at the end of the file. Use by "FormattingOptions" send to the server. ``` ``` Other buffer options that affect document format: 'eol', 'shiftwidth' and 'expandtab'. ``` ``` Note: language server may not respect format options. ``` -------------------------------------------------------------------------------- WINDOW VARIABLES **coc-window-variables** w:cocViewId **w:cocViewId** ``` Exists with tree view window to identify the kind of tree view. ``` ``` Builtin in kinds: - 'OUTLINE' for outline tree view. - 'CALLS' for incoming calls and outgoing calls tree view. - 'TYPES' for type hierarchy tree view. Extensions could contribute other kinds of tree view. ``` -------------------------------------------------------------------------------- GLOBAL VARIABLES **coc-global-variables** g:coc_disable_startup_warning **g:coc_disable_startup_warning** ``` Disable possible warning on startup for old vim/node version. ``` ``` Default: 0 ``` g:coc_disable_mappings_check **g:coc_disable_mappings_check** ``` Disable completion key-mappings check for ``, ``, ``, ``. ``` ``` Default: 0 ``` g:coc_disable_uncaught_error **g:coc_disable_uncaught_error** ``` Disable uncaught error messages from node process of coc.nvim. ``` ``` Default: 0 ``` g:coc_text_prop_offset **g:coc_text_prop_offset** ``` Start |textprop| id offset of highlight namespaces on vim, change to other value to avoid conflict with other vim plugin. ``` ``` Default: 1000 ``` g:coc_disable_transparent_cursor **g:coc_disable_transparent_cursor** ``` Disable transparent cursor when CocList is activated. Set it to `1` if you have issue with transparent cursor. ``` ``` Default: 0 ``` g:coc_start_at_startup **g:coc_start_at_startup** ``` Start coc service on startup, use |CocStart| to start server when you set it to 0. ``` ``` Default: 1 ``` g:coc_list_preview_filetype **g:coc_list_preview_filetype** ``` Enable set filetype for buffer in the preview window of |CocList|. ``` g:coc_global_extensions **g:coc_global_extensions** ``` Global extension names to install when they aren't installed. ``` > ``` let g:coc_global_extensions = ['coc-json', 'coc-git'] ``` < ``` Note: coc.nvim will try to install extensions that are not installed in this list after initialization. ``` g:coc_enable_locationlist **g:coc_enable_locationlist** ``` Use location list of |coc-list| when jump to locations. ``` ``` Set it to 0 when you need customize behavior of location jump by use |CocLocationsChange| and |g:coc_jump_locations| ``` ``` If you want use vim's quickfix list instead, add `"coc.preferences.useQuickfixForLocations": true` in your configuration file, this configuration would be ignored and no |CocLocationsChange| triggered. ``` ``` Default: 1 ``` g:coc_snippet_next **g:coc_snippet_next** ``` Trigger key for going to the next snippet position, applied in insert and select mode. ``` ``` Only works when snippet session is activated. ``` ``` Default: ``` g:coc_snippet_prev **g:coc_snippet_prev** ``` Trigger key for going to the previous snippet position, applied in insert and select mode. ``` ``` Only works when snippet session is activated. ``` ``` Default: ``` g:coc_selected_text **g:coc_selected_text** ``` The text used for replace `${VISUAL}` and `${TM_SELECTED_TEXT}` placeholder of next expanded snippet. Normally created by press `(coc-snippets-select)` provided by coc-snippets extensions. The variable is removed after snippet expand. ``` ``` Not exists by default. ``` g:coc_filetype_map **g:coc_filetype_map** ``` Map for document filetypes so the server could handle current document as another filetype, example: > ``` ``` let g:coc_filetype_map = { \ 'html.swig': 'html', \ 'wxss': 'css', \ } ``` < ``` Default: {} ``` ``` See |coc-document-filetype| for details. ``` g:coc_selectmode_mapping **g:coc_selectmode_mapping** ``` Add key mappings for making snippet select mode easier. The same as |Ultisnip| does. > ``` ``` snoremap c snoremap c snoremap c snoremap "_c ``` < ``` Default: 1 ``` g:coc_node_path **g:coc_node_path** ``` Path to node executable to start coc service, example: > ``` ``` let g:coc_node_path = '/usr/local/opt/node@12/bin/node' ``` < ``` Use this when coc has problems with your system node, ``` # Note: you can use `~` as home directory. g:coc_node_args **g:coc_node_args** ``` Arguments passed to node when starting coc.nvim service. ``` ``` Useful for start coc.nvim in debug mode, example: > ``` > ``` let g:coc_node_args = ['--nolazy', '--inspect-brk=6045'] ``` < ``` Default: [] ``` g:coc_status_error_sign **g:coc_status_error_sign** ``` Error character used by |coc#status()|, default: `E` ``` g:coc_status_warning_sign **g:coc_status_warning_sign** ``` Warning character used by |coc#status()|, default: `W` ``` g:coc_quickfix_open_command **g:coc_quickfix_open_command** ``` Command used for open quickfix list. To jump fist position after quickfix list opened, you can use: ``` > ``` let g:coc_quickfix_open_command = 'copen|cfirst' ``` < ``` Default: |copen| ``` g:coc_open_url_command **g:coc_open_url_command** ``` Command used for open remote url, when not exists, coc.nvim will try to use "open", "xdg-open" on Mac and Linux, "cmd /c start" on windows. ``` g:node_client_debug **g:node_client_debug** ``` Enable debug mode of node client for check rpc messages between vim and coc.nvim. Use environment variable `$NODE_CLIENT_LOG_FILE` to set the log file or get the log file after coc.nvim started. On vim9, this variable also enables vim's channel log, the log filepath would be disposed on the screen after vim start. ``` ``` To open the log file, use command: > ``` ``` :call coc#client#open_log() ``` < ``` Default: `0` ``` g:coc_user_config **g:coc_user_config** ``` User configuration which will be passed to coc.nvim process during initialization, no effect when changed after coc.nvim started. Prefer |coc#config| unless coc.nvim is lazy loaded. Example: > ``` ``` let g:coc_user_config = {} let g:coc_user_config['suggest.timeout'] = 500 let g:coc_user_config['suggest.noselect'] = v:true ``` < ``` Note: those configuration would overwrite the configuration from the user's settings file, unless you have to use some dynamic variables, using the settings file is recommended. ``` g:coc_config_home **g:coc_config_home** ``` Configure the directory which will be used to look for user's `coc-settings.json`, default: ``` # Windows: `~/AppData/Local/nvim` # Other: `~/.config/nvim` g:coc_data_home **g:coc_data_home** ``` Configure the directory which will be used to for data files(extensions, MRU and so on), default: ``` # Windows: `~/AppData/Local/coc` # Other: `~/.config/coc` g:coc_terminal_height **g:coc_terminal_height** ``` Height of terminal window, default `8`. ``` g:coc_markdown_disabled_languages **g:coc_markdown_disabled_languages** ``` Filetype list that should be disabled for highlight in markdown block, useful to disable filetypes that could be slow with syntax highlighting, example: > ``` ``` let g:coc_markdown_disabled_languages = ['html'] ``` g:coc_highlight_maximum_count **g:coc_highlight_maximum_count** ``` When highlight items exceed maximum count, highlight items will be grouped and added by using |timer_start| for better user experience. ``` ``` Default `500` ``` g:coc_default_semantic_highlight_groups **g:coc_default_semantic_highlight_groups** ``` Create default semantic highlight groups for |coc-semantic-highlights| ``` ``` Default: `1` ``` g:coc_max_treeview_width **g:coc_max_treeview_width** ``` Maximum width of tree view when adjusted by auto width. ``` ``` Default: `40` ``` g:coc_borderchars **g:coc_borderchars** ``` Border characters used by border window, default to: ``` > ``` ['─', '│', '─', '│', '┌', '┐', '┘', '└'] ``` < ``` Note: you may need special font like Nerd font to show them. ``` g:coc_border_joinchars **g:coc_border_joinchars** ``` Border join characters used by float window/popup, default to: ``` > ``` ['┬', '┤', '┴', '├'] ``` < ``` Note: you may need special font like Nerd font to show them. ``` g:coc_prompt_win_width **g:coc_prompt_win_width** ``` Width of input prompt window, default `32`. ``` ``` *g:coc_notify* ``` g:coc_notify_error_icon **g:coc_notify_error_icon** ``` Error icon for notification, default to:  ``` g:coc_notify_warning_icon **g:coc_notify_warning_icon** ``` Warning icon for notification, default to: ⚠ ``` g:coc_notify_info_icon **g:coc_notify_info_icon** ``` Info icon for notification, default to:  ``` -------------------------------------------------------------------------------- Some variables are provided by coc.nvim. g:WorkspaceFolders **g:WorkspaceFolders** ``` Current workspace folders, used for restoring from a session file, add `set sessionoptions+=globals` to vimrc for restoring globals on session load. ``` g:coc_jump_locations **g:coc_jump_locations** ``` This variable would be set to jump locations when the |CocLocationsChange| autocmd is fired. ``` ``` Each location item contains: ``` ``` 'filename': full file path. 'lnum': line number (1 based). 'col': column number(1 based). 'text': line content of location. ``` g:coc_process_pid **g:coc_process_pid** ``` Process pid of coc.nvim service. If your vim doesn't kill coc.nvim process on exit, use: ``` > ``` autocmd VimLeavePre * if get(g:, 'coc_process_pid', 0) \ | call system('kill -9 '.g:coc_process_pid) | endif ``` < ``` in your vimrc. ``` g:coc_service_initialized **g:coc_service_initialized** ``` Is `1` when coc.nvim initialized, used with autocmd |CocNvimInit|. ``` g:coc_status **g:coc_status** ``` Status string contributed by coc.nvim and extensions, used for status line. ``` ``` You may need to escape `%` for your status line plugin. VimL: `substitute(g:coc_status, '%', '%%', 'g')` Lua: `string.gsub(vim.g.coc_status, "%%", "%%%%")` ``` g:coc_last_float_win **g:coc_last_float_win** ``` Window id of latest created float/popup window. ``` g:coc_last_hover_message **g:coc_last_hover_message** ``` Last message echoed from `doHover`, can be used in statusline. ``` ``` Note: not used when floating or preview window used for `doHover`. ``` b:coc_snippet_active **b:coc_snippet_active** ``` Is `1` when snippet session is activated, use |coc#jumpable| to check if it's possible to jump placeholder. ``` b:coc_diagnostic_disable **b:coc_diagnostic_disable** ``` Disable diagnostic support of current buffer. ``` b:coc_diagnostic_info **b:coc_diagnostic_info** ``` Diagnostic information of current buffer, the format would look like: ``` ``` `{'error': 0, 'warning': 0, 'information': 0, 'hint':0}` ``` ``` can be used to customize statusline. See |coc-status|. ``` b:coc_diagnostic_map **b:coc_diagnostic_map** ``` Diagnostics of current buffer, the format is same as *diagnostic-structure* ``` b:coc_current_function **b:coc_current_function** ``` Function string that current cursor in. ``` ``` Enable |coc-preferences-currentFunctionSymbolAutoUpdate| to update the value on CursorMove and use |coc-preferences-currentFunctionSymbolDebounceTime| to set the time to debounce the event. ``` b:coc_cursors_activated **b:coc_cursors_activated** ``` Use expression `get(b:, 'coc_cursors_activated',0)` to check if cursors session is activated for current buffer. ``` -------------------------------------------------------------------------------- FUNCTIONS **coc-functions** Some functions only work after the coc.nvim has been initialized. To run a function on startup, use an autocmd like: > ``` autocmd User CocNvimInit call CocAction('runCommand', \ 'tsserver.watchBuild') ``` < coc#start([{option}]) **coc#start()** ``` Start completion with optional {option}. Option could contains: ``` ``` - `source` specific completion source name. - `col` the start column of completion (1 based). ``` ``` Example: > ``` ``` inoremap =coc#start({'source': 'word'}) ``` < ``` Use `:CocList sources` to get available sources. ``` coc#refresh() **coc#refresh()** ``` Start or refresh completion at current cursor position, bind this to 'imap' to trigger completion, example: > ``` ``` if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif ``` coc#config({section}, {value}) **coc#config()** ``` Change user configuration, overwrite configurations from user config file and default values. Example: > ``` ``` call coc#config('coc.preferences', { \ 'willSaveHandlerTimeout': 1000, \}) call coc#config('languageserver', { \ 'ccls': { \ "command": "ccls", \ "trace.server": "verbose", \ "filetypes": ["c", "cpp", "objc", "objcpp"] \ } \}) ``` < ``` Note: this function can be called multiple times. Note: this function can be called before coc.nvim started. Note: this function can work alongside the user configuration file, but it's not recommended to use both. Note: use |g:coc_user_config| when you have coc.nvim lazy loaded. ``` coc#add_command({id}, {command}, [{title}]) **coc#add_command()** ``` Add custom Vim command to commands list opened by `:CocList commands` . ``` ``` Example: > ``` ``` call coc#add_command('mundoToggle', 'MundoToggle', \ 'toggle mundo window') ``` < coc#expandable() **coc#expandable()** ``` Check if a snippet is expandable at the current position. Requires `coc-snippets` extension installed. ``` coc#jumpable() **coc#jumpable()** ``` Check if a snippet is jumpable at the current position. ``` coc#expandableOrJumpable() **coc#expandableOrJumpable()** ``` Check if a snippet is expandable or jumpable at the current position. Requires `coc-snippets` extension installed. ``` coc#on_enter() **coc#on_enter()** ``` Notify coc.nvim that has been pressed. ``` ``` Used for the format on type and improvement of brackets insert, example: > ``` ``` " Confirm the completion when popupmenu is visible, insert and " notify coc.nvim otherwise. inoremap coc#pum#visible() ? coc#pum#confirm() ``` \: "\u\\=coc#on_enter()\" < ``` To enable format on type, use |coc-preferences-formatOnType| configuration. ``` coc#status([{escape}]) **coc#status()** ``` Return a status string that can be used in the status line, the status includes diagnostic information from |b:coc_diagnostic_info| and extension contributed statuses from |g:coc_status|. For statusline integration, see |coc-status|. ``` ``` Escape '%' to '%%' when {escape} is truth value. ``` coc#util#api_version() **coc#util#api_version()** ``` Get coc.nvim's vim API version number, start from `1`. ``` coc#util#job_command() **coc#util#job_command()** ``` Get the job command used for starting the coc service. ``` coc#util#get_config_home() **coc#util#get_config_home()** ``` Get the config directory that contains the user's coc-settings.json. ``` coc#util#get_data_home() **coc#util#get_data_home()** ``` Get data home directory, return |g:coc_data_home| when defined, else use $XDG_CONFIG_HOME/coc when $XDG_CONFIG_HOME exists, else fallback # to `~/AppData/Local/coc` on windows and `~/.config/coc` on other systems. ``` coc#util#extension_root() **coc#util#extension_root()** ``` Return extensions root of coc.nvim. ``` coc#util#root_patterns() **coc#util#root_patterns()** ``` Get root patterns used for current document. ``` ``` Result could be something like: > ``` ``` {'global': ['.git', '.hg', '.projections.json'], 'buffer': [], 'server': v:null} ``` < coc#util#get_config({key}) **coc#util#get_config()** ``` Get configuration of current document (mostly defined in coc-settings.json) by {key}, example: > ``` ``` :echo coc#util#get_config('coc.preferences') ``` coc#snippet#next() **coc#snippet#next()** ``` Jump to next placeholder, does nothing when |coc#jumpable| is 0. ``` coc#snippet#prev() **coc#snippet#prev()** ``` Jump to previous placeholder, does nothing when |coc#jumpable| is 0. ``` ``` *coc#pum* ``` coc#pum#visible() **coc#pum#visible()** ``` Check if customized popupmenu is visible like |pumvisible()| does. Return 1 when popup menu is visible. ``` coc#pum#has_item_selected() **coc#pum#has_item_selected** ``` Check if there is a completion item selected in the popup menu. Return number `1` when completion item is selected. ``` coc#pum#next({insert}) **coc#pum#next()** ``` Select next item of customized popupmenu, insert word when {insert} is 1. ``` ``` Note: this function should only be used in key-mappings. ``` coc#pum#prev({insert}) **coc#pum#prev()** ``` Select previous item of customized popupmenu, insert word when {insert} is truth value. ``` ``` Note: this function should only be used in key-mappings. ``` coc#pum#stop() **coc#pum#stop()** ``` Close the customized popupmenu and stop the completion, works like of vim. ``` ``` Note: this function should only be used in key-mappings. ``` coc#pum#cancel() **coc#pum#cancel()** ``` Close the customized popupmenu and reset the trigger input before cursor when the trigger changed by pum navigation, like of vim. ``` ``` Note: this function should only be used in key-mappings. ``` coc#pum#insert() **coc#pum#insert()** ``` Insert word of current selected item and finish completion. Unlike |coc#pum#confirm()|, no text edit would be applied and snippet would not be expanded. ``` ``` Note: this function should only be used in key-mappings. ``` coc#pum#confirm() **coc#pum#confirm()** ``` Confirm completion of the selected item (when possible) by insert the `word` of completion item when not inserted, and close the customized popup menu, like of vim. Trigger the optional `onCompleteDone` handler of completion source after buffer text changed. ``` ``` Note: this function should only be used in key-mappings. ``` coc#pum#select_confirm() **coc#pum#select_confirm()** ``` Select the first completion item if no complete item is selected, then confirm the completion like |coc#pum#confirm()|. ``` ``` Note: this function should only be used in key-mappings. ``` coc#pum#info() **coc#pum#info()** ``` Return information of the customized popupmenu, should only be used when |coc#pum#visible()| is 1. ``` ``` Result contains: index Current select item index, 0 based. scrollbar Non-zero if a scrollbar is displayed. row Screen row count, 0 based. col Screen column count, 0 based. width Width of pum, including padding and border. height Height of pum, including padding and border. size Count of displayed complete items. inserted Is |v:true| when there is item inserted. reversed Is |v:true| when pum shown above cursor and enable |suggest.reversePumAboveCursor| ``` coc#pum#select({index}, {insert}, {confirm}) **coc#pum#select()** ``` Selects a complete item in the completion popupmenu, with optional {insert} and {confirm} action. Return empty string. ``` ``` Note: when {insert} enabled or cancelled by `index = -1`, the current buffer state could be not synchronized (to have better performance with dot repeat support |feedkeys()| with `\` is used to insert word when necessary). Use |timer_start()| afterwards to wait for the buffer text synchronize and `stopCompletion` request finish when needed. ``` # Parameters: ~ ``` {index} Index (zero-based) of the item to select. When is `-1` the completion is canceled. Throw error when index out of range. {insert} Whether the word of selected completion item should be inserted to the buffer. {confirm} Confirm the completion and dismiss the popupmenu, implies `insert = 1`. ``` coc#pum#one_more() **coc#pum#one_more()** ``` Insert one more character from current complete item (first complete item when no complete item selected), works like of |popupmenu-keys|. Note that the word of complete item should starts with current input. ``` ``` Nothing happens when failed. ``` ``` Note: this function should only be used in key-mappings. ``` coc#pum#scroll({forward}) **coc#pum#scroll()** ``` Scroll the popupmenu forward or backward by page. Timer is used to make it works as {rhs} of key-mappings. Return . ``` # Parameters: ~ ``` {forward} Scroll forward when none zero. ``` coc#inline#trigger([{option}]) **coc#inline#trigger()** # Parameters: ~ ``` {option} Optional option object. Which can have following properties: - `provider` the provider name (the extension name or Language Client id which register inline completion provider), all valid providers will be requested in parallel when not specified. - `silent` when truthy no message would be shown when no inline completion items exists. ``` ``` Return `""` ``` coc#inline#visible() **coc#inline#visible()** ``` Return `1` when inline completion visual text exists for current buffer. ``` coc#inline#cancel() **coc#inline#cancel()** ``` Cancel the inline completion request and clear inline completion virtual text of current buffer. Return `""`. ``` ``` Note: this function uses |CocActionAsync|, use it in key-mappings instead of API. ``` coc#inline#accept([{kind}]) **coc#inline#accept()** ``` Accept current inline completion by insert text to current buffer when possible, nothing happens when inline completion is not activated. ``` # Parameters: ~ ``` {kind} Optional accept kind of inline completion, could be one of "all", "word", "line". Default to "all" which means accept full insert text of complete item. ``` ``` Note: this function uses |CocActionAsync|, use it in key-mappings instead of API. ``` coc#inline#next() **coc#inline#next()** ``` Navigate to next inline complete item. Return `""`. ``` ``` Note: this function uses |CocActionAsync|, use it in key-mappings instead of API. ``` coc#inline#prev() **coc#inline#prev()** ``` Navigate to previous inline complete item. Return `""`. ``` ``` Note: this function uses |CocActionAsync|, use it in key-mappings instead of API. ``` ``` *coc#notify* ``` coc#notify#close_all() **coc#notify#close_all()** ``` Close all notification windows. ``` coc#notify#do_action([{winid}]) **coc#notify#do_action()** ``` Invoke action for all notification windows, or particular window with winid. ``` coc#notify#copy() **coc#notify#copy()** ``` Copy all content from notifications to system clipboard. ``` coc#notify#show_sources() **coc#notify#show_sources()** ``` Show source name (extension name) in notification windows. ``` coc#notify#keep() **coc#notify#keep()** ``` Stop auto hide timer of notification windows. ``` coc#float#has_float([{all}]) **coc#float#has_float()** ``` Check if float window/popup exists, check coc.nvim's float window/popup by default. ``` coc#float#close_all([{all}]) **coc#float#close_all()** ``` Close all float windows/popups created by coc.nvim, set {all} to `1` for all float window/popups. ``` ``` Return `""`. ``` coc#float#close({winid}) **coc#float#close()** ``` Close float window/popup with {winid}. ``` coc#float#has_scroll() **coc#float#has_scroll()** ``` Return `1` when there is scrollable float window/popup created by coc.nvim. ``` ``` Example key-mappings: ``` > ``` nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" ``` < coc#float#scroll({forward}, [{amount}]) **coc#float#scroll()** ``` Scroll all scrollable float windows/popups, scroll backward when {forward} is not `1`. {amount} could be number or full page when omitted. Popup menu is excluded. ``` coc#compat#call({name}, {args}) **coc#compat#call()** ``` Call api function {name} with {args} list (starts with `nvim_`) on vim or neovim, use: > :echo coc#api#Get_api_info()[1]['functions'] ``` < ``` on vim9 to get supported apis on vim. ``` CocRequest({id}, {method}, [{params}]) **CocRequest()** ``` Send a request to language client of {id} with {method} and optional {params}. Example: > ``` ``` call CocRequest('tslint', 'textDocument/tslint/allFixes', \ {'textDocument': {'uri': 'file:///tmp'}}) ``` < ``` Vim error will be raised if the response contains an error. ``` ``` *CocRequestAsync()* ``` CocRequestAsync({id}, {method}, [{params}, [{callback}]]) ``` Send async request to remote language server. {callback} function is called with error and response. ``` CocNotify({id}, {method}, [{params}]) **CocNotify()** ``` Send notification to remote language server, example: ``` > ``` call CocNotify('ccls', '$ccls/reload') ``` < ``` *CocRegisterNotification()* ``` CocRegisterNotification({id}, {method}, {callback}) ``` Register notification callback for specified client {id} and {method}, example: > ``` ``` autocmd User CocNvimInit call CocRegisterNotification('ccls', \ '$ccls/publishSemanticHighlight', function('s:Handler')) ``` < ``` {callback} is called with single param as notification result. ``` ``` Note: when register notification with same {id} and {method}, only the later registered would work. ``` ``` *CocLocations()* ``` CocLocations({id}, {method}, [{params}, {openCommand}]) ``` Send location request to language client of {id} with {method} and optional {params}. e.g.: > ``` ``` call CocLocations('ccls', '$ccls/call', {'callee': v:true}) ``` ``` call CocLocations('ccls', '$ccls/call', {}, 'vsplit') ``` < ``` {openCommand}: optional command to open buffer, default to `coc.preferences.jumpCommand` , |:edit| by default. When it's `v:false` locations list would always used. ``` ``` *CocLocationsAsync()* ``` CocLocationsAsync({id}, {method}, [{params}, {openCommand}]) ``` Same as |CocLocations()|, but send notification to server instead of request. ``` CocAction({action}, [...{args}]) **CocAction()** ``` Run {action} of coc with optional extra {args}. ``` ``` Checkout |coc-actions| for available actions. ``` ``` Note: it's recommended to use |CocActionAsync()| unless you have to block your vim. ``` ``` *CocActionAsync()* ``` CocActionAsync({action}, [...{args}, [{callback}]]) ``` Call CocAction by send notification to NodeJS process of coc.nvim. ``` ``` When callback function exists as the last argument, the callback function is called with `error` string as the first argument and `result` as the second argument. When no callback exists, error message would be echoed. ``` ``` Checkout |coc-actions| for available actions. ``` ``` Note: callback function required to get the vim state after the action. ``` CocHasProvider({feature}, [{bufnr}]) **CocHasProvider()** ``` Check if provider exists for specified feature of current or {bufnr} buffer. Supported features: ``` ``` `rename` `onTypeEdit` `documentLink` `documentColor` `foldingRange` `format` `codeAction` `workspaceSymbols` `formatRange` `hover` `signature` `documentSymbol` `documentHighlight` `definition` `declaration` `typeDefinition` `reference` `implementation` `codeLens` `selectionRange` `formatOnType` `callHierarchy` `semanticTokens` `semanticTokensRange` `linkedEditing` `inlayHint` `inlineValue` `typeHierarchy` ``` CocTagFunc({pattern}, {flags}, {info}) **CocTagFunc()** ``` Used for vim's 'tagfunc' option, to make tag search by |CTRL-]| use coc.nvim as provider, tag search would be performed when no result from coc.nvim. ``` ``` Make sure your vim support 'tagfunc' by ``` > ``` :echo exists('&tagfunc') ``` < -------------------------------------------------------------------------------- ``` *coc-actions* # Available Actions ~ ``` Acceptable {action} names for |CocAction()| and |CocActionAsync()|. "addWorkspaceFolder" {folder} **CocAction('addWorkspaceFolder')** ``` Add {folder} to workspace folders, {folder} should be exists directory on file system. ``` "removeWorkspaceFolder" {folder} **CocAction('removeWorkspaceFolder')** ``` Remove workspace fold {folder}, {folder} should be exists directory on file system. ``` "ensureDocument" [{bufnr}] **CocAction('ensureDocument')** ``` Ensure current or specified document is attached to coc.nvim |coc-document-attached|, should be used when you need invoke action of current document on buffer create. ``` ``` Return |v:false| when document can't be attached. ``` "diagnosticList" **CocAction('diagnosticList')** ``` Get all diagnostic items of the current Neovim session. ``` "diagnosticInfo" [{target}] **CocAction('diagnosticInfo')** ``` Show diagnostic message at the current position, do not truncate. ``` ``` Optional {target} could be `float` or `echo`. ``` "diagnosticToggle" [{enable}] **CocAction('diagnosticToggle')** ``` Enable/disable diagnostics on the fly. This setting is ignored if `displayByAle` is enabled. You can toggle by specifying {enable}. {enable} can be 0 or 1 ``` "diagnosticToggleBuffer" [{bufnr}] [{enable}] **CocAction('diagnosticToggleBuffer')** ``` Toggle diagnostics for specific buffer, current buffer is used when {bufnr} not provided. 0 for current buffer You can toggle by specifying {enable}. {enable} can be 0 or 1 ``` ``` Note: this will only affect diagnostics shown in the UI, list of all diagnostics won't change. ``` "diagnosticPreview" **CocAction('diagnosticPreview')** ``` Show diagnostics under current cursor in preview window. ``` "diagnosticRefresh" [{bufnr}] **CocAction('diagnosticRefresh')** ``` Force refresh diagnostics for special buffer with {bufnr} or all buffers when {bufnr} doesn't exist, returns `v:null` before diagnostics are shown. ``` ``` NOTE: Will refresh in any mode. ``` ``` Useful when `diagnostic.autoRefresh` is `false`. ``` "sourceStat" **CocAction('sourceStat')** ``` get the list of completion source stats for the current buffer. ``` "toggleSource" {source} **CocAction('toggleSource')** ``` enable/disable {source}. ``` "definitions" **CocAction('definitions')** ``` Get definition locations of symbol under cursor. Return LSP `Location[]` ``` "declarations" **CocAction('declarations')** ``` Get declaration location(s) of symbol under cursor. Return LSP `Location | Location[] | LocationLink[]` ``` "implementations" **CocAction('implementations')** ``` Get implementation locations of symbol under cursor. Return LSP `Location[]` ``` "typeDefinitions" **CocAction('typeDefinitions')** ``` Get type definition locations of symbol under cursor. Return LSP `Location[]` ``` "references" [{excludeDeclaration}] **CocAction('references')** ``` Get references location list of symbol under cursor. ``` ``` {excludeDeclaration}: exclude declaration locations when not zero. ``` ``` Return LSP `Location[]` ``` "jumpDefinition" [{openCommand}] **CocAction('jumpDefinition')** ``` jump to definition locations of the current symbol. Return `v:false` when location not found. ``` ``` |coc-list-location| is used when more than one position is available, for custom location list, use variable: |g:coc_enable_locationlist|. ``` ``` To always use |coc-list-location|| for locations, use `v:false` for {openCommand}. ``` ``` {openCommand}: optional command to open buffer, default to `coc.preferences.jumpCommand` in `coc-settings.json` ``` "jumpDeclaration" [{openCommand}] **CocAction('jumpDeclaration')** ``` jump to declaration locations of the current symbol. Return `v:false` when location not found. ``` ``` same behavior as "jumpDefinition". ``` ``` When {openCommand} is `v:false`, location list would be always used. ``` "jumpImplementation" [{openCommand}] **CocAction('jumpImplementation')** ``` Jump to implementation locations of the current symbol. Return `v:false` when location not found. ``` ``` same behavior as "jumpDefinition" ``` "jumpTypeDefinition" [{openCommand}] **CocAction('jumpTypeDefinition')** ``` Jump to type definition locations of the current symbol. Return `v:false` when location not found. ``` ``` same behavior as "jumpDefinition" ``` "jumpReferences" [{openCommand}] **CocAction('jumpReferences')** ``` Jump to references locations of the current symbol, use |CocAction('jumpUsed')| to exclude declaration locations. ``` ``` Return `v:false` when location not found. ``` ``` same behavior as "jumpDefinition" ``` "jumpUsed" [{openCommand}] **CocAction('jumpUsed')** ``` Jump references locations without declarations. ``` ``` same behavior as "jumpDefinition" ``` "getHover" [{hoverLocation}] **CocAction('getHover')** ``` Get documentation text array on {hoverLocation} or current position, returns array of string. ``` ``` {hoverLocation} could contains: • bufnr: optional buffer number. • line: 1 based line number. • col: 1 based col number ``` ``` Throw error when buffer with bufnr is not attached. ``` "doHover" [{hoverTarget}] **CocAction('doHover')** ``` Show documentation of current symbol, return `v:false` when hover not found. ``` ``` {hoverTarget}: optional specification for where to show hover info, defaults to `coc.preferences.hoverTarget` in `coc-settings.json`. Valid options: ["preview", "echo", "float"] ``` "definitionHover" [{hoverTarget}] **CocAction('definitionHover')** ``` Same as |CocAction('doHover')|, but includes definition contents from definition provider when possible. ``` "showSignatureHelp" **CocAction('showSignatureHelp')** ``` Echo signature help of current function, return `v:false` when signature not found. You may want to set up an autocmd like this: > ``` "getCurrentFunctionSymbol" **CocAction('getCurrentFunctionSymbol')** ``` Return the function string that current cursor in. ``` "documentSymbols" [{bufnr}] **CocAction('documentSymbols')** ``` Get a list of symbols of current buffer or specific {bufnr}. ``` "rename" **CocAction('rename')** ``` Rename the symbol under the cursor position, |coc-dialog-input| would be shown for prompt a new name. ``` ``` Show error message when the provider not found or prepare rename failed. ``` ``` The buffers are not saved after apply workspace edits, use |:wa| to save all buffers. It's possible to undo/redo and inspect the changes, see |coc-workspace-edits|. ``` ``` Note: coc.nvim supports rename for disk files, but your language server may not. ``` "refactor" **CocAction('refactor')** ``` Open |coc-refactor-buffer| with current symbol as activated cursor ranges. Requires LSP rename support enabled with current buffer, use |:CocSearch| when rename support is not available. ``` "format" **CocAction('format')** ``` Format current buffer using the language server. Return `v:false` when format failed. ``` "formatSelected" [{mode}] **CocAction('formatSelected')** ``` Format the selected range, {mode} should be one of visual mode: `v` , `V`, `char`, `line`. ``` ``` When {mode} is omitted, it should be called using |formatexpr|. ``` "snippetCancel" **CocAction('snippetCancel')** ``` Cancel current snippet session. ``` "snippetInsert" {range} {snippet} [{mode}] **CocAction('snippetInsert')** ``` Insert {snippet} text as specific {range} of current buffer. ``` ``` {range} should be valid LSP range like: ``` > ``` // all 0 based utf16 unit code index. {"start": {"line": 0, "character": 1}, "end": {"line": 0, "character": 3}} ``` < ``` {snippet} is the textmate format snippet text used by VSCode. ``` ``` {mode} could be 1 or 2, use 1 to disable format of snippet. ``` "selectionRanges" **CocAction('selectionRanges')** ``` Get selection ranges of current position from language server. ``` "services" **CocAction('services')** ``` Get an information list for all services. ``` "toggleService" {serviceId} **CocAction('toggleService')** ``` Start or stop a service. ``` "codeAction" [{mode}] [{only}] [{include_disabled}] **CocAction('codeAction')** ``` Prompt for a code action and do it. ``` ``` {mode} could be `currline` or `cursor` or result of |visualmode()|, current buffer range is used when it's empty string. ``` ``` {only} can be title of a codeAction or list of CodeActionKind. ``` ``` {include_disabled} include disabled actions when is truth value. ``` "codeActionRange" {start} {end} [{kind}] **CocAction('codeActionRange')** ``` Run code action for range. ``` ``` {start} Start line number of range. {end} End line number of range. {kind} Code action kind, see |CocAction('codeActions')| for available action kind. ``` ``` Can be used to create commands like: > ``` ``` command! -nargs=* -range CocAction :call CocActionAsync('codeActionRange', , , ) command! -nargs=* -range CocFix :call CocActionAsync('codeActionRange', , , 'quickfix') ``` < "codeLensAction" **CocAction('codeLensAction')** ``` Invoke the command for codeLens of current line (or the line that contains codeLens just above). Prompt would be shown when multiple actions are available. ``` "commands" **CocAction('commands')** ``` Get a list of available service commands for the current buffer. ``` "runCommand" [{name}] [...{args}] **CocAction('runCommand')** ``` Run a global command provided by the language server. If {name} is not provided, a prompt with a list of commands is shown to be selected. ``` ``` {args} are passed as arguments of command. ``` ``` You can bind your custom command like so: > ``` ``` command! -nargs=0 OrganizeImport \ :call CocActionAsync('runCommand', 'editor.action.organizeImport') ``` < "fold" {{kind}} **CocAction('fold')** ``` Fold the current buffer, optionally use {kind} for specific FoldingRangeKind. {kind} could be 'comment', 'imports' or 'region'. ``` ``` Return `v:false` when failed. ``` ``` You can create a custom command like: > ``` ``` command! -nargs=? Fold :call CocAction('fold', ) ``` < "highlight" **CocAction('highlight')** ``` Highlight the symbols under the cursor. ``` "openLink" [{command}] **CocAction('openLink')** ``` Open a link under the cursor with {command}. {command} default to `edit`. ``` ``` File and URL links are supported, return `v:false` when failed. ``` ``` URI under cursor would be searched when no link returned from the "documentLink" provider. ``` ``` Configure |g:coc_open_url_command| for custom command to open remote url. ``` "links" **CocAction('links')** ``` Return document link list of current buffer. ``` "extensionStats" **CocAction('extensionStats')** ``` Get all extension states as a list. Including `id`, `root` and `state`. ``` ``` State could be `disabled`, `activated` and `loaded`. ``` "toggleExtension" {id} **CocAction('toggleExtension')** ``` Enable/disable an extension. ``` "uninstallExtension" {id} **CocAction('uninstallExtension')** ``` Uninstall an extension. ``` "reloadExtension" {id} **CocAction('reloadExtension')** ``` Reload an activated extension. ``` "activeExtension" {id} **CocAction('activeExtension')** ``` Activate extension of {id}. ``` "deactivateExtension" {id} **CocAction('deactivateExtension')** ``` Deactivate extension of {id}. ``` "pickColor" **CocAction('pickColor')** ``` Change the color at the current cursor position, requires `documentColor` provider |CocHasProvider|. ``` ``` Note: only works on mac or when you have python support on Vim and have the GTK module installed. ``` "colorPresentation" **CocAction('colorPresentation')** ``` Change the color presentation at the current color position, requires `documentColor` provider |CocHasProvider|. ``` "codeActions" [{mode}] [{only}] **CocAction('codeActions')** ``` Get codeActions list of current document. ``` ``` {mode} can be result of |visualmode()| for visual selected range. When it's falsy value, current file is used as range. ``` ``` {only} can be array of codeActionKind, possible values including: - 'refactor': Base kind for refactoring actions - 'quickfix': base kind for quickfix actions - 'refactor.extract': Base kind for refactoring extraction actions - 'refactor.inline': Base kind for refactoring inline actions - 'refactor.rewrite': Base kind for refactoring rewrite actions - 'source': Base kind for source actions - 'source.organizeImports': Base kind for an organize imports source action - 'source.fixAll': Base kind for auto-fix source actions ``` ``` {only} can also be string, which means filter by title of codeAction. ``` "organizeImport" **CocAction('organizeImport')** ``` Run organize import code action for current buffer. Return `false` when the code action not exists. ``` "fixAll" **CocAction('fixAll')** ``` Run fixAll codeAction for current buffer. Show warning when codeAction not found. ``` "quickfixes" [{visualmode}] **CocAction('quickfixes')** ``` Get quickfix codeActions of current buffer. ``` ``` Add {visualmode} as second argument get quickfix actions with range of latest |visualmode()| ``` "doCodeAction" {codeAction} **CocAction('doCodeAction')** ``` Do a codeAction. ``` "doQuickfix" **CocAction('doQuickfix')** ``` Do the first preferred quickfix action on current line. ``` ``` Throw error when no quickfix action found. ``` "addRanges" {ranges} **CocAction('addRanges')** ``` Ranges must be provided as array of range type: https://git.io/fjiEG ``` "getWordEdit" **CocAction('getWordEdit')** ``` Get workspaceEdit of current word, language server used when possible, extract word from current buffer as fallback. ``` "getWorkspaceSymbols" {input} **CocAction('getWorkspaceSymbols')** ``` Get workspace symbols from {input}. ``` "resolveWorkspaceSymbol" {symbol} **CocAction('resolveWorkspaceSymbol')** ``` Resolve location for workspace {symbol}. ``` "showOutline" [{keep}] **CocAction('showOutline')** ``` Show |coc-outline| for current buffer. Does nothing when outline window already shown for current buffer. ``` ``` {keep} override `"outline.keepWindow"` configuration when specified. Could be 0 or 1. ``` ``` Returns after window is shown (document symbol request is still in progress). ``` "hideOutline" **CocAction('hideOutline')** ``` Close |coc-outline| on current tab. Throws vim error when it can't be closed by vim. ``` "incomingCalls" [{CallHierarchyItem}] **CocAction('incomingCalls')** ``` Retrieve incoming calls from {CallHierarchyItem} or current position when not provided. ``` "outgoingCalls" [{CallHierarchyItem}] **CocAction('outgoingCalls')** ``` Retrieve outgoing calls from {CallHierarchyItem} or current position when not provided. ``` "showIncomingCalls" **CocAction('showIncomingCalls')** ``` Show incoming calls of current function with |coc-tree|, see |coc-callHierarchy| ``` "showOutgoingCalls" **CocAction('showOutgoingCalls')** ``` Show outgoing calls of current function with |coc-tree|. ``` "showSuperTypes" **CocAction('showSuperTypes')** ``` Show super types of types under cursor with |coc-tree|, see |coc-typeHierarchy|. A warning is shown when no types found under cursor. ``` "showSubTypes" **CocAction('showSubTypes')** ``` Show sub types of types under cursor with |coc-tree|, see |coc-typeHierarchy|. A warning is shown when no types found under cursor. ``` "semanticHighlight" **CocAction('semanticHighlight')** ``` Request semantic tokens highlight for current buffer. ``` "inspectSemanticToken" **CocAction('inspectSemanticToken')** ``` Inspect semantic token information at cursor position. ``` "rangeSelect" {visualmode} {forward} **CocAction('rangeSelect')** ``` Visual select previous or next selection range, requires `selectionRange` provider. ``` ``` {visualmode} should be result of {visualmode} or "" for current cursor position. {forward} select backward when it's falsy value. ``` "sendRequest" {id} {method} [{params}] **CocAction('sendRequest')** ``` Send LSP request with {method} and {params} to the language server of {id} (check the id by `:CocList services`). Checkout the LSP specification at https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/ ``` "sendNotification" {id} {method} [{params}] **CocAction('sendNotification')** ``` Send LSP notification to language server with {id}. ``` -------------------------------------------------------------------------------- COMMANDS **coc-commands** :CocStart **:CocStart** ``` Start the coc.nvim server, do nothing if the server already started. ``` :CocRestart **:CocRestart** ``` Restart coc.nvim service. ``` ``` Use this command when you want coc to start all over again. ``` :CocPrintErrors **:CocPrintErrors** ``` Show errors from stderr of NodeJS process in a split window. ``` :CocDisable **:CocDisable** ``` Disable handling vim events, useful for debug performance issues. ``` ``` To disable dynamic autocmds registered by extensions, use: ``` > ``` :call coc#clearGroups('coc_dynamic_') ``` < :CocEnable **:CocEnable** ``` Enable handling vim events. ``` :CocConfig **:CocConfig** ``` Edit the user config file `coc-settings.json` in |coc#util#get_config_home()| ``` :CocLocalConfig **:CocLocalConfig** ``` Edit or create `.vim/coc-settings.json` in current workspace folder. ``` :CocInstall [{option}] {name} ... **:CocInstall** ``` Install one or more coc extensions. ``` ``` {option}: could be `-sync` for use blocked process to download instead of terminal. ``` ``` Examples: > ``` ``` " Install latest coc-omni :CocInstall coc-omni " Install coc-omni 1.0.0 :CocInstall coc-omni@1.0.0 " Install snippet extension from github :CocInstall https://github.com/dsznajder/vscode-es7-javascript-react-snippets ``` < :CocUninstall {name} **:CocUninstall** ``` Uninstall an extension, use to complete the extension name. ``` ``` Note: the data create by extension is not cleaned up, you may have to manually remove them. ``` :CocUpdate **:CocUpdate** ``` Update all coc extensions to the latest version. ``` :CocUpdateSync **:CocUpdateSync** ``` Block version of update coc extensions. ``` :CocCommand [{name}] [{args}] ... **:CocCommand** ``` Run a command provided by coc.nvim or contributed by extensions, use `` for name completion. Open |coc-list-commands| when {name} not provided. ``` ``` Note: This command send notification to coc.nvim, to perform task after the command use |CocAction('runCommand')| instead. ``` :CocOpenLog **:CocOpenLog** ``` Open log file of coc.nvim. ``` ``` Use environmental variable `NVIM_COC_LOG_FILE` for fixed log file. Note: the log would be cleared when coc.nvim started. ``` ``` Use environment variable `NVIM_COC_LOG_LEVEL` to change log level (default 'info', could be 'all', 'trace', 'debug', 'info', 'warn', 'error', 'off'). Use shell command: > ``` ``` export NVIM_COC_LOG_LEVEL=debug ``` < ``` or add: > ``` ``` let $NVIM_COC_LOG_LEVEL='debug' ``` < ``` to your `.vimrc` ``` :CocInfo **:CocInfo** ``` Show version and log information in a split window, useful for submitting a bug report. ``` :CocDiagnostics [height] **:CocDiagnostics** ``` Open vim's |location-list| with diagnostics of current buffer. The location list is automatically updated by default. When multiple location list are opened for one buffer, only first one would be automatically updated. ``` :CocSearch **:CocSearch** ``` Perform search by ripgrep https://github.com/BurntSushi/ripgrep, and open |coc-refactor-buffer| with searched results. ``` ``` Note: the search is performed on your files, so normally you should save your buffers before invoke this command. ``` # Common arguments for ripgrep: ~ ``` `-e` `--regexp`: treat search pattern as regexp. `-F` `--fixed-strings`: treat search pattern as fixed string. `-L` `--follow`: follow symbolic links while traversing directories. `-g` `--glob` {GLOB}: Include or exclude files and directories for searching that match the given glob. `--hidden`: Search hidden files and directories. `--no-ignore-vcs`: Don't respect version control ignore files (.gitignore, etc.). `--no-ignore`: Don't respect ignore files (.gitignore, .ignore, etc.). `-w` `--word-regexp`: Only show matches surrounded by word boundaries. `-S` `--smart-case`: Searches case insensitively if the pattern is all lowercase. Search case sensitively otherwise. `--no-config`: Never read configuration files. `-x` `--line-regexp`: Only show matches surrounded by line boundaries. ``` ``` Use `:man 1 rg` in your terminal for more details. ``` ``` Note: By default, hidden files and directories are skipped. ``` ``` Note: By default, vcs ignore files including `.gitignore` and `.ignore` are respected ``` # Escape arguments: ~ ``` || is used to convert command line arguments to arguments of rg, which means you have to escape space for single argument. For example, if you want to search `import { Neovim` , you have to use: ``` > ``` :CocSearch import\ \{\ Neovim ``` < ``` The escape for `{` is required because rg use regexp be default, or: ``` > ``` :CocSearch -F import\ {\ Neovim ``` < ``` for strict match. ``` # Change and save: ~ ``` Refactor session is started with searched patterns highlighted, just change the text and save refactor buffer to make changes across all related files. You can make any kind of changes, including add lines and remove lines. ``` :CocWatch [extension] **:CocWatch** ``` Watch loaded [extension] for reload on file change, use for complete extension id. ``` :CocOutline **:CocOutline** ``` Invoke |CocAction('showOutline')| by notification. ``` -------------------------------------------------------------------------------- AUTOCMD **coc-autocmds** ``` *CocLocationsChange* ``` :autocmd User CocLocationsChange {command} ``` For building a custom view of locations, set |g:coc_enable_locationlist| to 0 and use this autocmd with with |g:coc_jump_locations| ``` ``` For example, to disable auto preview of location list, use: ``` > ``` let g:coc_enable_locationlist = 0 autocmd User CocLocationsChange CocList --normal location ``` < ``` *CocNvimInit* ``` :autocmd User CocNvimInit {command} ``` Triggered after the coc services have started. ``` ``` If you want to trigger an action of coc after Vim has started, this autocmd should be used because coc is always started asynchronously. ``` ``` *CocStatusChange* ``` :autocmd User CocStatusChange {command} ``` Triggered after |g:coc_status| changed, can be used for refresh statusline. ``` ``` *CocDiagnosticChange* ``` :autocmd User CocDiagnosticChange {command} ``` Triggered after the diagnostic status has changed. ``` ``` Could be used for updating the statusline. ``` ``` *CocJumpPlaceholder* ``` :autocmd User CocJumpPlaceholder {command} ``` Triggered after cursor jump to a placeholder. ``` ``` *CocOpenFloat* ``` :autocmd User CocOpenFloat {command} ``` Triggered when a floating window is opened. The window is not focused, use |g:coc_last_float_win| to get window id. ``` ``` *CocOpenFloatPrompt* ``` :autocmd User CocOpenFloatPrompt {command} ``` Triggered when a floating prompt window is opened (triggered after |CocOpenFloat|). ``` ``` *CocTerminalOpen* ``` :autocmd User CocTerminalOpen {command} ``` Triggered when the terminal is shown, can be used for adjusting the window height. ``` -------------------------------------------------------------------------------- HIGHLIGHTS **coc-highlights** The best place to override the highlights is with a |ColorScheme| autocommand: > ``` " make error texts have a red color autocmd ColorScheme solarized ``` \ highlight CocErrorHighlight ctermfg=Red guifg=#ff0000 < Use |:highlight| with group name to check current highlight. Note: don't use `:hi default` for overwriting the highlights. Note: user defined highlight commands should appear after the |:colorscheme| command and use |ColorScheme| autocmd to make sure customized highlights works after color scheme change. # Markdown related ~ **CocBold** for bold text. **CocItalic** for italic text. **CocUnderline** for underlined text. **CocStrikeThrough** for strikethrough text, like usage of deprecated API. **CocMarkdownCode** for inline code in markdown content. **CocMarkdownHeader** for markdown header in floating window/popup. **CocMarkdownLink** for markdown link text in floating window/popup. # Diagnostics related ~ ``` *coc-highlights-diagnostics* ``` **CocFadeOut** for faded out text, such as for highlighting unnecessary code. **CocErrorSign** for error signs. **CocWarningSign** for warning signs. **CocInfoSign** for information signs. **CocHintSign** for hint signs. **CocErrorVirtualText** for error virtual text. **CocWarningVirtualText** for warning virtual text. **CocInfoVirtualText** for information virtual text. **CocHintVirtualText** for hint virtual text. **CocErrorHighlight** for error code range. **CocWarningHighlight** for warning code range. **CocInfoHighlight** for information code range. **CocHintHighlight** for hint code range. **CocDeprecatedHighlight** for deprecated code range, links to |CocStrikeThrough| by default. **CocUnusedHighlight** for unnecessary code range, links to |CocFadeOut| by default. **CocErrorLine** line highlight of sign which contains error. **CocWarningLine** line highlight of sign which contains warning. **CocInfoLine** line highlight of sign which information. **CocHintLine** line highlight of sign which contains hint. Highlight with higher priority would overwrite highlight with lower priority. The priority order: ``` |CocUnusedHighlight| > |CocDeprecatedHighlight| > |CocErrorHighlight| > |CocWarningHighlight| > |CocInfoHighlight| > |CocHintHighlight| ``` # Document highlight related ~ ``` *coc-highlights-document* ``` Highlights used for highlighting same symbols in the buffer at the current cursor position. **CocHighlightText** default symbol highlight. **CocHighlightRead** for `Read` kind of document symbol. **CocHighlightWrite** for `Write` kind of document symbol. # Float window/popup related ~ ``` *coc-highlights-float* ``` **CocFloating** default highlight group of floating windows/popups. Default links to |NormalFloat| on neovim and |Pmenu| on vim. **CocFloatBorder** default border highlight group of floating windows/popups. Default links to |FloatBorder| when exists and |CocFloating| when not. Note: only foreground color is used for border highlight. **CocFloatThumb** thumb highlight of scrollbar. **CocFloatSbar** Scrollbar highlight of floating window/popups. **CocFloatDividingLine** for dividing lines, links to |NonText| by default. **CocFloatActive** for activated text, links to |CocSearch| by default. **CocErrorFloat** for error text in floating windows/popups. **CocHintFloat** for hint text in floating windows/popups. # Inlay hint related ~ ``` *coc-highlights-inlayHint* ``` **CocInlayHint** for highlight inlay hint virtual text block, default uses foreground from |CocHintSign| and background from |SignColumn| **CocInlayHintParameter** for parameter kind of inlay hint. **CocInlayHintType** for type kind of inlay hint. # Notification window/popup related ~ CocNotification **CocNotification** **CocNotificationProgress** for progress line in progress notification. **CocNotificationButton** for action buttons in notification window. **CocNotificationKey** for function keys which trigger actions in notification popups (vim9 only). **CocNotificationError** for highlight border of error notification. **CocNotificationWarning** for highlight border of warning notification. **CocNotificationInfo** for highlight border of info notification. # List related ~ ``` *CocList* ``` **CocSearch** for matched characters. **CocListLine** for current cursor line in list window and preview window. **CocListSearch** for matched characters. **CocListMode** for mode text in the statusline. **CocListPath** for cwd text in the statusline. **CocSelectedText** for sign text of selected lines (multiple selection only). **CocSelectedLine** for line highlight of selected lines (multiple selection only). # Tree view related ~ CocTree **CocTree** **CocTreeTitle** for title in tree view. **CocTreeDescription** for description beside label. **CocTreeOpenClose** for open and close icon in tree view. **CocTreeSelected** for highlight lines contains selected node. # Popup menu related ~ ``` *CocPum* ``` **CocPumSearch** for matched input characters, linked to |CocSearch| by default. **CocPumDetail** for highlight label details that follows label (including possible detail and description). **CocPumMenu** for menu of complete item. **CocPumShortcut** for shortcut text of source. **CocPumDeprecated** for deprecated label. **CocPumVirtualText** for inserted virtual text from word of selected complete item, enabled by |coc-config-suggest-virtualText|. ``` *CocInline* # Inline completion related ~ ``` **CocInlineVirtualText** for virtual text of |coc-inlineCompletion|, defaulting to a medium gray. **CocInlineAnnotation** for annotation virtual text of |coc-inlineCompletion|, defaulting to "MoreMsg". # Symbol icons ~ CocSymbol **CocSymbol** Highlight groups for symbol icons, including `CompletionItemKind` and `SymbolKind` of LSP. The highlight groups link to related |nvim-treesitter| highlight groups when possible and fallback to builtin highlight groups. **CocSymbolDefault** linked to |hl-MoreMsg| by default. **CocSymbolText** **CocSymbolUnit** **CocSymbolValue** **CocSymbolKeyword** **CocSymbolSnippet** **CocSymbolColor** **CocSymbolReference** **CocSymbolFolder** **CocSymbolFile** **CocSymbolModule** **CocSymbolNamespace** **CocSymbolPackage** **CocSymbolClass** **CocSymbolMethod** **CocSymbolProperty** **CocSymbolField** **CocSymbolConstructor** **CocSymbolEnum** **CocSymbolInterface** **CocSymbolFunction** **CocSymbolVariable** **CocSymbolConstant** **CocSymbolString** **CocSymbolNumber** **CocSymbolBoolean** **CocSymbolArray** **CocSymbolObject** **CocSymbolKey** **CocSymbolNull** **CocSymbolEnumMember** **CocSymbolStruct** **CocSymbolEvent** **CocSymbolOperator** **CocSymbolTypeParameter** Note: Use configuration |coc-config-suggest-completionItemKindLabels| for customized icon characters. # Semantic token highlight groups ~ ``` *CocSem* ``` Semantic highlight groups are starts with `CocSem` which link to related |nvim-treesitter| highlight groups when possible and fallback to builtin highlight groups, use variable |g:coc_default_semantic_highlight_groups| to disable creation of these highlight groups. The highlight groups rules: > `CocSemType + type` for types `CocSemTypeMod + type + modifier` for modifier with type < Only semantic tokens types and `deprecated` modifier have default highlight groups. You need create highlight groups for highlight other modifiers and/or specific modifier with type, for example: > ``` " Add highlights for declaration modifier hi link CocSemTypeModClassDeclaration ClassDeclaration ``` < The modifier highlight groups have higher priority. # Others ~ **CocDisabled** highlight for disabled items, eg: menu item. **CocCodeLens** for virtual text of codeLens. **CocCursorRange** for highlight of activated cursors ranges. **CocLinkedEditing** for highlight of activated linked editing ranges. **CocHoverRange** for range of current hovered symbol. **CocMenuSel** for current menu item in menu dialog (should only provide background color). **CocSelectedRange** for highlight ranges of outgoing calls. **CocSnippetVisual** for highlight snippet placeholders. **CocLink** for highlight document links. **CocInputBoxVirtualText** for highlight placeholder of input box. ============================================================================== TREE SUPPORT **coc-tree** Tree view is used for render outline and call hierarchy, following features are supported: • Data update while keep tree node open/close state. • Auto refresh on load error. • Click open/close icon to toggle collapse state. • Click node to invoke default command. • Show tooltip in float window on |CursorHold| when possible. • Key-mappings support |coc-tree-mappings| • Optional multiple selection. • Optional node reveal support. • Optional fuzzy filter support. • Provide API `window.createTreeView` for extensions. Check |coc-config-tree| for related configurations. The filetype is `'coctree'`, which can be used to overwrite buffer and window options. Use variable |w:cocViewId| to detect the kind of tree. -------------------------------------------------------------------------------- TREE KEY MAPPINGS **coc-tree-mappings** Default key-mappings are provided for 'coctree' buffer, which can be changed by configuration |coc-config-tree|. - Select/unselect item, configured by `"tree.key.toggleSelection"`. - Invoke actions of current item, configured by `"tree.key.actions"`. - Close tree window, configured by `"tree.key.close"`. - Invoke command of current item, configured by `"tree.key.invoke"`. - Move cursor to original window. f - Activate filter, configured by `"tree.key.activeFilter"`. t - Trigger key to toggle expand state of tree node, configured by ``` `tree.key.toggle`. ``` M - Collapse all tree node, configured by `"tree.key.collapseAll"`. -------------------------------------------------------------------------------- TREE FILTER **coc-tree-filter** Filter mode is used for search for specific node by fuzzy filter, invoke the key configured by `"tree.key.activeFilter"` to activate filter mode. Note: some tree views not have filter mode supported. When filter mode is activated, type normal character to insert filter input and following special keys are supported: - Delete last filter character when possible. - Delete last filter character when possible. - Clean up filter text. - Navigate to previous filter text (stored on command invoke). - Navigate to next filter text (stored on command invoke). - exit filter mode. - exit filter mode. or `"tree.key.selectPrevious"` - Select previous node. or `"tree.key.selectNext"` - Select next node. or `"key.key.invoke"` - Invoke command of selected node. ============================================================================== LIST SUPPORT **coc-list** Built-in list support to make working with lists of items easier. The following features are supported: • Insert & normal mode. • Default key-mappings for insert & normal mode. • Customize key-mappings for insert & normal mode. • Commands for reopening & doing actions with a previous list. • Different match modes. • Interactive mode. • Auto preview on cursor move. • Number select support. • Built-in actions for locations. • Parse ANSI code. • Mouse support. • Select actions using . • Multiple selections using in normal mode. • Select lines by visual selection. To enable set filetype of preview window, use |g:coc_list_preview_filetype|. -------------------------------------------------------------------------------- LIST COMMAND **coc-list-command** :CocList [{...options}] [{source}] [{...args}] **:CocList** ``` Open coc list of {source}, example: > ``` ``` :CocList --normal location ``` < ``` For current jump locations. ``` ``` For {options}, see |coc-list-options|. ``` ``` Also check |coc-config-list| for list configuration. ``` ``` {args} are sent to source during the fetching of list. Press `?` on normal mode to get supported {args} of current list. ``` ``` When {source} is empty, the lists source with list of sources is used. ``` :CocListResume [{name}] **:CocListResume** ``` Reopen last opened list, input and cursor position will be preserved. ``` :CocListCancel **:CocListCancel** ``` Close list, useful when the list is not the current window. ``` :CocPrev [{name}] **:CocPrev** ``` Invoke default action for the previous item in the last {name} list. ``` ``` Doesn't open the list window if it's closed. ``` :CocNext [{name}] **:CocNext** ``` Invoke the default action for the next item in the last {name} list. ``` ``` Doesn't open the list window if it's closed. ``` :CocFirst [{name}] **:CocFirst** ``` Invoke default action for first item in the last {name} list. ``` :CocLast [{name}] **:CocLast** ``` Invoke default action for last item in the last {name} list. ``` ``` *coc-list-options* # Options of CocList command ~ ``` --top ``` Show list as top window. ``` --tab ``` Open list in new tabpage. ``` --normal ``` Start list in normal mode, recommended for short list. ``` --no-sort ``` Disable sort made by fuzzy score or most recently used, use it when it's already sorted. ``` --input={input} ``` Specify the input on session start. ``` --height={number} ``` Specify the height of list window, override configuration |coc-config-list-height|. No effect when list opened in new tab by `--tab`. ``` --strict, -S ``` Use strict matching instead of fuzzy matching. ``` --regex, -R ``` Use regex matching instead of fuzzy matching. ``` --ignore-case ``` Ignore case when using strict matching or regex matching. ``` --number-select, -N ``` Type a line number to select an item and invoke the default action on insert mode. Type `0` to select the 10th line. ``` --interactive, -I ``` Use interactive mode, list items would be reloaded on input change, filter and sort would be done by list implementation. ``` ``` Note: only works when the list support interactive mode. ``` ``` Note: filtering and sorting would be done by underlying task, which means options including `--strict`, `--no-sort`, `--regex`, `--ignore-case` would not work at all. ``` --auto-preview, -A ``` Start a preview for the current item on the visible list. ``` --no-quit ``` Not quit list session after invoke action. ``` ``` Note: you may need to refresh the list for current state. ``` --first ``` Invoke default action for first list item on list open. Nothing happens when the list is empty. ``` --reverse ``` Reverse the order of list items shown in the window, the bottom line would shown the first item. ``` -------------------------------------------------------------------------------- LIST CONFIGURATION **coc-list-configuration** Use `coc-settings.json` for configuration of lists. Configuration of list starts with 'list.'. See |coc-config-list| or type `list.` in your settings file to get completion list (requires coc-json installed). For configuration of a specified list, use section that starts with: `list.source.{name}`, where `{name}` is the name of list. # Change default action: ~ If you want to use `tabe` as default action of symbols list, you can use: > ``` // change default action of symbols "list.source.symbols.defaultAction": "tabe" ``` < in your coc-settings.json # Change default options: ~ To change |coc-list-options| for source with {name}, use `list.source.{name}.defaultOptions` configuration like: > ``` // make symbols list use normal mode and interactive by default "list.source.symbols.defaultOptions": ["--interactive", "--number-select"], ``` < Note: some list like symbols only work in interactive mode, you must include `--interactive` in `defaultOptions`. Note: default options will not be used when there're options passed with |:CocList| command. # Change default arguments: ~ Use `list.source.{name}.defaultArgs` setting like: > ``` // use regex match for grep source "list.source.grep.defaultArgs": ["-regex"], ``` Note: default arguments used only when arguments from |:CocList| command is empty. Note: Type `?` on normal mode to get supported arguments of current list. -------------------------------------------------------------------------------- LIST MAPPINGS **coc-list-mappings** Default mappings on insert mode: - Cancel list session. - Do default action with selected items or current item. - Stop loading task. - Paste text from system clipboard. - Reload list. - Change to normal mode. - Select next line. - Select previous line. - Move cursor left. - Move cursor right. - Move cursor to end of prompt. - Same as . - Move cursor to start of prompt. - Same as . - Scroll window forward. - Scroll window backward. - Remove previous character of cursor. - Remove previous character of cursor. - Remove previous word of cursor. - Remove characters before cursor. - Navigate to next input in history. - Navigate to previous input in history. - Switch matcher for filter items. - Insert content from vim's register. - Select action. Default mappings on normal mode: - Cancel list session. - Do default action with selected items or current item. - Stop source from fetching more items. - Reload list. - Mark all visible items selected. - Jump to original window on list create. - Select action. - Scroll preview window down. - Scroll preview window up. - Toggle selection of current item. i,I,o,O,a,A - Change to insert mode. p - Preview action. : - Cancel the prompt and enter command mode. ? - Show help of current list. t - Do 'tabe' action. d - Do 'drop' action. s - Do 'split' action. r - Do 'refactor' action. Use |coc-list-mappings-custom| to override default mappings. ``` *coc-list-mappings-custom* ``` Configurations `"list.normalMappings"` and `"list.insertMappings"` are used for customizing the list key-mappings, example: > ``` "list.insertMappings": { "": "do:previewtoggle", "": "do:help" "": "do:refresh", "": "feedkeys:\\", "": "feedkeys:\\", "": "normal:j", "": "normal:k", "": "action:tabe", "": "call:MyFunc", // paste yanked text to prompt "": "eval:@@" } "list.normalMappings": { "c": "expr:MyExprFunc" "d": "action:delete" } ``` < Note: you should only use mappings that start with ` can't be remapped for other actions. The mapping expression should be `command:arguments`, available commands: 'do' - special actions provided by coc list, including: ``` 'refresh' - reload list. 'selectall' - mark all visible items selected. 'switch' - switch matcher used for filter items. 'exit' - exit list session. 'stop' - stop loading task. 'cancel' - cancel list session but leave list window open. 'toggle' - toggle selection of current item. 'togglemode' - toggle between insert and normal mode. 'previous' - move cursor to previous item. 'next' - move cursor to next item. 'defaultaction' - do default action for selected item(s). 'chooseaction' - choose action for selected item(s). 'jumpback' - stop prompt and jump back to original window. 'previewtoggle' - toggle preview window, requires preview action exists. 'previewup' - scroll preview window up. 'previewdown' - scroll preview window down. 'help' - show help. ``` 'prompt' - do prompt action, including: ``` 'previous' - change to previous input in history. 'next' - change to next input in history. 'start' - move cursor to start. 'end' - move cursor to end. 'left' - move cursor left. 'right' - move cursor right. 'leftword' - move cursor left by a word. 'rightword' - move cursor right by a word. 'deleteforward' - remove previous character. 'deletebackward' - remove next character. 'removetail' - remove characters afterwards. 'removeahead' - remove character ahead. 'removeword' - remove word before cursor. 'insertregister' - insert content from Vim register. 'paste' - append text from system clipboard to prompt. ``` 'eval' - append text to prompt from result of VimL expression. 'action' - execute action of list, use to find available actions. 'feedkeys' - feedkeys to list window, use `\\` in JSON to escape special characters. 'feedkeys!' - feedkeys without remap. 'normal' - execute normal command in list window. 'normal!' - execute normal command without remap. 'command' - execute command. 'call' - call Vim function with |coc-list-context| as only argument. 'expr' - same as 'call' but expect the function return action name. ``` *coc-list-context* ``` Context argument contains the following properties: 'name' - name of the list, example: `'location'`. 'args' - arguments of the list. 'input' - current input of prompt. 'winid' - window id on list activated. 'bufnr' - buffer number on list activated. 'targets' - list of selected targets, checkout |coc-list-target| for properties. ``` *coc-list-target* ``` Target contains the following properties: 'label' - mandatory property that is shown in the buffer. 'filtertext' - optional filter text used for filtering items. 'location' - optional location of item, check out https://bit.ly/2Rtb6Bo 'data' - optional additional properties. -------------------------------------------------------------------------------- LIST SOURCES **coc-list-sources** -------------------------------------------------------------------------------- location **coc-list-location** ``` Last jump locations. ``` ``` Actions: ``` ``` - 'preview' : preview location in preview window. - 'open': open location by use `"coc.preferences.jumpCommand"`, default action - 'tabe': Use |:tabe| to open location. - 'drop': Use |:drop| to open location. - 'vsplit': Use |:vsplit| to open location. - 'split': Use |:split| to open location. - 'quickfix': Add selected items to Vim's quickfix. ``` ``` To customize filepath displayed in the list, user could inject javascript global function `formatFilepath` which accept filepath and should return string. ex: ``` > ``` const path = require('path') global.formatFilepath = function (file) { return file.startsWith('jdt:/') ? path.basename(file) : file } ``` < # save the file to `~/custom.js` and make coc load it by add > # let g:coc_node_args = ['-r', expand('~/custom.js')] < ``` to your vimrc. `formatFilepath` works for |coc-list-symbols| as well. ``` extensions **coc-list-extensions** ``` Manage coc.nvim extensions. First column in the list window represent the state of extension: ``` ``` - "*" means the extension is activated. - "+" means the extension package json is loaded, but not activated by load the javascript file. - "-" means the extension is disabled by 'disable' action. - "?" means the extension is not recognized by coc.nvim. ``` ``` Actions: ``` ``` - 'toggle' activate/deactivate extension, default action. - 'disable' disable extension. - 'enable' enable extension. - 'lock' lock/unlock extension to current version. - 'doc' view extension's README doc. - 'fix' fix dependencies in terminal buffer. - 'reload' reload extension. - 'uninstall' uninstall extension. ``` diagnostics **coc-list-diagnostics** ``` All diagnostics for the workspace. ``` ``` Actions: ``` ``` - Same as |coc-list-location| ``` folders **coc-list-folders** ``` Manage current workspace folders of coc.nvim. ``` ``` Actions: ``` ``` - 'edit' change the directory of workspace folder. - 'delete' remove selected workspace folder. ``` outline **coc-list-outline** ``` Symbols in the current document. ``` ``` Actions: ``` ``` - Same as |coc-list-location| ``` symbols **coc-list-symbols** ``` Search workspace symbols. ``` ``` Actions: ``` ``` - Same as |coc-list-location| ``` services **coc-list-services** ``` Manage registered services. ``` ``` Actions: ``` ``` - 'toggle': toggle service state, default action. ``` commands **coc-list-commands** ``` Workspace commands. ``` ``` Actions: ``` ``` - 'run': run selected command, default action. ``` ``` Builtin commands: - document.checkBuffer - document.echoFiletype - document.jumpToNextSymbol - document.jumpToPrevSymbol - document.renameCurrentWord - document.showIncomingCalls - document.showOutgoingCalls - document.toggleCodeLens - document.toggleColors - document.toggleInlayHint - editor.action.colorPresentation - editor.action.formatDocument - editor.action.organizeImport - editor.action.pickColor - extensions.forceUpdateAll - extensions.toggleAutoUpdate - semanticTokens.checkCurrent - semanticTokens.clearAll - semanticTokens.clearCurrent - semanticTokens.inspect - semanticTokens.refreshCurrent - workspace.clearWatchman - workspace.diagnosticRelated - workspace.inspectEdit - workspace.undo - workspace.redo - workspace.renameCurrentFile - workspace.showOutput - workspace.workspaceFolders ``` links **coc-list-links** ``` Links in the current document. ``` ``` Actions: ``` ``` - 'open': open the link, default action. - 'jump': jump to link definition. ``` sources **coc-list-completion-sources** ``` Available completion sources. ``` ``` Actions: ``` ``` - 'toggle': activate/deactivate source, default action. - 'refresh': refresh source. - 'open': open the file where source defined. ``` lists **coc-list-lists** ``` Get available lists. ``` ``` Actions: ``` ``` - 'open': open selected list, default action. ``` ============================================================================== DIALOG SUPPORT **coc-dialog** Dialog is special float window/popup that could response to user actions, dialog have close button, border, title (optional), bottom buttons(optional). Note bottom buttons work different on neovim and vim, on neovim you can click the button since neovim allows focus of window, on vim you have to type highlighted character to trigger button callback. See |coc-config-dialog| for available configurations. -------------------------------------------------------------------------------- ``` *coc-dialog-basic* ``` A basic dialog is create by Javascript API `window.showDialog` , which is just some texts with optional buttons. -------------------------------------------------------------------------------- ``` *coc-dialog-confirm* ``` A confirm dialog is used for user to confirm an action, normally created by `window.showPrompt()` Confirm dialog uses filter feature on vim8 and |getchar()| on Neovim. The difference is you can operate vim on vim8, but not on neovim. Supported key-mappings: - force cancel, return -1 for callback. , n, N - reject the action, return 0 for callback. y,Y - accept the action, return 1 for callback. -------------------------------------------------------------------------------- ``` *coc-dialog-input* ``` An input dialog request user input with optional default value, normally created by `window.requestInput`, when `"coc.preferences.promptInput"` is false, vim's command line input prompt is used instead. On neovim, it uses float window, on vim8, it opens terminal in popup. Supported key-mappings: - move cursor to first col. - move cursor to last col. - cancel input, null is received by callback. - accept current input selection of current item. QuickPick related (available when created by |coc-dialog-quickpick|). - scroll forward quickpick list. - scroll backward quickpick list. - move to next item in quickpick list. - move to previous item in quickpick list. - toggle selection of current item in quickpick list when canSelectMany is supported. Note on neovim, other insert mode key-mappings could work. Note not possible to configure key-mappings on vim8, to customize key-mappings on neovim, use |CocOpenFloatPrompt| with current buffer. -------------------------------------------------------------------------------- ``` *coc-dialog-quickpick* ``` A quickpick is a input dialog in the middle with a float window/popup contains filtered list items. Fuzzy filter is used by default. See |coc-config-dialog| for available configurations. See |coc-dialog-input| for available key-mappings. -------------------------------------------------------------------------------- ``` *coc-dialog-menu* ``` A menu dialog is used for pick a single item from list of items, extensions could use `window.showMenuPicker` to create menu dialog. Supported key-mappings: - cancel selection. - confirm selection of current item, use |dialog.confirmKey| to override. 1-9 - select item with 1 based index. g - move to first item. G - move to last item. j - move to next item. k - move to previous item. - scroll forward. - scroll backward. -------------------------------------------------------------------------------- ``` *coc-dialog-picker* ``` A picker dialog is used for single/multiple selection. On neovim, it's possible to toggle selection by mouse click inside the bracket. Extensions could use `window.showPickerDialog` to create picker dialog. Supported key-mappings: - cancel selection. - confirm selection of current item, use |dialog.confirmKey| to override. - toggle selection of current item. g - move to first item. G - move to last item. j - move to next item. k - move to previous item. - scroll forward. - scroll backward. When close button is clicked, the selection is canceled with undefined result (same as ). It's recommended to use |coc-dialog-quickpick| for filter support. ============================================================================== NOTIFICATION SUPPORT **coc-notification** Notification windows are created at the bottom right of the screen. Notifications are created by Javascript APIs: `window.showErrorMessage()`, `window.showWarningMessage()`, `window.showInformationMessage()`, `window.showNotification()` and `window.withProgress()`. Possible kind of notifications: 'error', 'warning', 'info' and 'progress'. Message notifications (not progress) requires |coc-preferences-enableMessageDialog| to be `true`. Message notifications without actions would be automatically closed after milliseconds specified by |coc-config-notification-timeout|. Use |coc-config-notification-disabledProgressSources| to disable progress notifications for specific sources. # Customize notifications: ~ • Customize icons: |g:coc_notify| • Customize highlights: |CocNotification| • Customize configurations: |coc-config-notification| # Related functions: ~ • |coc#notify#close_all()| • |coc#notify#do_action()| • |coc#notify#copy()| • |coc#notify#show_sources()| • |coc#notify#keep()| ============================================================================== STATUSLINE SUPPORT **coc-status** Diagnostics info and other status info contributed by extensions could be shown in statusline. The easiest way is add `%{coc#status()}` to your 'statusline' option. Example: > ``` set statusline^=%{coc#status()} ``` < Use |CocStatusChange| autocmd for automatically refresh statusline: > ``` autocmd User CocStatusChange redrawstatus ``` < -------------------------------------------------------------------------------- ``` *coc-status-manual* ``` Create function like: > ``` function! StatusDiagnostic() abort let info = get(b:, 'coc_diagnostic_info', {}) if empty(info) | return '' | endif let msgs = [] if get(info, 'error', 0) call add(msgs, 'E' . info['error']) endif if get(info, 'warning', 0) call add(msgs, 'W' . info['warning']) endif return join(msgs, ' ') . ' ' . get(g:, 'coc_status', '') endfunction ``` < Add `%{StatusDiagnostic()}` to your 'statusline' option. -------------------------------------------------------------------------------- ``` *coc-status-airline* ``` With vim-airline: https://github.com/vim-airline/vim-airline See |airline-coc| ------------------------------------------------------------------------------ ``` *coc-status-lightline* ``` With lightline.vim: https://github.com/itchyny/lightline.vim Use configuration like: > let g:lightline = { ``` \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': { \ 'cocstatus': 'coc#status' \ }, \ } ``` " Use autocmd to force lightline update. autocmd User CocStatusChange,CocDiagnosticChange call lightline#update() < ============================================================================== CREATE PLUGINS **coc-plugins** There're different ways to extend coc.nvim: • Create vim completion sources |coc-api-vim-source|. • Create extensions |coc-api-extension|. • Create single file extensions |coc-api-single-file|. • Debug coc.nvim extension |coc-api-debug|. ============================================================================== FAQ **coc-faq** ------------------------------------------------------------------------------ Check out https://github.com/neoclide/coc.nvim/wiki/F.A.Q ============================================================================== CHANGELOG **coc-changelog** See ./history.md under project root. ============================================================================== vim:tw=78:nosta:noet:ts=8:sts=0:ft=help:noet:fen: