feat(lsp): signature help (manually triggered) (#15233)

# Description

To check for missing parameters

<img width="417" alt="image"
src="https://github.com/user-attachments/assets/5e2a8356-5fd9-4d15-8ae6-08321f9d6e0b"
/>

# User-Facing Changes

For other languages, the help request can be triggered by the `(`
character of the function call.
Editors like nvim refuse to set the trigger character to space, and
space is probably way too common for that.

So this kind of request has to be triggered manually for now.
example of nvim config:

```lua
vim.api.nvim_create_autocmd("FileType", {
  pattern = "nu",
  callback = function(event)
    vim.bo[event.buf].commentstring = "# %s"
    vim.api.nvim_buf_set_keymap(event.buf, "i", "<C-f>", "", {
      callback = function()
        vim.lsp.buf.signature_help()
      end,
    })
  end,
})
```

# Tests + Formatting

+2

# After Submitting
This commit is contained in:
zc he
2025-03-03 20:54:42 +08:00
committed by GitHub
parent 8e1385417e
commit fc72aa6abe
4 changed files with 375 additions and 24 deletions

View File

@ -325,8 +325,8 @@ impl NuCompleter {
// unfinished argument completion for commands
match &element_expression.expr {
Expr::Call(call) => {
// TODO: the argument to complete won't necessarily be the last one in the future
// for lsp completion, we won't trim the text,
// NOTE: the argument to complete is not necessarily the last one
// for lsp completion, we don't trim the text,
// so that `def`s after pos can be completed
for arg in call.arguments.iter() {
let span = arg.span();