fix the NPE in DocumentSymbolHandler when source/location is not avai…#851
fix the NPE in DocumentSymbolHandler when source/location is not avai…#851andxu wants to merge 2 commits intoeclipse-jdtls:masterfrom
Conversation
…lable. Signed-off-by: andxu <andxu@microsoft.com>
|
Can one of the admins verify this patch? |
|
@fbricon Why sometimes the CI doesn't work? |
|
add to whitelist |
|
@yaohaizh only PRs from trusted contributors are run built automatically. See my previous comment to make Jenkins trust the author of the PR |
| return JDTUtils.toLocation(element).getRange(); | ||
| Location location = JDTUtils.toLocation(element, FULL_RANGE); | ||
| return location == null ? DEFAULT_RANGE : location.getRange(); | ||
| } |
There was a problem hiding this comment.
getRange and getSelectionRange are now strictly identical O_o
There was a problem hiding this comment.
Can we remove the call of "toLocation" twice to share the location? I don't know why the original purpose of SelectionRange and getRange
There was a problem hiding this comment.
-1 on removing that. It was implemented according to the spec:
/**
* The range enclosing this symbol not including leading/trailing whitespace but everything else
* like comments. This information is typically used to determine if the clients cursor is
* inside the symbol to reveal in the symbol in the UI.
*/
range: Range;
/**
* The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
* Must be contained by therange.
*/
selectionRange: Range;
You might break other clients by changing those ranges
|
|
||
| private Range getSelectionRange(IJavaElement element) throws JavaModelException { | ||
| return JDTUtils.toLocation(element).getRange(); | ||
| Location location = JDTUtils.toLocation(element, FULL_RANGE); |
There was a problem hiding this comment.
Location location = JDTUtils.toLocation(element);
…ch includes the comment) Signed-off-by: andxu <andxu@microsoft.com>
|
Fixed with 2e0d78e I restored the range and selectionrange calls |

…lable.
Signed-off-by: andxu andxu@microsoft.com
microsoft/vscode-java-dependency#35