-
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
Support resolving stacktrace to uri #1584
Conversation
Signed-off-by: Sheng Chen <[email protected]>
} | ||
Set<ISourceContainer> containers = new LinkedHashSet<>(); | ||
containers.addAll(Arrays.asList( | ||
JavaRuntime.getSourceContainers(resolved.toArray(new IRuntimeClasspathEntry[0])))); |
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.
I think there may be an issue here when JavaSourceLookupUtil#translate(..) creates a PackageFragmentRootSourceContainer(..) for the archive entries. The PackageFragmentRootSourceContainer class doesn't seem to use the source attachment to figure the source location. It ends up just returning a reference in the classfile.
Update : Come to think of it, I could be wrong here. I mean if the stacktrace reference is meant to just resolve to the artifact that ran that code then I think this is fine.
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.
Yes, here we mean to resolve a uri for a given stack trace line, and the uri comes from the classfile's reference.
To resolve the content(source code) of the uri, we have a content provider to do this: https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/DisassemblerContentProvider.java#L52
@@ -79,6 +80,8 @@ public Object executeCommand(String commandId, List<Object> arguments, IProgress | |||
case "java.project.import": | |||
ProjectCommand.importProject(monitor); | |||
return null; | |||
case "java.project.resolveSourceUri": | |||
return ResolveSourceMappingHandler.resolveSourceUri((String) arguments.get(0), (ArrayList<String>) arguments.get(1)); |
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 you make the second argument to be optional?
Signed-off-by: Sheng Chen <[email protected]>
@@ -79,6 +80,12 @@ public Object executeCommand(String commandId, List<Object> arguments, IProgress | |||
case "java.project.import": | |||
ProjectCommand.importProject(monitor); | |||
return null; | |||
case "java.project.resolveSourceUri": |
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.
Since the input is the stacktrace text, the command name such as java.project.resolveStackTraceLocation
is more descriptive.
Signed-off-by: Sheng Chen <[email protected]>
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.
LGTM
To resolve #1202
Other extensions can leverage the delegate command to get the source uri.
Signed-off-by: Sheng Chen [email protected]