Skip to content

Implement JDT URI handler without creating temporary files.#67

Open
lucasec wants to merge 1 commit intoyveszoundi:mainfrom
lucasec:jdt-uri-handler
Open

Implement JDT URI handler without creating temporary files.#67
lucasec wants to merge 1 commit intoyveszoundi:mainfrom
lucasec:jdt-uri-handler

Conversation

@lucasec
Copy link

@lucasec lucasec commented Jan 10, 2026

This is an attempt to improve the JDT URI handler by patterning it after the built-in url-handler-mode. Rather than writing the class source to a temporary file and re-directing to it, this implements a more complex file name handler that allows visiting the jdt:// URI directly in Emacs with the source loaded directly into the buffer.

There are a few advantages to this approach:

  1. No need to write temporary files to disk and/or find a writable directory.
  2. No need to clean up temporary files
  3. Very clear from the buffer file path (and thus in tools such as ibuffer) which buffers are local source files and which are class sources pulled from the language server

And no loss of functionality:

  1. LSP functionality such as navigating further between classes still works within the source class buffer (this is due to what might be a slight abuse of the file handler API, we return the project root as the parent directory for every jdt:// URI).
  2. Fully supports multiple projects/instances of the language server open in Emacs

Would love for others to give this a try and let me know if you find any bugs.

There are also several improvements I would like to explore in the future, such as tweaking the URI scheme to enable jdt:// paths to be bookmarked or saved via desktop-save-mode and restored later, without having to first navigate from a buffer with a running JDTLS. Also, the ability to interactively browse within a dependency artifact or the dependency tree could another gap between Emacs/JDTLS and mature IDEs such as IntelliJ.

This is an attempt to improve the JDT URI handler by patterning it
after the built-in url-handler-mode. Rather than writing the class
source to a temporary file and re-directing to it, this implements a
more complex file name handler that allows visiting the jdt:// URI
directly in Emacs with the source loaded directly into the buffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant