Emmet support based on LSP.
Started as coc-emmet replacement for completion-nvim. Should work with any lsp client but not tested.
npm install -g emmet-ls
-
local lspconfig = require'lspconfig' local configs = require'lspconfig/configs' local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true if not lspconfig.emmet_ls then configs.emmet_ls = { default_config = { cmd = {'emmet-ls', '--stdio'}; filetypes = {'html', 'css'}; root_dir = function(fname) return vim.loop.cwd() end; settings = {}; }; } end lspconfig.emmet_ls.setup{ capabilities = capabilities; }
-
Completion is triggered if completion_trigger_character is entered. It's limitation of completion-nvim.
let g:completion_trigger_character = ['.']
If you have set it like this, You will have to add trailing '.' after emmet abbreviation.
div>h.
And it will be expanded to
<div> <h class=""></h> </div>