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

Investigate a custom URI scheme for decompiled *.class resources #142

Closed
fwcd opened this issue Aug 6, 2019 · 0 comments · Fixed by #150
Closed

Investigate a custom URI scheme for decompiled *.class resources #142

fwcd opened this issue Aug 6, 2019 · 0 comments · Fixed by #150
Labels
enhancement New feature or request experimental The feature is experimental and might be revoked

Comments

@fwcd
Copy link
Owner

fwcd commented Aug 6, 2019

Currently, external class files are (when the user requests a "Go-To-Definition") decompiled into a temporary file on disk and transferred to the client by referencing the corresponding file URI. Temporary on-disk resources depend on a cleanup hook, which may or may not run, depending on whether the language server process is forcefully terminated.

Similar to how the Java language server does this, it might be cleaner to have a custom URI scheme for resources inside JAR files. For example, replacing:

file:///C:/Users/.../AppData/Local/Temp/fernflowerOut8413035485521351592/Runnable7065471160245853737.java

by something like:

kls://contents/rt.jar/java.lang/Runnable

VSCode supports this through the use of Virtual Documents, Atom provides an API for readonly documents too.

Challenges with this approach include, however:

  • Ensuring that the client supports these URIs (e.g. by registering a capability) and otherwise falling back to temporary files
  • Having to maintain a non-standard LSP request under which the language server can dynamically serve the text content of these temporary resources (JDT.LS calls this java/classFileContents)

For discussions around the JDT's approach, see:

@fwcd fwcd added enhancement New feature or request experimental The feature is experimental and might be revoked labels Aug 6, 2019
@fwcd fwcd changed the title Investigate using a custom URI scheme for decompiled *.class resources Investigate a custom URI scheme for decompiled *.class resources Aug 6, 2019
@fwcd fwcd closed this as completed in #150 Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental The feature is experimental and might be revoked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant