You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ycmd commit is a12a0a3 on mac, but also happens with older 2e62515
This might be a libclang bug, but with a source file with errors such as this, the location_extent values for all diagnostics are zeros.
classA {
A() // my 'missing semicolon' location_extent is wrong
};
i_ruin_everything // i'm the stinker line that causes all the location_extent problemsA::A() {
}
another_error // my location_extent is wrong, too
[READY] Fix empty location extent after missing semicolon
We currently use the following (convoluted) method to compute the location extent of a diagnostic i.e. the range of the identifier where the diagnostic occurred:
- obtain a range from [the `clang_getCursorExtent` function](https://clang.llvm.org/doxygen/group__CINDEX__CURSOR__SOURCE.html#ga79f6544534ab73c78a8494c4c0bc2840), which is supposed to contain our identifier;
- extract all the tokens from that range with [`clang_tokenize`](https://clang.llvm.org/doxygen/group__CINDEX__LEX.html#ga6b315a71102d4f6c95eb68894a3bda8a);
- find the token with the same starting position as the diagnostic;
- use the length of that token to get the ending position;
- compute the range.
Unfortunately, this doesn't always work as shown in issue #859, In that case, `clang_getCursorExtent` returns an empty range for all diagnostics after the missing semicolon.
This PR fixes that issue by extracting the tokens from the diagnostic position to the immediate next character then using `clang_getTokenExtent` to get the range of the identifier (multiline identifiers are supported).
Fixes#859.
<!-- 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/860)
<!-- Reviewable:end -->
ycmd commit is a12a0a3 on mac, but also happens with older 2e62515
This might be a libclang bug, but with a source file with errors such as this, the
location_extent
values for all diagnostics are zeros.diagnostics look like:
The text was updated successfully, but these errors were encountered: