-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add float window for hover info #347
Conversation
autoload/lsp/ui/vim/float.vim
Outdated
let s:float_height = 0 | ||
|
||
function! s:reset() | ||
let s:data_buf = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use 4 spaces
autoload/lsp/ui/vim/hover.vim
Outdated
@@ -35,7 +35,11 @@ function! s:handle_hover(server, data) abort | |||
endif | |||
|
|||
if !empty(a:data['response']['result']) && !empty(a:data['response']['result']['contents']) | |||
call lsp#ui#vim#output#preview(a:data['response']['result']['contents']) | |||
if g:lsp_hover_win == "preview" || !has("nvim-0.4.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of checking version can we check if the function exists?
doc/vim-lsp.txt
Outdated
@@ -121,6 +122,12 @@ g:lsp_auto_enable *g:lsp_auto_enable* | |||
let g:lsp_auto_enable = 1 | |||
let g:lsp_auto_enable = 0 | |||
|
|||
g:lsp_hover_win *g:lsp_hover_win* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change this to g:lsp_hover_ui
?
doc/vim-lsp.txt
Outdated
@@ -121,6 +122,12 @@ g:lsp_auto_enable *g:lsp_auto_enable* | |||
let g:lsp_auto_enable = 1 | |||
let g:lsp_auto_enable = 0 | |||
|
|||
g:lsp_hover_win *g:lsp_hover_win* | |||
Type: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use array of string instead.
let g:lsp_hover_ui = ['float', 'preview']
This will allow us to have a consistent pattern when we support other ui.
Also would be good to have a screenshot or gifs. |
@prabirshrestha Thanks your review and I fix all. This is a screenshot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added few more comments.
Also would it be possible to implement syntax highlighting for the preview window for markdown snippets as in preview?
return | ||
for ui in g:lsp_hover_ui | ||
if ui == "float" | ||
if exists("*nvim_open_win") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we cache the exists('*nvim_open_win')
in script var?
if ui == "float" | ||
if exists("*nvim_open_win") | ||
call lsp#ui#vim#float#float_open(a:data['response']['result']['contents']) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we need to use echo ''
so that the message `Retrieving hover' gets removed for both float and preview.
Please refer to #395 instead. |
Add float window for hover info and default float win.