Skip to content
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] Handle zero column diagnostic from OmniSharp #883

Merged
merged 1 commit into from
Dec 22, 2017

Conversation

micbou
Copy link
Collaborator

@micbou micbou commented Dec 6, 2017

The OmniSharp server sometimes incorrectly returns diagnostics with a column number of 0 while lines and columns are supposed to be 1-indexed. This causes the following error:

Traceback (most recent call last):
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\third_party\bottle\bottle.py", line 862, in _handle
    return route.call(**args)
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\third_party\bottle\bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\completers\cs\cs_completer.py", line 214, in OnFileReadyToParse
    self._diagnostic_store = DiagnosticsToDiagStructure( diagnostics )
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\completers\cs\cs_completer.py", line 611, in DiagnosticsToDiagStructure
    structure[ diagnostic.location_.filename_ ][
AttributeError: 'NoneType' object has no attribute 'filename_'

See ycm-core/YouCompleteMe#2846 (comment). We assume the column number is 1 in that case.


This change is Reviewable

@bstaletic
Copy link
Collaborator

:lgtm:


Reviewed 3 of 3 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

The OmniSharp server sometimes incorrectly returns diagnostics with the column
number sets to 0. Assume the column number is 1 in that case.
@micbou micbou force-pushed the cs-completer-zero-column-diagnostic branch from ee341a0 to 5c8ff8f Compare December 18, 2017 17:49
@codecov-io
Copy link

codecov-io commented Dec 18, 2017

Codecov Report

Merging #883 into master will decrease coverage by 0.28%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #883      +/-   ##
==========================================
- Coverage   94.97%   94.69%   -0.29%     
==========================================
  Files          79       41      -38     
  Lines        5457     4016    -1441     
  Branches      172        0     -172     
==========================================
- Hits         5183     3803    -1380     
+ Misses        226      213      -13     
+ Partials       48        0      -48

@puremourning
Copy link
Member

:lgtm: @zzbot r+


Reviewed 3 of 3 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@zzbot
Copy link
Contributor

zzbot commented Dec 21, 2017

📌 Commit 5c8ff8f has been approved by puremourning

@zzbot
Copy link
Contributor

zzbot commented Dec 22, 2017

⌛ Testing commit 5c8ff8f with merge 70ada92...

zzbot added a commit that referenced this pull request Dec 22, 2017
…remourning

[READY] Handle zero column diagnostic from OmniSharp

The OmniSharp server sometimes incorrectly returns diagnostics with a column number of 0 while lines and columns are supposed to be 1-indexed. This causes the following error:
```
Traceback (most recent call last):
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\third_party\bottle\bottle.py", line 862, in _handle
    return route.call(**args)
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\third_party\bottle\bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\completers\cs\cs_completer.py", line 214, in OnFileReadyToParse
    self._diagnostic_store = DiagnosticsToDiagStructure( diagnostics )
  File "C:\Users\micbou\projects\YouCompleteMe\third_party\ycmd\ycmd\..\ycmd\completers\cs\cs_completer.py", line 611, in DiagnosticsToDiagStructure
    structure[ diagnostic.location_.filename_ ][
AttributeError: 'NoneType' object has no attribute 'filename_'
```
See ycm-core/YouCompleteMe#2846 (comment). We assume the column number is 1 in that case.

<!-- 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/883)
<!-- Reviewable:end -->
@zzbot
Copy link
Contributor

zzbot commented Dec 22, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: puremourning
Pushing 70ada92 to master...

@zzbot zzbot merged commit 5c8ff8f into ycm-core:master Dec 22, 2017
@zzbot zzbot mentioned this pull request Dec 22, 2017
@micbou micbou deleted the cs-completer-zero-column-diagnostic branch December 26, 2017 11:40
zzbot added a commit to ycm-core/YouCompleteMe that referenced this pull request Feb 10, 2018
[READY] Update ycmd

Include the following changes:

 - PR ycm-core/ycmd#789: add support for Windows flags when --driver-mode=cl is given;
 - PR ycm-core/ycmd#848: hide C++ symbols by default;
 - PR ycm-core/ycmd#857: add Java support using jdt.ls;
 - PR ycm-core/ycmd#861: translate libclang error codes to exceptions;
 - PR ycm-core/ycmd#880: support downloading Clang binaries on ARM systems;
 - PR ycm-core/ycmd#883: handle zero column diagnostic from OmniSharp;
 - PR ycm-core/ycmd#884: specify Platform property when compiling OmniSharp;
 - PR ycm-core/ycmd#886: use current working directory in JavaScript completer;
 - PR ycm-core/ycmd#887: update Boost to 1.66.0;
 - PR ycm-core/ycmd#888: update JediHTTP;
 - PR ycm-core/ycmd#889: update Clang to 5.0.1;
 - PR ycm-core/ycmd#891: fix building with system libclang on Gentoo amd64;
 - PR ycm-core/ycmd#904: drop Python 2.6 and Python 3.3 support;
 - PR ycm-core/ycmd#905: calculate the start column when items are not resolved in the language server completer;
 - PR ycm-core/ycmd#912: download Clang binaries from HTTPS;
 - PR ycm-core/ycmd#914: do not try to symlink libclang on Windows.

<!-- 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/2902)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants