ray-x / lsp_signature.nvim

LSP signature hint as you type
Apache License 2.0
1.98k stars 53 forks source link

[feat] Allow disabling in certain contexts, e.g. comments #310

Open fnune opened 4 months ago

fnune commented 4 months ago

image

In the screenshot above, I am writing a comment on my React component. lsp_signature is showing up because I'm within a JSX element and that's a function call. This is good, but could lsp_signature offer a way to disable itself in certain contexts?

For example, nvim-cmp can be configured like so:

    cmp.setup({
      enabled = function()
        local context = require("cmp.config.context")
        local is_prompt = vim.api.nvim_buf_get_option(0, "buftype") == "prompt"
        local is_comment = context.in_treesitter_capture("comment") or context.in_syntax_group("Comment")
        return not (is_prompt or is_comment)
      end,
    })

It would be nice to have a similar API in lsp_signature.

Thank you for your wonderful plugin :bow: