Skip to content
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

[PoC] Handle jdt:// URIs #1284

Closed
wants to merge 1 commit into from
Closed

[PoC] Handle jdt:// URIs #1284

wants to merge 1 commit into from

Conversation

kmARC
Copy link

@kmARC kmARC commented Mar 9, 2022

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://.

@stale
Copy link

stale bot commented Jun 11, 2022

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.

@stale stale bot added the wontfix label Jun 11, 2022
@mattn mattn removed the wontfix label Jun 11, 2022
@stale
Copy link

stale bot commented Aug 12, 2022

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.

@stale stale bot added the wontfix label Aug 12, 2022
@stale stale bot closed this Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants