Open Shatur opened 4 years ago
I was tried using wantDiagnostics
but It seems not to effect to behavior that we want.
But I think we should have ability to modify all payload via extension side so I leave this issue.
I was tried using wantDiagnostics but It seems not to effect to behavior that we want it.
Bad to hear :( Sometimes I need to reload the file to trigger diagnostics to reload.
What do you think about following command?
"
" reload_document
"
command! ReloadDocument call s:reload_document()
function! s:reload_document()
let l:bufnr = bufnr('%')
let l:bufname = bufname(l:bufnr)
enew
let l:temp_bufnr = bufnr('%')
try
execute printf('%sbdelete!', l:bufnr)
catch /.*/
endtry
execute printf('edit! %s', fnameescape(l:bufname))
try
execute printf('%sbdelete!', l:temp_bufnr)
catch /.*/
endtry
endfunction
Sorry, I don't want to include for vim-lamp as much as possible the feature that does not relate the LSP.
Thank you, I will use it. Unfortunately, this also reloads the syntax highlighting, but this is better than reloading the document manually...
Sorry, I don't want to include for vim-lamp as much as possible the feature that does not relate the LSP.
Of course, it's completely okay. It's just clangd
problem. Now I trying to figure out how QtCreator deal with it. It works perfectly, I even do not need to save header file on disk.
OK. I will try to implement reloading document completely with refactor.
I found the workaround that more convenient than the currently proposed one.
command! TouchDocument call s:touch_document()
function! s:touch_document() abort
let l:bufnr = bufnr('%')
for l:server in lamp#server#registry#find_by_filetype(&filetype)
call l:server.notify('textDocument/didChange', {
\ 'textDocument': lamp#protocol#document#versioned_identifier(l:bufnr),
\ 'contentChanges': []
\ })
endfor
endfunction
NOTE: Working this workaround is dependent to clangd implementation.
I found the workaround that more convenient than the currently proposed one.
Thank you a lot! Will use it.
I will try to implement reloading document completely with refactor.
I think that the solution above will be enough.
Sorry for stupid question, but can the issue caused by missing support workspace/didChangeWatchedFiles
?
I think workspace/didChangeWatchedFiles
does not relate to the problem.
Because probably VSCode has supported the feature but the problem exists.
@hrsh7th, anyway, thanks for the TouchDocument
:)
Because probably VSCode has supported the feature but the problem exists.
Yes, you are right...
I thinking we implement automatic document touch feature in vim-lamp-extension is nice (until the clangd's diagnostics will improved)
It would be nice, I think that here is the best place for such things.
I just discovered that
clangd
have custom wantDiagnostics property intextDocument/didChange
. Could you add an option to sendtextDocument/didChange
withwantDiagnostics
set totrue
on buffer change? I think it how QtCreator works. This could solve https://github.com/hrsh7th/vim-lamp/issues/23. It would be very cool improvement for C/C++ developers. I posted it here because this property is extension. I understand that this plugin currently not implemented, but just for the future.