emmet-ls icon indicating copy to clipboard operation
emmet-ls copied to clipboard

Usage via `omnifunc`

Open lcmen opened this issue 9 months ago • 0 comments

Hey! Thank you for writing this plugin. I would like to use it with Neovim without any additional autocomplete plugins.

I've copied the configuration from the readme but I can't this plugin work with built-in autocomplete. I have a following on_attach function that connects omnifunc with lsp.omnifunc for the buffer:

local on_attach = function(client, bufnr)
    local map = vim.api.nvim_buf_set_keymap
    local ion = vim.api.nvim_buf_set_option
    local opts = { noremap = true }

    ion(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
    ion(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr()')

    -- Configure keybindings for LSP
    map(bufnr, 'n', 'C-y', '<Cmd>lua vim.lsp.buf.code_action()<CR>', opts)
    map(bufnr, 'n', 'g0', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
    map(bufnr, 'n', 'gf', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
    map(bufnr, 'n', 'gi', '<Cmd>lua vim.lsp.buf.implementation()<CR>', opts)
    map(bufnr, 'n', 'gt', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
    map(bufnr, 'n', 'gr', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
    map(bufnr, 'n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
end

Now, if I type valid emmet syntax in the HTML file (e.g. h1.center), and hit CTRL+x, CTRL+o, I see a following message in status line:

^X mode (^]^D^E^F^O^K^L^N^O^Ps^U^V^Y) Pattern not found

In the :LspLog I also see a following line (not sure if this is related):

[WARN][2023-11-25 18:55:55] ...lsp/handlers.lua:137	"The language server emmet_ls triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"

How can I force emmet to convert snippet to a proper HTML structure?

lcmen avatar Nov 25 '23 18:11 lcmen