-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[READY] Java support with asynchronous diagnostics and messages #2863
Conversation
2cc487c
to
c4840c8
Compare
Codecov Report
@@ Coverage Diff @@
## master #2863 +/- ##
==========================================
+ Coverage 92.33% 92.64% +0.31%
==========================================
Files 20 21 +1
Lines 1970 2054 +84
==========================================
+ Hits 1819 1903 +84
Misses 151 151 |
Reviewed 9 of 10 files at r1, 1 of 2 files at r3, 1 of 1 files at r4. README.md, line 3333 at r4 (raw file):
s/gradle-projec/gradle-project Probably my doing. autoload/youcompleteme.vim, line 64 at r4 (raw file):
What about other timers of other plugins? How were other plugins' timers not a roblem before? autoload/youcompleteme.vim, line 883 at r4 (raw file):
Wasn't this fxed in newer vim? python/ycm/buffer.py, line 76 at r4 (raw file):
When do we not care about diagnotics? python/ycm/vimsupport.py, line 264 at r4 (raw file):
Under what circumstances can buffer number be negative? python/ycm/vimsupport.py, line 270 at r4 (raw file):
What happens when the same buffer is open in multiple windows? python/ycm/youcompleteme.py, line 372 at r4 (raw file):
If I'm reading this correctly, currently we can't differentiate between a non-visible buffer and one that has not been opened. python/ycm/youcompleteme.py, line 388 at r4 (raw file):
Location list of the current buffer seems reasonable. Comments from Reviewable |
Review status: all files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. README.md, line 3333 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Done. I also fixed the missing eclipse project link :) autoload/youcompleteme.vim, line 64 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Well, yes. That's unfortunate, but I don't feel it's OK for us to go suspending other people's timers. If other people's timers break our stuff, then we can go and moan at them, and moan at vim-dev for the timer implementation causing such issues. For now, this is just a workaround so that our actual implementation isn't totally busted. It's worth pointing out that this is necessary particularly for the messages request timer, because it runs continuously. Many other timers are one-shot, or short lived. This one fires 10 times a second all the time, which triggers these sorts of glitches way more consistently.] TBH, this is a problem now, hence the bug reports that timers firing cause redraw and loss of command line/etc. info. autoload/youcompleteme.vim, line 883 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
No. At least not entirely. It is/was busted in a number of ways. There were a number of patches, but that didn't fix this particular issue. I'll raise a new issue on GitHub with an example of the confirmation diaglog problem. vim/vim#1844 As mentioned by Bram, we should actually probably consider changing all of these things to display in a buffer, rather than in the command line, but I don't see how we can make it work with the confirm dialog, etc. anyway. TBH the async messages shouldn't use the command line either, it's just a handy place to put them, as there is more work required to use a special scratch buffer (and that uses up quite a lot of screen space). python/ycm/buffer.py, line 76 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Yeah, when there are diagnostics in other project files. This is essentially making sure that any FileReadyToParse exceptions are displayed (such as messages we might from time to time encode there). python/ycm/vimsupport.py, line 264 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
I don't think it can, and there is no coverage in the tests of this, so I think I'm going to remove it. I suspect that winbufnr returns something sensible in that case anyway, so this is just dead code. python/ycm/vimsupport.py, line 270 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
python/ycm/youcompleteme.py, line 372 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Not opened = not in self._buffers (or at least that means we haven't triggered a FileReadyToParse event for it) That's why both are required. We need there to be a python/ycm/youcompleteme.py, line 388 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Yeah it does, but that's actually irksomely hard. As mentioned above what happens is something like:
We could:
As I said, I think there is a lot of improvement in this area, and this comment is like a big TODO for the future. I think initially I don't want to loose too much (more!) time trying to get this diagnostics system perfect, rather ship something working and iterate on it based on feedback/complaints/insults. Comments from Reviewable |
Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. README.md, line 3333 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
Yeah, I remember me unable to decide what should the Also, you forgot to push the fix. autoload/youcompleteme.vim, line 64 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
Just as I thought. autoload/youcompleteme.vim, line 883 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
I thought it was fixed in newer vim version... So the timers are still somewhat broken on Vim. That's nice. python/ycm/vimsupport.py, line 270 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
That sounds reasonable. python/ycm/youcompleteme.py, line 388 at r4 (raw file):
Alright, that sounds like a good idea, I too wish that we don't dag the too long.
Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. autoload/youcompleteme.vim, line 883 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Hmmm. I'm not able to trivially reproduce it anymore in a simple test, so perhaps there is something else afoot. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. autoload/youcompleteme.vim, line 883 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
OK I can't report on latest Vim. I will try on the minimum supported Vim that we declare. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. autoload/youcompleteme.vim, line 883 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
ROFL. In the min version we declare (v7.4.1578), timers don't work at all. Which means YCM doesn't work. I tested with the 16.04 LTS version (v7.4.1689) and timers do work, and generally these things are ok, but it's not perfect (see the linked issues etc.). Importantly, and this applied to all of our versions, our timer callback can call Comments from Reviewable |
3b57240
to
1f4c6f5
Compare
Reviewed 1 of 1 files at r5, 1 of 4 files at r6, 1 of 1 files at r7. autoload/youcompleteme.vim, line 883 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
Okay, thanks for looking into this. I'm fine with suspending timers, but every time I see us changing the vimscript part I think of the lack of tests there. Comments from Reviewable |
Didn't expect 99% coverage, good job, @puremourning! The only line not covered is in Review status: 10 of 12 files reviewed at latest revision, 2 unresolved discussions. Comments from Reviewable |
☔ The latest upstream changes (presumably #2866) made this pull request unmergeable. Please resolve the merge conflicts. |
1f4c6f5
to
1692c89
Compare
9b2a7d4
to
a33b609
Compare
Shouldn't the title be changed to (at least) Reviewed 2 of 4 files at r6, 1 of 2 files at r8, 1 of 1 files at r9, 1 of 1 files at r10, 6 of 6 files at r11. Comments from Reviewable |
Yes, this is ready for review. |
cool |
Review status: all files reviewed at latest revision, 3 unresolved discussions. autoload/youcompleteme.vim, line 47 at r1 (raw file):
This was originally 250ms. I was the one complaining that is too much because I assumed the delay in a simple project dignostics update I saw is because of this. I apologise for not giving this another, proper test. I've just tried using comparing 100ms with 250ms timer for messages and, as much as I don't like to admit this, I don't see ay difference. So we should probably make this timer fire every 250ms again. autoload/youcompleteme.vim, line 64 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
You've implemented Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. autoload/youcompleteme.vim, line 47 at r1 (raw file): Previously, bstaletic (Boris Staletic) wrote…
I haven't noticed any issues with 100ms. We still only have one outstanding actual poll request, so I think we can keep it like this. We can tweak it if there are performance or other issues. autoload/youcompleteme.vim, line 64 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
It was needed before, I just hadn't realised it yet. Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. autoload/youcompleteme.vim, line 47 at r1 (raw file): Previously, puremourning (Ben Jackson) wrote…
Alright, I'm fine with that. autoload/youcompleteme.vim, line 64 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
I thought so, just wanted to make sure. Comments from Reviewable |
Review status: all files reviewed at latest revision, 2 unresolved discussions. python/ycm/client/messages_request.py, line 86 at r11 (raw file):
This isn't working properly. I just hit a "Press enter to continue" when jdt.ls was building a gradle project. Comments from Reviewable |
Review status: all files reviewed at latest revision, 2 unresolved discussions. python/ycm/client/messages_request.py, line 86 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
I've successfully debugged Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. python/ycm/youcompleteme.py, line 388 at r4 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Considering that we've said that this is working, I'm inclined to sasy that this is . Comments from Reviewable |
Reviewed 9 of 10 files at r1, 1 of 1 files at r2, 3 of 4 files at r6, 6 of 6 files at r11. README.md, line 297 at r11 (raw file):
README.md, line 366 at r11 (raw file):
README.md, line 461 at r11 (raw file):
README.md, line 534 at r11 (raw file):
README.md, line 741 at r11 (raw file):
These instructions need to be updated. README.md, line 823 at r11 (raw file):
experimental README.md, line 1170 at r11 (raw file):
experimental README.md, line 1297 at r11 (raw file):
autoload/youcompleteme.vim, line 891 at r11 (raw file):
This is not doing what it's supposed to do. The python/ycm/vimsupport.py, line 260 at r7 (raw file):
python/ycm/client/messages_request.py, line 23 at r7 (raw file):
Those two lines should be replaced with
python/ycm/tests/mock_utils.py, line 113 at r7 (raw file):
python/ycm/tests/youcompleteme_test.py, line 672 at r2 (raw file):
asynchronous python/ycm/tests/youcompleteme_test.py, line 789 at r7 (raw file):
python/ycm/tests/youcompleteme_test.py, line 792 at r7 (raw file):
Superfluous Comments from Reviewable |
☔ The latest upstream changes (presumably #2902) made this pull request unmergeable. Please resolve the merge conflicts. |
This implements an asynchronous message system using a long-poll request to the server. The server provides an endpoint /receive_messages which blocks until either a timeout occurs or we receive a batch of asynchronous messages. We send this request asynchronously and poll it 4 times a second to see if we have received any messages. The messages may either be simply for display (such as startup progress) or diagnostics, which override the diagnostics returned by OnFileReqdyToParse. In the former case, we simply display the message, accepting that this might be overwritten by any other message (indeed, requiring this), and for the latter we fan out diagnostics to any open buffer for the file in question. Unfortunately, Vim has bugs related to timers when there is something displayed (such as a "confirm" prompt or other), so we suspend background timers when doing subcommands to avoid vim bugs. NOTE: This requires a new version of Vim (detected by the presence of the particular functions used).
a33b609
to
690a763
Compare
Review status: 5 of 11 files reviewed at latest revision, 15 unresolved discussions. README.md, line 297 at r11 (raw file): Previously, micbou wrote…
Done. README.md, line 366 at r11 (raw file): Previously, micbou wrote…
Done. README.md, line 461 at r11 (raw file): Previously, micbou wrote…
Done. README.md, line 534 at r11 (raw file): Previously, micbou wrote…
Done. README.md, line 741 at r11 (raw file): Previously, micbou wrote…
Done. README.md, line 823 at r11 (raw file): Previously, micbou wrote…
Done. README.md, line 1170 at r11 (raw file): Previously, micbou wrote…
Done. README.md, line 1297 at r11 (raw file): Previously, micbou wrote…
Done. autoload/youcompleteme.vim, line 891 at r11 (raw file): Previously, micbou wrote…
It seems that the major bug this was avoiding no longer happens on my current vim. The issue was that it cleared the screen when any timer fired, even if it didn't write to the screen. This made particularly FixIt unusable because it would clear the screen we open to offer suggested actions. i can no longer reproduce that, so i will remove the workaround. we can always invest the time (as i know you have been looking at it) in a better solution than python/ycm/vimsupport.py, line 260 at r7 (raw file): Previously, micbou wrote…
Done. python/ycm/client/messages_request.py, line 23 at r7 (raw file): Previously, micbou wrote…
Done. python/ycm/tests/mock_utils.py, line 113 at r7 (raw file): Previously, micbou wrote…
Done. python/ycm/tests/youcompleteme_test.py, line 672 at r2 (raw file): Previously, micbou wrote…
Done. python/ycm/tests/youcompleteme_test.py, line 789 at r7 (raw file): Previously, micbou wrote…
Done. python/ycm/tests/youcompleteme_test.py, line 792 at r7 (raw file): Previously, micbou wrote…
Done. Comments from Reviewable |
@zzbot r+ Reviewed 6 of 7 files at r12. Comments from Reviewable |
📌 Commit 690a763 has been approved by |
[READY] Java support with asynchronous diagnostics and messages # PR Prelude Thank you for working on YCM! :) **Please complete these steps and check these boxes (by putting an `x` inside the brackets) _before_ filing your PR:** - [x] I have read and understood YCM's [CONTRIBUTING][cont] document. - [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document. - [x] I have included tests for the changes in my PR. If not, I have included a rationale for why I haven't. - [x] **I understand my PR may be closed if it becomes obvious I didn't actually perform all of these steps.** # Why this change is necessary and useful This change is required for a better user experience when using native java support This implements an asynchronous message system using a long-poll request to the server. The server provides an endpoint /receive_messages which blocks until either a timeout occurs or we receive a batch of asynchronous messages. We send this request asynchronously and poll it 4 times a second to see if we have received any messages. The messages may either be simply for display (such as startup progress) or diagnostics, which override the diagnostics returned by OnFileReqdyToParse. In the former case, we simply display the message, accepting that this might be overwritten by any other message (indeed, requiring this), and for the latter we fan out diagnostics to any open buffer for the file in question. Unfortunately, Vim has bugs related to timers when there is something displayed (such as a "confirm" prompt or other), so we suspend background timers when doing subcommands to avoid vim bugs. NOTE: This requires a new version of Vim (detected by the presence of the particular functions used). NOT_READY because: - the submodule commit points at my repo and requires ycm-core/ycmd#857 to be merged - my spider sense suggest i have more testing to do... Notes: - Part 3 (I think) of the Java support PRs. This one actually adds the minimal changes for working java support - There are about 2 or 3 other PRs to come to add things like automatic module imports, etc. [Please explain **in detail** why the changes in this PR are needed.] [cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md [code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2863) <!-- Reviewable:end -->
☀️ Test successful - status-appveyor, status-travis |
PR Prelude
Thank you for working on YCM! :)
Please complete these steps and check these boxes (by putting an
x
insidethe brackets) before filing your PR:
rationale for why I haven't.
actually perform all of these steps.
Why this change is necessary and useful
This change is required for a better user experience when using native
java support
This implements an asynchronous message system using a long-poll request
to the server.
The server provides an endpoint /receive_messages which blocks until
either a timeout occurs or we receive a batch of asynchronous messages.
We send this request asynchronously and poll it 4 times a second to see
if we have received any messages.
The messages may either be simply for display (such as startup progress)
or diagnostics, which override the diagnostics returned by
OnFileReqdyToParse.
In the former case, we simply display the message, accepting that this
might be overwritten by any other message (indeed, requiring this), and
for the latter we fan out diagnostics to any open buffer for the file in
question.
Unfortunately, Vim has bugs related to timers when there is something
displayed (such as a "confirm" prompt or other), so we suspend
background timers when doing subcommands to avoid vim bugs. NOTE: This
requires a new version of Vim (detected by the presence of the
particular functions used).
NOT_READY because:
Notes:
[Please explain in detail why the changes in this PR are needed.]
This change is