Skip to content

Python function signture does not work! #783

Description

@davegreeko2023

I really liked kickstart and I am trying to migrate from LazyVim but things did not work 100% for Python Auto completion.
I simply enabled the pyright language server as follow

pyright ={}

Python auto-completion worked just fine except for function signatures. No information about arguments. The same nvim on the same machine (Debian 12) with LazyVim, function signatures and arguments details worked as expected. I wonder if I am missing something here.

Regards,

Activity

  1. nhld commented on Mar 21, 2024

    @nhld
    Contributor

    Hi, LazyVim uses noice.nvim to trigger signature help automatically, I believe. Kickstart does not use it. You can either add the plugin or add a keymap to trigger it.

  2. davegreeko2023 commented on Mar 21, 2024

    @davegreeko2023
    Author

    Thank you @nhld
    Anyone knows how to trigger it? If I were to install noice.nvim, I might as well stay with LazyVim. Without function signature, a code completion feature is 50% ready
    Thanks!

  3. nhld commented on Mar 21, 2024

    @nhld
    Contributor

    Add this keymap:

    vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, { buffer = event.buf, desc = 'Signature Documentation' })

    This is where you should put it:

       vim.api.nvim_create_autocmd('LspAttach', {
            group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
            callback = function(event)
              
              vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, { buffer = event.buf, desc = 'Signature Documentation' })
              
              -- NOTE: Remember that lua is a real programming language, and as such it is possible
              -- to define small helper and utility functions so you don't have to repeat yourself
              -- many times.
              --
              -- In this case, we create a function that lets us more easily define mappings specific
              -- for LSP related items. It sets the mode, buffer and description for us each time.
    
              local map = function(keys, func, desc)
                vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
              end
    
    

    <C-k> will show the signature doc in insert mode.

  4. davegreeko2023 commented on Mar 21, 2024

    @davegreeko2023
    Author

    Thank you so much @nhld It worked but apparently to keep it floating while typing the arguments takes some work especially when highlighting the active argument only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions