yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

hover has ` ` around each character

Open kmoschcau opened this issue 1 year ago • 6 comments

Describe the bug

When triggering hover, the response from the server has   around each character in the contents value. This causes neovim to display it with spaces around each character: grafik

Here is the output from neovim's LSP log
[DEBUG][2023-05-15 14:19:39] .../lua/vim/lsp.lua:1392	"LSP[yamlls]"	"client.request"	1	"textDocument/hover"	{
  position = {
    character = 0,
    line = 1
  },
  textDocument = {
    uri = "file:///home/kmoschcau/Code/[REDACTED]/.yamllint.yaml"
  }
}	<function 1>	1
[DEBUG][2023-05-15 14:19:39] .../vim/lsp/rpc.lua:284	"rpc.send"	{
  id = 5,
  jsonrpc = "2.0",
  method = "textDocument/hover",
  params = {
    position = {
      character = 0,
      line = 1
    },
    textDocument = {
      uri = "file:///home/kmoschcau/Code/[REDACTED]/.yamllint.yaml"
    }
  }
}
[DEBUG][2023-05-15 14:19:39] .../vim/lsp/rpc.lua:387	"rpc.receive"	{
  id = 5,
  jsonrpc = "2.0",
  result = {
    contents = {
      kind = "markdown",
      value = "&emsp;#&emsp;#&emsp;#&emsp;#&emsp; &emsp;E&emsp;x&emsp;t&emsp;e&emsp;n&emsp;d&emsp;s&emsp;\n&emsp;\n&emsp;S&emsp;o&emsp;u&emsp;r&emsp;c&emsp;e&emsp;:&emsp; &emsp;[&emsp;y&emsp;a&emsp;m&emsp;l&emsp;l&emsp;i&emsp;n&emsp;t&emsp;.&emsp;j&emsp;s&emsp;o&emsp;n&emsp;]&emsp;(&emsp;h&emsp;t&emsp;t&emsp;p&emsp;s&emsp;:&emsp;/&emsp;/&emsp;j&emsp;s&emsp;o&emsp;n&emsp;.&emsp;s&emsp;c&emsp;h&emsp;e&emsp;m&emsp;a&emsp;s&emsp;t&emsp;o&emsp;r&emsp;e&emsp;.&emsp;o&emsp;r&emsp;g&emsp;/&emsp;y&emsp;a&emsp;m&emsp;l&emsp;l&emsp;i&emsp;n&emsp;t&emsp;.&emsp;j&emsp;s&emsp;o&emsp;n&emsp;)&emsp;"
    },
    range = {
      ["end"] = {
        character = 7,
        line = 1
      },
      start = {
        character = 0,
        line = 1
      }
    }
  }
}
[TRACE][2023-05-15 14:19:39] ...lsp/handlers.lua:618	"default_handler"	"textDocument/hover"	{
  ctx = '{\n  bufnr = 1,\n  client_id = 1,\n  method = "textDocument/hover",\n  params = {\n    position = {\n      character = 0,\n      line = 1\n    },\n    textDocument = {\n      uri = "file:///home/kmoschcau/Code/[REDACTED]/.yamllint.yaml"\n    }\n  }\n}',
  result = {
    contents = {
      kind = "markdown",
      value = "&emsp;#&emsp;#&emsp;#&emsp;#&emsp; &emsp;E&emsp;x&emsp;t&emsp;e&emsp;n&emsp;d&emsp;s&emsp;\n&emsp;\n&emsp;S&emsp;o&emsp;u&emsp;r&emsp;c&emsp;e&emsp;:&emsp; &emsp;[&emsp;y&emsp;a&emsp;m&emsp;l&emsp;l&emsp;i&emsp;n&emsp;t&emsp;.&emsp;j&emsp;s&emsp;o&emsp;n&emsp;]&emsp;(&emsp;h&emsp;t&emsp;t&emsp;p&emsp;s&emsp;:&emsp;/&emsp;/&emsp;j&emsp;s&emsp;o&emsp;n&emsp;.&emsp;s&emsp;c&emsp;h&emsp;e&emsp;m&emsp;a&emsp;s&emsp;t&emsp;o&emsp;r&emsp;e&emsp;.&emsp;o&emsp;r&emsp;g&emsp;/&emsp;y&emsp;a&emsp;m&emsp;l&emsp;l&emsp;i&emsp;n&emsp;t&emsp;.&emsp;j&emsp;s&emsp;o&emsp;n&emsp;)&emsp;"
    },
    range = {
      ["end"] = {
        character = 7,
        line = 1
      },
      start = {
        character = 0,
        line = 1
      }
    }
  }
}

Expected Behavior

It should not add &emsp; to the contents value.

Current Behavior

It adds &emsp; to the contents value.

Steps to Reproduce

  1. Have yaml-language-server installed and in your path
  2. Download minimal neovim config with curl -fLO https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua
  3. Create a .yamllint.yaml and open it with nvim -nu minimal_init.lua .yamllint.yaml
  4. Add extends: default to the first line
  5. Go to normal mode, move the cursor over extends and press K.

Environment

  • [ ] Windows
  • [ ] Mac
  • [ ] Linux
  • [X] other (Windows 10 21H2 (19044.2965) / WSL 1.2.5.0 / Ubuntu 20.04.6 LTS)

kmoschcau avatar May 15 '23 12:05 kmoschcau

I am not familiar with neovim. Is neovim rendering this content as markdown?

gorkem avatar May 15 '23 15:05 gorkem

seems like a duplicate of https://github.com/redhat-developer/yaml-language-server/issues/875

gorkem avatar May 15 '23 15:05 gorkem

It is rendering it as markdown, yes.

kmoschcau avatar May 15 '23 20:05 kmoschcau

@gorkem it seems there is also a discussion going on about this on the PR that introduced this: #844

kmoschcau avatar May 16 '23 11:05 kmoschcau

This behavior is also reproducible with the emacs's lsp-mode.

psibi avatar Nov 29 '23 05:11 psibi

I have just downgraded to 1.11.0 as an workaround currently.

psibi avatar Nov 29 '23 06:11 psibi