Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arbitrary element expansion (vs. emmet-ls) #19

Closed
kpko opened this issue Oct 26, 2023 · 8 comments
Closed

Arbitrary element expansion (vs. emmet-ls) #19

kpko opened this issue Oct 26, 2023 · 8 comments

Comments

@kpko
Copy link

kpko commented Oct 26, 2023

Hi!

I've tried emmet-language-server instead of emmet-ls, because I don't like that every word I write gets expanded into a tag, even though I have a close auto complete entry that would make more sense.

I've read here aca/emmet-ls#55 that this language server fixes that problem, but it seems to have the same behavior: I'm editing a .tsx file, write "asdf" and it gets expanded to "". Is there an option I didn't see?

@olrtg
Copy link
Owner

olrtg commented Oct 26, 2023

Hi @kpko! Hmmm.. that's weird, I don't get completions for that (even triggering manually with ctrl + space in my setup). Can you double-check your LSP/cmp config?

Screenshot 2023-10-26 at 10 32 30

@olrtg
Copy link
Owner

olrtg commented Nov 9, 2023

Did you get it working? 🤔

@kpko
Copy link
Author

kpko commented Nov 10, 2023

Hi, so my cmp configuration looks like this:

local cmp = require'cmp'

cmp.setup({
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body) 
    end,
  },
  mapping = cmp.mapping.preset.insert({
    ['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
    ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
    ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
    ['<C-y>'] = cmp.config.disable, 
    ['<C-e>'] = cmp.mapping({
      i = cmp.mapping.abort(),
      c = cmp.mapping.close(),
    }),
    ['<CR>'] = cmp.mapping.confirm({ select = true }),
    ['<TAB>'] = cmp.mapping.confirm({ select = true })
  }),
  sources = cmp.config.sources({
    { name = 'nvim_lsp' },
    { name = 'nvim_lsp_signature_help' },
    { name = 'path' },
    { name = 'vsnip' }
  }, {
    { name = 'buffer', keyword_length = 5 }
  })
})

cmp.setup.cmdline('/', {
  sources = {
    { name = 'buffer' }
  }
})

My lsp configuration for emmet-language-server seems very basic via lspconfig:

nvim_lsp.emmet_language_server.setup{
  capabilities = capabilities
}

But I'm using other language servers like gopls, rust_analyzer, tsserver, tailwindcss. Maybe one of them is producing this problem.

@kpko
Copy link
Author

kpko commented Nov 10, 2023

For a test I deactivated every language server except for emmet-language-server and I get the following output:

image

@olrtg
Copy link
Owner

olrtg commented Nov 10, 2023

When you tab (or the keybinding that you use for going to the next cmp result) how does it look like? 🤔

Screenshot 2023-11-10 at 10 22 05

This is what I want to see ☝🏽

@kpko
Copy link
Author

kpko commented Nov 10, 2023

I get the html tag expansion after pressing tab:
image

For example this:
image

Leads to:
image

@kpko
Copy link
Author

kpko commented Nov 10, 2023

I might have found something, this might be completely unrelated to your implementation.
image

I've reinstalled your package via npm and now I get another "Comes from" in whence:
image

I needed to 'force' the install because npm would not overwrite the binary.

Now I'm trying to find out where the old emmet-language-server came from.

@kpko
Copy link
Author

kpko commented Nov 10, 2023

Well, it works great now :)

I will close the issue. Thanks for your time!

I'm still not sure where the previous binary came from, though. That's weird.

@kpko kpko closed this as completed Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants