iamcco / coc-vimlsp

viml language server
216 stars 7 forks source link

No hover information #4

Closed YosufE closed 5 years ago

YosufE commented 5 years ago

I am having Troubles with the hover informations. Followed installation instructions, but it still doesnt want to work like in this screenshot: https://user-images.githubusercontent.com/5492542/57384333-019b9880-71e3-11e9-9ee8-7e731944777b.png What am i doing wrong? Here are my files minimal init.vim: ` call plug#begin()

" Autocomplete Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} Plug 'Shougo/neco-vim' Plug 'neoclide/coc-neco'

call plug#end()

" coc Settings and Plugins let g:coc_global_extensions=[ 'coc-snippets', 'coc-ultisnips', 'coc-neosnippet', 'coc-python', 'coc-json', 'coc-tsserver', 'coc-vimtex', 'coc-html', 'coc-phpls', 'coc-solargraph', 'coc-rls', 'coc-r-lsp', 'coc-git', 'coc-fsharp', 'coc-angular', 'coc-vimlsp', 'coc-omnisharp' ]

set completeopt=noinsert,noselect,menuone

" Show signature help while editing autocmd CursorHoldI * silent! call CocAction('showSignatureHelp')

" Highlight symbol under cursor on CursorHold autocmd CursorHold * silent call CocActionAsync('highlight')

function! s:show_documentation() if &filetype == 'vim' execute 'h '.expand('') else call CocAction('doHover') endif endfunction

augroup mygroup autocmd! " Setup formatexpr specified filetype(s). autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') " Update signature help on jump placeholder autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end

let g:markdown_fenced_languages = [ \ 'vim', \ 'help' ]

" use for trigger completion inoremap coc#refresh()

" Navigate through completion with Tab / Shift-Tab inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\"

" Complete snippet with Enter inoremap pumvisible() ? coc#_select_confirm() : \"\u\\=coc#on_enter()\"

" Remap for rename current word nmap rn (coc-rename)

" Remap keys for gotos nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references)

" Use K for show documentation in preview window nnoremap T :call show_documentation() `

minimal coc-settings.json:

` { "languageserver": { "digestif": { "command": "digestif", "filetypes": ["tex", "plaintex", "context"] } },

"vimlsp.debug": {
  "type": "boolean",
  "default": false,
  "description": "enable coc-vimlsp service debug"
},
"vimlsp.diagnostic.enable": {
  "type": "boolean",
  "default": true,
  "description": "enable diagnostic"
},
"vimlsp.trace.server": {
  "type": "string",
  "default": "off",
  "enum": [
    "off",
    "messages",
    "verbose"
  ],
  "description": "Trace level of vim language server"
}

} `

sorry for the bad formatting i dont know why its like that

iamcco commented 5 years ago

The screenshot is signature help not hover document.

remove

Plug 'Shougo/neco-vim'
Plug 'neoclide/coc-neco'

if you want to use hover document, modify your s:show_documentation function to use lsp.

bratekarate commented 4 years ago

Can you please elaborate what you mean with modyfying the function? What is the right way to make use of vimlsp hover? I tried the following:

function! s:CocShowDocumentation()
    call CocAction('doHover')
endfunction

It does not work.

:CocInfo output for the hover request:

[Trace - 6:22:16 PM] Sending request 'textDocument/hover - (3)'.
Params: {
    "textDocument": {
        "uri": "file:///home/flex/.config/vim/vimrc"
    },
    "position": {
        "line": 18,
        "character": 3
    }
}

[Trace - 6:22:16 PM] Received response 'textDocument/hover - (3)' in 2ms.
Result: {
    "contents": {
        "kind": "markdown",
        "value": "```help\n{feature} argument is a feature name like \"nvim-0.2.1\" or\n\"win32\", see below.  See also |exists()|.\n\nVim's compile-time feature-names (prefixed with \"+\") are not\nrecognized because Nvim is always compiled with all possible\nfeatures. |feature-compile| \n\nFeature names can be:\n1.  Nvim version. For example the \"nvim-0.2.1\" feature means\n    that Nvim is version 0.2.1 or later: >\n  :if has(\"nvim-0.2.1\")\n\n<    2.  Runtime condition or other pseudo-feature. For example the\n    \"win32\" feature checks if the current system is Windows: >\n  :if has(\"win32\")\n<              *feature-list*\n    List of supported pseudo-feature names:\n        acl    |ACL| support\n  bsd    BSD system (not macOS, use \"mac\" for that).\n        iconv    Can use |iconv()| for conversion.\n        +shellslash  Can use backslashes in filenames (Windows)\n  clipboard  |clipboard| provider is available.\n  mac    MacOS system.\n  nvim    This is Nvim.\n  python2    Legacy Vim |python2| interface. |has-python|\n  python3    Legacy Vim |python3| interface. |has-python|\n  pythonx    Legacy Vim |python_x| interface. |has-pythonx|\n  ttyin    input is a terminal (tty)\n  ttyout    output is a terminal (tty)\n  unix    Unix system.\n  *vim_starting*  True during |startup|. \n  win32    Windows system (32 or 64 bit).\n  win64    Windows system (64 bit).\n  wsl    WSL (Windows Subsystem for Linux) system\n\n          *has-patch*\n3.  Vim patch. For example the \"patch123\" feature means that\n    Vim patch 123 at the current |v:version| was included: >\n  :if v:version > 602 || v:version == 602 && has(\"patch148\")\n\n<    4.  Vim version. For example the \"patch-7.4.237\" feature means\n    that Nvim is Vim-compatible to version 7.4.237 or later. >\n  :if has(\"patch-7.4.237\")\n\n```"
    }
}

So there is a response, but it seems to be a bug with the hover display. Or if it's not a bug, what is configured wrong? Hovers of other langauge servers work for me.

iamcco commented 4 years ago

Make sure your neovim or vim support floating windows.

bratekarate commented 4 years ago

My neovim supports floating windows. I never said floating windows are an issue. This issue is only about onHover with coc-vimlsp

I tried to disable floating windows with "coc.preferences.hoverTarget": "echo". Same result, nothing happens only with vimlsp.

Is my ShowDocumentation function right? Can you compare it with the configuration used to make the screenshots?

Edit: The issue occurs only with the latest coc version (release). I downgraded to coc v0.0.78 and it works. Should I rather create an issue there?

iamcco commented 4 years ago

I see, it send the hover document request and receive response but the document window do not show. seems coc.nvim have change something.

iamcco commented 4 years ago

I have create a new issue https://github.com/iamcco/coc-vimlsp/issues/20, and will update info there.

bratekarate commented 4 years ago

Thank you for checking on this issue. Really like to use coc-vimlsp, all other features work great.

Edit: wow, already fixed? Thanks, did not expect that!