-
Notifications
You must be signed in to change notification settings - Fork 408
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
fix the NPE in DocumentSymbolHandler when source/location is not avai… #851
Conversation
…lable. Signed-off-by: andxu <[email protected]>
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 |
} | ||
|
||
private Range getSelectionRange(IJavaElement element) throws JavaModelException { | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getRange and getSelectionRange are now strictly identical O_o
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
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.
-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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Location location = JDTUtils.toLocation(element);
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.
Changed.
…ch includes the comment) Signed-off-by: andxu <[email protected]>
Fixed with 2e0d78e I restored the range and selectionrange calls |
…lable.
Signed-off-by: andxu [email protected]
microsoft/vscode-java-dependency#35