-
Notifications
You must be signed in to change notification settings - Fork 769
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
GetHoverResponse should handle null response from server. #1110
Conversation
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 you make a test for the case where the response to the hover request is null? You can take a look at ycmd/tests/language_server/
to get an idea how those are written.
However, all hover tests are currently written against the java server, which never returns null, hence why we currently don't handle null response. Anyway, ask for help if you are stuck.
Reviewed 1 of 1 files at r1.
Reviewable status: 0 of 2 LGTMs obtained
Codecov Report
@@ Coverage Diff @@
## master #1110 +/- ##
==========================================
- Coverage 97.59% 97.58% -0.02%
==========================================
Files 89 89
Lines 6988 6992 +4
==========================================
+ Hits 6820 6823 +3
- Misses 168 169 +1 |
Added tests for GetHoverResponse, both for null and non-null case. |
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.
Reviewed 1 of 1 files at r1, 1 of 1 files at r2.
Reviewable status: 0 of 2 LGTMs obtained (and 1 stale)
ycmd/completers/language_server/language_server_completer.py, line 1311 at r2 (raw file):
return result[ 'contents' ] raise RuntimeError( 'No hover information.' )
Unnecessary blank line.
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.
I also left a minor comment. Squashing the commits into one would also be appreciated.
Apart from that,
Reviewed 1 of 1 files at r2.
Reviewable status: 1 of 2 LGTMs obtained (and 1 stale)
ycmd/tests/language_server/language_server_completer_test.py, line 621 at r2 (raw file):
side_effect = [ { 'result': { 'contents': 'test' } } ] ): assert_that( completer.GetHoverResponse( request_data ), equal_to( 'test' )
Nose provides eq_
so this whole assert can be fit on one line.
from nose.tools import eq_
eq_(actual, expected)
Also the raises( RuntimeError )
can take an optional parameter to match the exception string. For example raises( RuntimeError, 'No hover information' )
. It might also be good to extract that string to a variable like it is done in ycmd/tests/bindings/cpp_bindings_raises_exception_test.py
.
c567755
to
e1a6e18
Compare
Addressed all the comments and squashed commits. |
Thanks for the PR. |
📌 Commit e1a6e18 has been approved by |
GetHoverResponse should handle null response from server. As mentioned in [Hover Request](https://microsoft.github.io/language-server-protocol/specification#textDocument_hover) ``` Response: result: Hover | null ``` Current implementation was failing with None object has no _getitem_ method, with this patch it will provide more useful information. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/1110) <!-- Reviewable:end -->
💔 Test failed - status-travis |
@zzbot retry |
GetHoverResponse should handle null response from server. As mentioned in [Hover Request](https://microsoft.github.io/language-server-protocol/specification#textDocument_hover) ``` Response: result: Hover | null ``` Current implementation was failing with None object has no _getitem_ method, with this patch it will provide more useful information. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/1110) <!-- Reviewable:end -->
☀️ Test successful - status-appveyor, status-travis |
[READY] Update ycmd Include the following changes: - PR ycm-core/ycmd#1075: remove Node.js workaround for Debian-based distributions; - PR ycm-core/ycmd#1077: update Boost to 1.68; - PR ycm-core/ycmd#1078: add semantic trigger for Julia; - PR ycm-core/ycmd#1081: improve type information on C++ member functions; - PR ycm-core/ycmd#1086: check if Python headers are installed before building; - PR ycm-core/ycmd#1088: raise proper exception for commands when file is still being parsed in C-family languages; - PR ycm-core/ycmd#1098: update Go completer; - PR ycm-core/ycmd#1099: update regex submodule; - PR ycm-core/ycmd#1100: add Python path to debugging information; - PR ycm-core/ycmd#1103: support framework headers completion and code navigation in C-family languages; - PR ycm-core/ycmd#1107: update Clang to 7.0.0; - PR ycm-core/ycmd#1109: update jdt.ls to 0.25.0; - PR ycm-core/ycmd#1110: handle null hover response from language servers; - PR ycm-core/ycmd#1111: update list of completion kinds defined by LSP; - PR ycm-core/ycmd#1113: send completion item kinds capability to language servers; - PR ycm-core/ycmd#1116: update Parso to 0.3.1 and Jedi to 0.13.1. Closes #3138. Closes #3145. <!-- 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/3175) <!-- Reviewable:end -->
As mentioned in Hover Request
Current implementation was failing with None object has no getitem method, with this patch it will provide more useful information.
This change is