ray-x / lsp_signature.nvim

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

Snippets break by exiting select mode when lsp_signature shows #229

Closed ten3roberts closed 1 year ago

ten3roberts commented 1 year ago

The commit 7a1845e8b5fc68dc5ea2a1a7d2d2b04395b6b190 caused this behavior.

What happens is then a snippet (like the lsp function call snippet) is expanded, select mode is entered on the parameters.

When lsp_signature opens because we are in a function, it causes the mode to go back to insert mode, which exits the current node in the snippet. Jumping forwards and back in snippets still work, but each time the signature appears, the selected node is lost and you are placed in insert mode, which means you manually have to delete and type the placeholder text

Setup

  local lsp_signature = require "lsp_signature"
lsp_signature.setup {}

...

function on_attach()
  lsp_signature.on_attach {
    bind = true,
    max_height = 5,
    max_width = 20,
    hint_enable = false,
    -- hint_scheme = "String",
    zindex = 1,
    handler_opts = {
      border = border, -- double, single, shadow, none
    },
  }
end
ray-x commented 1 year ago

https://user-images.githubusercontent.com/1681295/200306694-036a55a7-d25a-464f-8b02-80f59a9ec279.mp4

Not quite sure I understand the issue you mentioned. The change you mentioned is only related to when the signature pops up with trigger key.

ten3roberts commented 1 year ago

Actual behavior

actual.webm

Expected

expected.webm

The issue occurs for rust-analyzer, sumneko_lua, and user snippets which expand to a function.

Removing the call to the lsp_signature.on_attach solves it.

ten3roberts commented 1 year ago

It seems that updating all plugins solved the issue, but neither LuaSnip nor lsp_signature was updated.

You can close this issue as it seems solved, though by what is unclear, and I do not know exactly everything that went into the plugin update. If anyone else stumbles upon this it can reopen