ray-x / lsp_signature.nvim

LSP signature hint as you type
Apache License 2.0
2.02k stars 57 forks source link

Random crashes when plugin is active #194

Closed qkzk closed 2 years ago

qkzk commented 2 years ago

Hello,

Neovim crashes when entering insert mode in a function. It only happens when the plugin is active and in Python. The logs don't show much, all I have is :

~/.cache/nvim/log

WARN  2022-06-29T18:49:36.462 97125 deadly_signal:177: got signal 1 (SIGHUP)

I can't find anything else in any logs...

Do you have any idea about that ?

ray-x commented 2 years ago

Is that randomly? Could you add the function prototype/signature and the code snippets when the crash happened? Also the neovim version as well. Btw, there are signature logs as well. In your config:

  debug = true, -- set to true to enable debug logging
  log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on
  -- default is  ~/.cache/nvim/lsp_signature.log
  verbose = true, -- show debug line number

TBH, I think it might be because LSP does not handle the signature requests properly.

Thanks!

qkzk commented 2 years ago

It's not random, it happens all the times when I call this method with lsp signature active :

Here is the method I was calling when neovim crashed :

    def register(self, module, *args, **kwargs):
        """
        Register a new module.

        :param module: Either a string module name, or a module class,
                       or a module instance (in which case args and kwargs are
                       invalid).
        :param kwargs: Settings for the module.
        :returns: module instance
        """
        from i3pystatus.text import Text

        if not module:
            return

        try:
            return self.modules.append(module, *args, **kwargs)
        except ImportError as import_error:
            if import_error.name and not import_error.path and isinstance(module, str):
                # This is a package/module not found exception raised by importing a module on-the-fly
                return self.modules.append(Text(
                    color="#FF0000",
                    text="{i3py_mod}: Missing Python module '{missing_module}'".format(
                        i3py_mod=module,
                        missing_module=import_error.name)))
            else:
                raise import_error
        except ConfigError as configuration_error:
            return self.modules.append(Text(
                color="#FF0000",
                text=configuration_error.message))

Here is the caller where the crash happened :

status.register(
    "disk",
    path="/",
    # format="{used}/{total}G [{avail}G]",)
    format=" ⛁ {avail}  GiB ",
)

The method comes from i3pystatus more precisely : here

I'm using Neovim 0.7.0-3 from Pacman (Manjaro with i3).

I was updating my setup since I'm on holiday :)

I'll look at the logs and try to reproduce.

ray-x commented 2 years ago

What is you python LSP?

image

I did not see crash.

qkzk commented 2 years ago

Nice theme :) It's pyright, which is fully updated :/

qkzk commented 2 years ago

I can't produce logs :/

here is how it's configured :

{
        "ray-x/lsp_signature.nvim",
        event = "BufRead",
        config = function()
            require "lsp_signature".setup({
                debug = true, -- set to true to enable debug logging
                log_path = "/home/quentin/.cache/lvim/lsp_signature.log", -- log dir when debug is on
                -- default is  ~/.cache/nvim/lsp_signature.log
                verbose = true, -- show debug line number
            })
        end
    }, -- function signature while inserting

And the autocommand :

    { "BufWinEnter",
        { pattern = { "*.py", "*.go", "*.rs", "*.js", "*.c" }, command = "lua require('lsp_signature').on_attach()", }, },

But no log is written to given file. As you can see I declared an absolute path and created the file with my user to be sure. The file stays empty.

I guess the problem is from lunarvim itself, since it quite an heavy configuration.

I have a new line in lsp.log everytime :

[WARN][2022-06-30 08:10:05] .../lua/vim/lsp.lua:812     "server_request: no handler found for"  "workspace/diagnostic/refresh"
ray-x commented 2 years ago

I am using pyright as well. The warn logs is fine. In lsp_signature/tests folder, there is a init_pack.lua , you can take a look and check if that config works for you. Also, neovim release version is currently 0.7.2. Worth an update.

qkzk commented 2 years ago

Hello,

Tried with last stable 0.7.2.0 and dev 0.8.xx version of Neovim and the crash still occurs.

Tried with a minimal setup and no crash so I guess it's a conflict somewhere in my config :/

Won't be easy to figure it out :)

qkzk commented 2 years ago

!!! Found it :)

It's the terminal emulator...

When I enter a function with no signature provided, lsp_signature displays an emoji :panda_face: For some reason, my terminal emulator (st) can't display it and crashes.

When I used Alacritty it didn't crash...

:) I guess I'll have to recompile st.

I thought about it since I tried to display the logs with less and it crashed... it didn't when I opened them with tail who skipped some of it.

qkzk commented 2 years ago

Well, I only had to install ttf_symbola to fix it. Ref

Thanks for the support ray-x :+1: was much appreciated

ray-x commented 2 years ago

I did not know nerdfont/emoji will crash the neovim. Will update the readme. Thanks for the update!