ray-x / lsp_signature.nvim

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

Prevent lsp_signature automatically appearing? #220

Closed AlexSWall closed 2 years ago

AlexSWall commented 2 years ago

Is there a way to prevent the window appearing by default, and instead simply having it appear when desired?

I have a keybinding for toggling it, but I cannot work out how to prevent it automatically appearing.

ray-x commented 2 years ago

There is a toggle setup you can check if it works for you.

AlexSWall commented 2 years ago

I have been using toggle_key to close and re-open it, but this doesn't prevent it appearing. I cannot find anything else referring to toggling, so not sure whether this is what you meant by 'toggle setup'?

ray-x commented 2 years ago

you can check this thread: https://github.com/ray-x/lsp_signature.nvim/issues/140

AlexSWall commented 2 years ago

I believe this is referring to setting floating_window = False, which allows one to toggle whether lsp_signature's popup is enabled but this persists between different signature popup opportunities; if you enable it for one, it keeps popping up until you disable it.

For example, I never ever want it to appear by default, but if I'm typing in a function call the parameters and want to see documentation, I'd like to hit a key combination for the signature to display, just to disappear again once I start typing and not come back until I request it to again. Else it is defaulting to hiding nearby code that I may need to see.

It seems this indeed may not be available functionality? If a PR is required to add this behaviour, if you could point me in the right direction I could give it a go.

(Also, I think the behaviour of the floating_window option is not as I'd expect, maybe it could do with a rename. Perhaps a little unideal now that it's already in use by people though.)

ray-x commented 2 years ago

If you set floating_window = false You still can add keybinding nmap <c-k> <cmd>lua vim.lsp.buf.signature_help()<CR>

AlexSWall commented 2 years ago

Ah, you're right, thanks for this! Works as desired. I think the documentation could be slightly improved but hopefully anyone running into a similar issue will come across this Issue.