Add optional support for class files with file scheme
See original GitHub issueHello,
I use emacs with eglot. I noticed that sometimes, jdt.ls returns URIs on the form jdt:// when trying to find a definition. Eglot does not handle these URIs.
Is it possible to configure jdt.ls to use file:// protocol instead? I noticed that other packages parse jdt:// and convert them to something useful (I see that emacs’s lsp-java and nvim nvim-jdtls do that. I suspect vscode does as well).
Excuse my naivity as I don’t now the design and purpose of return jdt:// uris (not sure what that protocol is meant for).
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
JAR File Specification
A JAR file is essentially a zip file that contains an optional META-INF directory. ... In many cases, JAR files are not just...
Read more >Files | Android Developers
DirectoryNotEmptyException, the REPLACE_EXISTING option is specified but the file cannot be replaced because it is a non-empty directory (optional specific ...
Read more >The composer.json schema
This map is built by scanning for classes in all .php and .inc files in the given directories/files. You can use the classmap...
Read more >OpenAPI Specification - Version 2.0 - Swagger
Version 2.0 specification defines a set of files required to describe an API. These files can then be used by the Swagger-UI project...
Read more >Overview | Protocol Buffers - Google Developers
Protocol buffers are a combination of the definition language (created in .proto files), the code that the proto compiler generates to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Not really. Eglot and lsp-mode are different lsp clients with different design philosophies.
But that is beside the point. The code itself wouldn’t be that hard to write. Support for this bespoke URL format for this one specific server probably won’t make it into Eglot and Emacs core, it will end up in a separate package that someone has to write and maintain. So out of the box, this lsp server won’t play very nicely with Emacs and will require the user to install extra packages for it to work correctly. That’s not the end of the world. Maybe other lsp-clients require users to download extra packages to support servers like jdtls and users are fine with that. I don’t know though.
If we ended up creating a separate file for every
.classthat could get very complicated. It would have to be stored per-project and get re-generated every time we detect the underlying library changed. I agree we should try to make it easier for clients to implement such functionality, and having more things to implement client side does reduce the likelihood of clients taking full advantage of features. It might be possible to create an extended client capability that informs the server whether the client intends to supportjdt://. The server could then respond with eitherjdtorfile, depending on the client’s setting. Still, having to write out each classfile to the filesystem on-demand would likely slow things down.Is there some uri scheme, we could return from 'textDocument/definition` that most clients will support ? Doesn’t look like it.
We use the query string portion (the part of after the
?) in order for JDT to uniquely identify the classfile :https://github.com/eclipse/eclipse.jdt.ls/blob/6c61f23f3b9818d6e54c993095a710ad51600cfc/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTUtils.java#L390-L395
That’s definitely custom enough that nothing is going to support this, which is why the client is forced to query the server once again, in order to get the proper content to display to the user.
I’ve marked this as an enhancement since it could benefit other clients, but the work to support
jdt://is just a matter of extending the client’s existing “document type registry”, querying JDT-LS once more, and returning the resulting content in the “document type registry provider”.