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

bug: docs/hover doesn't handle markdown link escape sequence. #455

Closed
3 tasks done
Bowser1704 opened this issue May 6, 2023 · 2 comments · Fixed by #457 or #639
Closed
3 tasks done

bug: docs/hover doesn't handle markdown link escape sequence. #455

Bowser1704 opened this issue May 6, 2023 · 2 comments · Fixed by #457 or #639
Labels
bug Something isn't working

Comments

@Bowser1704
Copy link

Bowser1704 commented May 6, 2023

Did you check docs and existing issues?

  • I have read all the noice.nvim docs
  • I have searched the existing issues of noice.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.9.0

Operating system/version

Ubuntu 20.04.4 LTS

Describe the bug

When I hover a function which document has link, the highlight doesn't handle it.

image

Its filetype is noice, when I set ft=lsp_markdown, It works.

image

It shows the default hover window when I disable noice.nvim.

image

Run checkhealth noice:

==============================================================================
noice: require("noice.health").check()

noice.nvim ~
- OK **Neovim** >= 0.8.0
- OK Not running inside **Neovide**
- OK You're using a GUI that should work ok
- OK **vim.go.lazyredraw** is not enabled
- OK **nvim-notify** is installed
- OK **TreeSitter vim** parser is installed
- OK **TreeSitter regex** parser is installed
- OK **TreeSitter lua** parser is installed
- OK **TreeSitter bash** parser is installed
- OK **TreeSitter markdown** parser is installed
- OK **TreeSitter markdown_inline** parser is installed
- OK `vim.notify` is set to **Noice**
- OK `vim.lsp.handlers["textDocument/hover"]` is set to **Noice**
- OK `vim.lsp.handlers["textDocument/signatureHelp"]` is set to **Noice**
- OK `vim.lsp.handlers["window/showMessage"]` is set to **Noice**
- OK `vim.lsp.util.convert_input_to_markdown_lines` is set to **Noice**
- OK `vim.lsp.util.stylize_markdown` is set to **Noice**

Steps To Reproduce

  1. Hover the function which document has link.

Expected Behavior

The highlight function will remove escape sequences.

Repro

{
    "folke/noice.nvim",
    event = "VeryLazy",
    dependencies = {
      -- which key integration
      {
        "folke/which-key.nvim",
        opts = function(_, opts)
          if require("lazyvim.util").has("noice.nvim") then
            opts.defaults["<leader>sn"] = { name = "+noice" }
          end
        end,
      },
    },
    opts = {
      lsp = {
        override = {
          ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
          ["vim.lsp.util.stylize_markdown"] = true,
          ["cmp.entry.get_documentation"] = false,
        },
        signature = {
          enabled = true,
          auto_open = {
            luasnip = true,
          },
        },
      },
      presets = {
        bottom_search = true,
        command_palette = true,
        lsp_doc_border = true, -- add a border to hover docs and signature help
      },
    },
    -- stylua: ignore
    keys = {
      { "<c-f>", function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} },
      { "<c-b>", function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}},
    },
  },
@Bowser1704 Bowser1704 added the bug Something isn't working label May 6, 2023
@folke folke closed this as completed in a7246aa May 7, 2023
@Bowser1704
Copy link
Author

Bowser1704 commented May 8, 2023

@folke It seems that miss / charater in markdown special chars fixed by a7246aa is not the root cause.

The special chars in markdown are "\\`*_{}[]()#+-.!", so it's necessary to conceal only these chars. However, it also adds escape to this non-special chars "\"/<>&=;':" to the hover documentation, when I enable noice.nvim. So it resulting in a weird ui.

And the workaround should be define these special chars to local chars = "\\`*_{}[]()#+-.!\"/<>&=;':", but I don't think this is a elegant solution.

@Bowser1704
Copy link
Author

before:
image

after:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant