vim-lsp
vim-lsp copied to clipboard
[PoC] Handle jdt:// URIs
eclipse.jdt.ls can retrieve definitions for symbols located in jar files.
Example:
import javax.jms.JMSException;
In a maven project, when cursor is on JMSExc|eption
, :LspDefinition would reply with the following, including exact source file name and line/column location:
{
"uri": "jdt://contents/geronimo-jms_1.1_spec-1.1.1.jar/javax.jms/JMSException.class?=java-engine-main/%5C/Users%5C/MYUSER%5C/.m2%5C/repository%5C/org%5C/apache%5C/geronimo%5C/specs%5C/geronimo-jms_1.1_spec%5C/1.1.1%5C/geronimo-jms_1.1_spec-1.1.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.geronimo.specs=/=/maven.artifactId=/geronimo-jms_1.1_spec=/=/maven.version=/1.1.1=/=/maven.scope=/compile=/%3Cjavax.jms(JMSException.class",
"range": {
"end": {
"character": 25,
"line": 30
},
"start": {
"character": 13,
"line": 30
}
}
}
The "uri"
string contains the location of the jar file, and within it the full of the JMSException.java
file.
This patch converts this "uri"
string into the following:
zipfile:///Users/MYUSER/.m2/repository/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geroni
mo-jms_1.1_spec-1.1.1-sources.jar::javax/jms/JMSException.java
The zipfile://<path>.jar::<path>
format is understood by vim and therefore it can open the definition.
Note that this is tested with a maven project, after dependency:sources
downloaded the -sources.jar
files for the otherwise binary dependencies.
Now this is clearly a proof-of-concept and not something I'd consider to be merged. However it worksforme and would be nice if vim-lsp's s:lsp_location_item_to_vim
function could handle othe "proprietary" URI specifiers, including jdt://
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.