Giter Site home page Giter Site logo

Comments (20)

clason avatar clason commented on May 18, 2024

Your Neovim version is much too old. Please test the latest nightly.

from neovim.

zeertzjq avatar zeertzjq commented on May 18, 2024

Not an Nvim issue. The hover content comes from the language server and the highlights are provided by your colorscheme.

from neovim.

HalmondD avatar HalmondD commented on May 18, 2024

No it seem that the colorscheme is not the issue here, I change it from dracula to catppuccin - which a very popular colorscheme and you tell me that it does not have the syntax highlight for vim.lsp.buf.hover?

from neovim.

clason avatar clason commented on May 18, 2024

Who knows; we don't maintain these. (There's a reason the issue template requests reproduction steps with nvim --clean.)

from neovim.

HalmondD avatar HalmondD commented on May 18, 2024

And how I can I do that step, can you guide me please?

from neovim.

clason avatar clason commented on May 18, 2024

https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#reporting-problems

from neovim.

HalmondD avatar HalmondD commented on May 18, 2024

Continue this thread, I have gone to the clangd issue and have some progress:
After reading the lsp.log, they find out that:

  • clangd is indeed sending plain-text hover information instead of markdown
  • the reason for this in turn is that the client does not indicate support for markdown in its client capabilities

So the first conclusion is that this is the client issue.

and after extracting the lsp.log, they say this.

Here is my lsp capabilities and attatch:

local lsp_servers = {
  'clangd',
  'lua_ls',
}


local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
if not lspconfig_status_ok then
	return
end

local my_on_attatch = function(client)
  -- function lsp_highlight_document
  if client.server_capabilities.documentHighlight then
    vim.api.nvim_exec(
      [[
      augroup lsp_document_highlight
        autocmd! * <buffer>
        autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
        autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
      augroup END
    ]],
      false
    )
  end

  client.server_capabilities.documentFormattingProvider = true

  -- import lsp_keymaps function
  require('user.configs.nvim_keymap').lsp_keymaps()
end

local my_capabilities = {
  require('cmp_nvim_lsp').default_capabilities(),
}

for _, lsp_server in pairs(lsp_servers) do
	local opts = {
		on_attach = my_on_attatch,
    capabilities = my_capabilities,
	}

	lsp_server = vim.split(lsp_server, "@")[1]

	local require_ok, conf_opts = pcall(require, "user.configs.plugin_lsp.settings." .. lsp_server)
	if require_ok then
		opts = vim.tbl_deep_extend("force", conf_opts, opts)
	end

	lspconfig[lsp_server].setup(opts)
end

vim.lsp.set_log_level("DEBUG")

My apologize, gently ping @clason.

from neovim.

clason avatar clason commented on May 18, 2024

Please try the latest development version; the hover support has been extensively rewritten.

from neovim.

HalmondD avatar HalmondD commented on May 18, 2024

Ok I change my nvim to 0.9.5, if this is not the version you want me to change to please tell me, here is the lsp.log.

from neovim.

clason avatar clason commented on May 18, 2024

I meant the latest nightly (which you can download as an appimage from our releases page).

from neovim.

HalmondD avatar HalmondD commented on May 18, 2024

NVIM v0.10.0-dev-2427+geb4783fb6
Build type: RelWithDebInfo
LuaJIT 2.1.1707061634

this one?

from neovim.

clason avatar clason commented on May 18, 2024

Yes.

from neovim.

HalmondD avatar HalmondD commented on May 18, 2024

Here is the lsp.log for nvim 0.10.0 nightly. The hover still don't work on this version.

from neovim.

clason avatar clason commented on May 18, 2024

Works for me. So please create a minimal reproducible example (without plugins) I can test with nvim --clean -u test.lua together with a C file.

from neovim.

clason avatar clason commented on May 18, 2024

And your log is full of ERRORs; I'd recommend looking at and fixing those first.

from neovim.

HighCommander4 avatar HighCommander4 commented on May 18, 2024

Here is the lsp.log for nvim 0.10.0 nightly. The hover still don't work on this version.

The log still shows the client sending broken client capabilities.

I'm pretty sure the issue is related to the lines mentioning capabilities in your config.

from neovim.

HalmondD avatar HalmondD commented on May 18, 2024

Ok the issue fix somewhat thanks to @HighCommander4, I change:

local my_capabilities = {
  require('cmp_nvim_lsp').default_capabilities(),
}

to:

local my_capabilities = require('cmp_nvim_lsp').default_capabilities()

but the format not the syntax color still don't work like I want:
The hover still don't show any comment of the function, it did have syntax highlight but it should have more information like the next image. This only happen when I'm in main.c.
image

Like this, this is when I'm in the file the function is define:
image

However it should separate the @param and the brief comment of the function. Something like how the vscode is showing:
image

The function it self:

/*
 * The function creates a GPIO driver object and initializes it with the specified device driver.
 *
 * @param dev_driver The dev_driver parameter is a pointer to a structure of type gpio_dt_spec. This
 * structure contains the necessary information for initializing the GPIO driver, such as pin
 * configurations and other settings.
 *  
 * @return a pointer to a gpio_driver_t structure.
 */
gpio_driver_t *GPIO_DRIVER_Create(const struct gpio_dt_spec *dev_driver){
    gpio_driver_t *dev = malloc(sizeof(gpio_driver_t));
    dev->driver = dev_driver;
    if (dev != NULL)
    {
        GPIO_DRIVER_Init(dev, GPIO_CONFIG_Input, GPIO_CONFIG_Output,
                    GPIO_SET, GPIO_RESET);
    }
    return dev;
}

Here is the lsp.log.

from neovim.

clason avatar clason commented on May 18, 2024

Works for me:

Screenshot 2024-02-23 at 10 08 53

Again, your setup is broken, as your log clearly shows. Clangd needs a project database to get cross-file information.

And we don't care what VS Code does; we implement the LSP specification, and nothing else.

from neovim.

HalmondD avatar HalmondD commented on May 18, 2024

Thanks clason for your help.

from neovim.

HighCommander4 avatar HighCommander4 commented on May 18, 2024

However it should separate the @param and the brief comment of the function. Something like how the vscode is showing:

This part is a missing feature in clangd (parsing doxygen the way vscode's default c++ language server does it). We have clangd/clangd#529 on file about it.

from neovim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.