redhat-developer / redhat-developer/yaml-language-server

hover has ` ` around each character

Open
#881 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug duplicate
Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

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
  • other (Windows 10 21H2 (19044.2965) / WSL 1.2.5.0 / Ubuntu 20.04.6 LTS)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using minimal_init.lua, a .yamllint.yaml containing extends: default, and Neovim's textDocument/hover request. Inspect the hover response and trace where its contents value is produced. Done means the response no longer inserts &emsp; around each character.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.