p00f / clangd_extensions.nvim

Clangd's off-spec features for neovim's LSP client. Use https://sr.ht/~p00f/clangd_extensions.nvim instead
MIT License
448 stars 16 forks source link

The icons can't show correctly in the terminal #24

Closed YangEfei closed 1 year ago

YangEfei commented 1 year ago

Hi there. I tried to use the example configuration in the README.md to active my extension. But it seems doesn't work. I can only get the command tip :ClangdSwitchHeader in my neovim.(I think it means nvim-lsconfig is working?) :ClangdAST, :ClangdTypeHierarchy and :ClangdMemoryUsage all return with

E492: Not an editor command: ...

In addition, I can't see the icons in role_icons and kind_icons, neither on the website nor in my neovim. Will this issue have an impact?

I'm a newbie to lua and I don't know what happened here... How can I fix it? Thanks a lot!

YangEfei commented 1 year ago

I can use it with this config:

local lspconfig_opts = {
  capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
  flags = {
    debounce_text_changes = 150,
  },
  on_attach = function(client, bufnr)
    -- disable format
    client.resolved_capabilities.document_formatting = false
    client.resolved_capabilities.document_range_formatting = false
    local function buf_set_keymap(...)
      vim.api.nvim_buf_set_keymap(bufnr, ...)
    end
    -- bind keymap
    require("keybindings").mapLSP(buf_set_keymap)
  end,
}

return {
  on_setup = function(server)
    local ok_rt, clangd_ext = pcall(require, "clangd_extensions")
    if not ok_rt then
      print("Failed to load clangd_extensions.")
      server.setup(lspconfig_opts)
    else
      clangd_ext.setup({
        server = lspconfig_opts,
      })
    end
  end
}

But the icons still can't see.(With some tags look like "?") How can I solve it? Thanks!

Badhi commented 1 year ago

It could be that your font doesn't support special characters. Maybe give a try with the fonts available in nerdfonts

Either way You can configure your own icons at config by checking the template configuration here and adding the needed once similar to the one shown in readme

YangEfei commented 1 year ago

I have tried with MesloLGLDZ Nerd Font and MelsoLGS NF which can support powerline in my server. But I still can't see the icon in configuration. I will try to use other icons change it in the template. Thanks a lot!

p00f commented 1 year ago

Try pasting the example configuration in your terminal to see if it is a font problem

YangEfei commented 1 year ago

Try pasting the example configuration in your terminal to see if it is a font problem

I have tried it. And still get some symbol like '?' in my terminal. And I try to copy some icon from the nerdfonts, they show correctly. So i feel so incomprehensible about it. But I don't know how to analysis it. image

And you can see that, other icons in my nvim window can show correctly, too. image

p00f commented 1 year ago

Then you can change the icons to the ones pasted from nerd font

Or use this font https://github.com/p00f/clangd_extensions.nvim/issues/7#issuecomment-1033428021

If you find some reasonable nerd font icons, can you post the configuration here?

YangEfei commented 1 year ago

OK, I will try to find reasonable nerd font icons for the configuration later.

p00f commented 1 year ago

Closing as this was a font issue

p00f commented 1 year ago

The default config now uses unicode icons which should be available in any font

https://www.unicode.org/charts/PDF/U1F100.pdf

https://github.com/p00f/clangd_extensions.nvim/commit/f2ca89d978f9fc907beb432a472a89fced7e10bd