htmx-lsp icon indicating copy to clipboard operation
htmx-lsp copied to clipboard

Breaks vim.lsp.buf.hover for all other LSP clients

Open catgoose opened this issue 9 months ago • 2 comments

Reproduction repo:

https://github.com/catgoose/templ_issue_repro/tree/bug/lsp_hover_and_codeaction

run:

nvim --clean -u templ.lua views/index.templ

To reproduce:

Do K over htmx attributes:

Image

Now do K over html or templ symbols, observe that no hover occurs

Disable htmx lsp in templ.lua:

  local templ_opts = {
    cmd = {
      "templ",
      "lsp",
      "-http=localhost:7474",
      string.format("-log=%s/templ.log", vim.fn.expand("~")),
    },
    filetypes = filetypes,
    root_dir = lspconfig.util.root_pattern("go.mod", ".git"),
    settings = {},
  }
  lspconfig.html.setup({
    filetypes = filetypes,
  })
  lspconfig.templ.setup(templ_opts)
  -- lspconfig.htmx.setup({
  --   filetypes = filetypes,
  -- })

Now do K over HTML and Templ symbols:

Image

Image

catgoose avatar Feb 20 '25 12:02 catgoose

I think I hit the same issue with my setup, couldn't work out what the issue was!

hmajid2301 avatar Apr 22 '25 16:04 hmajid2301

It looks like the issue is that in cases where htmx-lsp doesn't have any hover results to return, it simply ignores the requests rather than returning an empty response. I'm not sure if this is a bug in Neovim's client, but I believe this is somehow blocking templ's response from being correctly processed and/or displayed.

I have a fix working locally and should be able to open up a PR soon.

WillLillis avatar Apr 23 '25 08:04 WillLillis

@MNThomson @ThePrimeagen Can we get a release created so Mason will pick up this fix?

catgoose avatar Jun 18 '25 11:06 catgoose

bump ^ 🤕

matt961 avatar Jun 22 '25 10:06 matt961

Unfortunately only @ThePrimeagen has the ability to release a new version...

MNThomson avatar Jul 02 '25 21:07 MNThomson

Unfortunately only @ThePrimeagen has the ability to release a new version...

Nice so never?

catgoose avatar Jul 02 '25 22:07 catgoose