Closed Shatur closed 4 years ago
It's possible but I want to fix the problem...
It is most difficult critical bug of the vim-lamp
now.
@Shatur95 Currently, vim-lamp has an incremental diff feature that improves performance but I doubt the reason for the problem is it... maybe.
So I introduce the flag to toggle the feature. Could you test to reproduce the problem with temporarily disable it?
Could you test with let g:lamp_experimental_passthrough_diagnostics = v:true
?
When the flags turns on, you get a bit ugly behavior but it needs to investigate sorry...
Good idea! I will try to provide minimal reproducible example and test new diagnostics feature.
If you like a new feature than an old feature, please tell me it.
I don't know the best visualization for the diagnostics.
What difference between v:true
and v:false
for g:lamp_experimental_passthrough_diagnostics
?
I tested with and without incremental feature. The problem still exits.
I found minimal reproducible example:
compile_commands.json
:mkdir build
cd build
cmake -D CMAKE_EXPORT_COMPILE_COMMANDS ..
cp compile_commands.json ..
(you will have compile_commands.json
in project code directory. I use a plugin for automation but I decided do describe manual steps)
clangd
in vim-lamp
.keyboarddaemon.h
and create the following function void test()
keyboarddaemon.cpp
and create the following definition void KeyboardDaemon() {}
Expected behavior
No errors detected.
Actual behavior
Diagnostics say that the function does not exists even after :wa
.
Video In this video I created function, but diagnostics updated only after a long time. In all IDE's diagnostics updated immediately even without save.
Sorry, the experimental flags are checked existence only.
Thank you for create repro steps. I try to run cmake but it failed on my mac. I will try to check on any Linux environment.
To prepare the Linux environment take time So I try to detect the cause by removing updating condition for diagnostics
one by one...
I was remove one condition for now on the master branch.
My suspicion points are
Bug of diff computing algorithm
Bug of condition for updating/skipping diagnostics
I try to run cmake but it failed on my mac. I will try to check on any Linux environment.
Sorry, I did now know that you use Mac. Provided program is Linux-only. Try the following minimal example (try to create void test2()
function in keyboarddaemon.h
and it implementation in keyboarddaemon.h
):
Sample.zip
I try to detect the cause by removing updating condition for diagnostics one by one...
Just tested latest master, have the same issue. But why remove? I thought that new condition should be added. The diagnostics just not updated properly after creating function definition. I think in is because of different files. If I will create definition in the same file (C++ have such possibility) - everything works.
My suspicion points are
I agree. I think that there is two problems. Currently I did not encountered the diff bug. But the repro example shows that diagnostics do not updated with different files.
Could you explain what is passthrough mode?
Thank you for Sample.zip! I try to reproduce it!
The diagnostics feature is too difficult.
text changes
to the server per press key.typically
computes diagnostics every text changes
and send it to client.For example, vim-lamp skip or debounce diagnostics when these cases.
So I suspect the cause is in these conditions.
Could you explain what is passthrough mode?
Passthrough mode is removing the some above conditions on diagnostics feature.
Thanks for explanations!
Yes, I tested with passthrough mode and the issue still exists.
vim-lsp
also have the same bug.
Thank you for your investigate.
Oh... If vim-lsp has the same problem, this problem caused by the server maybe.
Anyway, I'll try to detect the cause with your example project!
Thanks for looking into it!
Unfortunately, It seems the clangd's problem. I searching to solve this on the clangd's issue tracker.
Bad to hear :( Other IDE's that use clangd
do not have this issue.
Hm... I try to check with coc.nvim temporary but it has same problem...
I try again with VSCode.
VSCode has same issue...
Let me check it myself :)
Yes, thanks!
FYI: I used vscode-clangd
.
Currently, My thoughts are
Wow, you are right. Only QtCreator works with this correctly (without save). But VSCode updates this file immediately after "Save all" and typing any symbol. Maybe is it possible to at least achieve something similar?
Yes, I think that my and your problems is different. If I reproduce your problem with minimal example - I will let you know.
Anyway, I re-enable diagnostics and incremental diff. when you met the problem, please tell me it.
And I try to check the ccls.
Did I understand correctly that incremental diff is now enabled by default and "Passthrough mode" is disabled by default?
Yes. You are right.
Sorry. I've updated it now
. 🙇
Thanks! Is it possible to to fix diagnostics at least after saving all files as in VSCode?
I try it.
I guess VSCode sent didChange
on save (if the server does not support textDocumentSync.save
capability.
It would be awesome. In C++ is very common to use a lot of different files :)
Any differences with and without this fix :( Diagnostics becomes updated only after several time.
In this video I used small helper command that just creates implementation in .cpp
. But the issue occurs even with manual editing.
Sorry. Probably I'm misunderstood your mean.
I just implemented updating diagnostics at saving the buffer.
Is the following feature you want?
*.cpp
file and *.h
file.*.h
file (And the edit occurs error on *.cpp
.*.cpp
.*.cpp
diagnostics.If so, I can implement it (But it is not general implementation, I think).
Yes, it would be just awesome. But if this is a bit hacky I would suggest to just add the ability to update manually reload diagnostics. This would also help to debug your issue.
I've added experimental.did_change_on_focus
option.
Please test it.
Sorry, but how can I enable it?
Sorry. You can enable it by lamp#config('experimental.did_change_on_focus', v:true)
on lamp#initialized autocmd.
I try to use this feature more.
Hm... I experienced another issue: After swathing between header / cpp completion sometimes stop to working. I tested previous commits (via checkout) and the issue still exits.
This is another issue that related with recent changes. I found a way how to reproduce it:
void
.Thanks, tested, but still not works :(
Very strange... My environment works well...
This is another issue that related with recent changes. I found a way how to reproduce it:
Open .cpp file. You will have completion. Go to the end of file and type void. Delete it. Completion from LSP stop working. Video:
It is reproduced on my machine. It seems bug of lamp's diff algorithm. It is difficult to fix but I try it.
Very strange... My environment works well...
Okay, I will try without any plugins.
It is reproduced on my machine. It seems bug of lamp's diff algorithm. It is difficult to fix but I try it.
At least it reproduced :D
16:43:16 clangd -> [NOTIFY] {'method': 'textDocument/didChange', 'params': {'contentChanges': [{'range': {'end': {'character': 0, 'line': 12}, 'start': {'character': 0, 'line': 12}}, 'text': ' ', 'rangeLength': 0}], 'textDocument': {'uri': 'file:///path/to/Sample/keyboarddaemon.cpp', 'version': 5}}}
16:43:16 clangd [STDERR] I[16:43:16.873] <-- textDocument/didChange E[16:43:16.874] Failed to update /path/to/Sample/keyboarddaemon.cpp: Line value is out of range (12)
Probably end of line diff was broken.
Sometimes diagnostics are not properly updated. It would be nice to have the ability to trigger diagnostics update manually. Is it possible to implement?