Skip to content

Commit

Permalink
prioritize lookup the project source code during debugging (#463)
Browse files Browse the repository at this point in the history
* prioritize lookup the project source code during debugging
* fix null check
  • Loading branch information
mozhuanzuojing authored Jan 12, 2023
1 parent 42f9ac7 commit e0f2bd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private static IMethod findMethodInLocalTypes(IMethod enclosingMethod, int stopp
*/
private static Position getPosition(IBuffer buffer, int offset) {
int[] result = JsonRpcHelpers.toLine(buffer, offset);
if (result == null && result.length < 1) {
if (result == null || result.length < 1) {
return new Position(-1, -1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ public static ISourceContainer[] getSourceContainers(String projectName) {
projects.stream().distinct().map(project -> JdtUtils.getJavaProject(project))
.filter(javaProject -> javaProject != null && javaProject.exists())
.forEach(javaProject -> {
// Add source containers associated with the project's runtime classpath entries.
containers.addAll(Arrays.asList(getSourceContainers(javaProject, calculated)));
// Add source containers associated with the project's source folders.
containers.add(new JavaProjectSourceContainer(javaProject));
// Add source containers associated with the project's runtime classpath entries.
containers.addAll(Arrays.asList(getSourceContainers(javaProject, calculated)));
});

return containers.toArray(new ISourceContainer[0]);
Expand Down

0 comments on commit e0f2bd2

Please sign in to comment.