Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

No signature popup when cycling through snippet-based functions on Rust #192

Closed

Description

@archseer

It will show the docs for modules and structs, but functions are exposed as snippets in rust-analyzer. No docs are shown for these even though there is one available:

https://asciinema.org/a/s6RV6qw3fgweBAeFUsh9S9k4g

Activity

  1. changed the title [-]No signature popup when cycling throug snippet-based functions on Rust[/-] [+]No signature popup when cycling through snippet-based functions on Rust[/+] on Sep 4, 2020
  2. archseer commented on Sep 4, 2020

    @archseer
    Author

    Oh I guess I'm running into #29 ?

  3. haorenW1025 commented on Sep 4, 2020

    @haorenW1025
    Collaborator

    Maybe not #29? But that clearly seems as a bug to me. Is that rust-analyzer or rls?

  4. archseer commented on Sep 4, 2020

    @archseer
    Author

    It's rust-analyzer, I'll post my config later.

  5. archseer commented on Sep 4, 2020

    @archseer
    Author

    Here's my setup:

    let g:completion_docked_hover = 1
    
    packadd nvim-lsp
    packadd diagnostic-nvim
    packadd completion-nvim
    lua << EOF
    local nvim_lsp = require('nvim_lsp')
    local diagnostic = require('diagnostic')
    local completion = require('completion')
    
    local on_attach = function(_, bufnr)
      -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
      diagnostic.on_attach()
      completion.on_attach()
    end
    
    -- log_level = vim.lsp.protocol.MessageType.Trace;
    nvim_lsp.rust_analyzer.setup {
      on_attach = on_attach,
      settings = {
        capabilities = {
          textDocument = {
            completion = {
              completionItem = {
                snippetSupport = true
              }
            }
          }
        }
      }
    }
    
    EOF
    
    function! SetupLSP()
      setlocal omnifunc=v:lua.vim.lsp.omnifunc
      " keywordprg
      nnoremap <silent> gd    <cmd>lua vim.lsp.buf.declaration()<CR>
      nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
      " enter is go to definition
      nnoremap <silent> <CR>  <cmd>lua vim.lsp.buf.definition()<CR>
      nnoremap <silent> K     <cmd>lua vim.lsp.buf.hover()<CR>
      nnoremap <silent> gD    <cmd>lua vim.lsp.buf.implementation()<CR>
      nnoremap <silent> <c-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
      nnoremap <silent> 1gD   <cmd>lua vim.lsp.buf.type_definition()<CR>
      nnoremap <silent> gr    <cmd>lua vim.lsp.buf.references()<CR>
      nnoremap <silent> g0    <cmd>lua vim.lsp.buf.document_symbol()<CR>
      nnoremap <silent> ]d :NextDiagnosticCycle<CR>
      nnoremap <silent> [d :PrevDiagnosticCycle<CR>
      nnoremap <silent> <leader>do :OpenDiagnostic<CR>
      nnoremap <leader>dl <cmd>lua vim.lsp.util.show_line_diagnostics()<CR>
    endfunction
    
    augroup LSP
      au!
      au FileType rust call SetupLSP()
    augroup END
  6. haorenW1025 commented on Sep 6, 2020

    @haorenW1025
    Collaborator

    Ahh I guess I know what happens here. It's because completion-nvim send hover request under the cursor, but the items have snippets in it so lsp cannot recognize the request.. Let me think how can I tackle this issue...

  7. haorenW1025 commented on Sep 14, 2020

    @haorenW1025
    Collaborator

    @archseer Can you see if #208 fix your issue?

  8. haorenW1025 commented on Sep 15, 2020

    @haorenW1025
    Collaborator

    It should be fixed. Feel free to reopen if it still doesn't work.

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