Configure Deno LSP in Neovim with coc.nvim
and coc-deno
Extension
coc.nvim
coc.nvim
is a language server protocol client for neovim. It provides language support for various languages.
Install coc.nvim
using your favorite plugin manager. I use lazy.nvim
, in Lua,for
others
check this link
require('lazy') {
{'neoclide/coc.nvim', {'branch': 'release'}}
}
coc-deno
extensioncoc uses extensions to provide language support. Install the coc-deno
extension using the following command:
:CocInstall coc-deno
or add it to your init.lua
file to load the extension on startup:
vim.g.coc_global_extensions = { 'coc-deno' }
you can add your required extensions to the coc_global_extensions
list.
link to the deno extension: coc-deno and check other extensions here
Just like vscode lsp configuration, you can configure the deno lsp in coc-settings.json
file. You can open the file using :CocConfig
command. Add the following configuration to the file:
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"coc.preferences.formatOnSave": true,
"coc.preferences.enableMessageDialog": true,
"suggest.floatConfig": {
"border": true
},
"signature.floatConfig": {
"border": true
},
"hover.floatConfig": {
"border": true
},
"svelte.enable-ts-plugin": true,
"snippets.ultisnips.pythonPrompt": false
}
deno.enable
: Enable Deno LSPdeno.lint
: Enable lintingdeno.unstable
: Enable unstable featurescoc.preferences
.formatOnSave: Format on savethe other are optional configurations for float windows and other plugins.
if
deno.enable
is not set to true, you have to enable it manually using:CocCommand deno.initilizeWorkspace
command.
This is how i set up deno lsp in neovim using coc.nvim
and coc-deno
extension. for more information check the official documentation of the plugins and extensions.