-
Notifications
You must be signed in to change notification settings - Fork 446
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
Show decompiled content directly on open .class file #3759
Comments
@JessicaJHee , do you remember if there was any reason why we decided to use a button to activate the decompilation in #2985 ? Was it just to match how Eclipse was doing it ? If I remove it and just triggered the decompilation it seems to work. Seems I could just make a setting for it to skip the button. |
@rgrunber I believe it was because there wasn't a way to make the decompile request to |
I just did : diff --git a/src/javaClassEditor.ts b/src/javaClassEditor.ts
index 053593c..22141e9 100644
--- a/src/javaClassEditor.ts
+++ b/src/javaClassEditor.ts
@@ -43,14 +43,10 @@ export class JavaClassEditorProvider implements vscode.CustomReadonlyEditorProvi
<body>
<div class="center">
<p>This file is not displayed in the text editor because it is a Java class file. Click here to decompile and open.</p>
- <button id="btn"><center>Decompile Class File</center></button>
<div>
<script nonce="${nonce}">
const vscode = acquireVsCodeApi();
- document.getElementById("btn").addEventListener("click", decompiled);
- function decompiled() {
- vscode.postMessage({ command: 'decompiled' });
- }
+ vscode.postMessage({ command: 'decompiled' });
</script>
</body>
</html> The page becomes unnecessary, but it does seem to work. Maybe we did it because we wanted to mimic : |
@rgrunber Ahh I see, that might be the case. It does make sense to me to remove the page then, iirc there is a comment at the top of the decompiled file saying it was generated anyways 👍 |
VS Code shows this because showing a binary file with unknown encoding is not helpful in most cases. Here since we are "showing" .class files with well generated content, I don't think we need the extra step. The only corner case I'm concerning is, if a user indeed wants to view binary content of .class file, we should not block them. I.e. allow them to re-open with a text editor, as below: (command palette -> View: Re-open Editor with ...) Currently, the page with "Decompile Class File" button can be re-open with text editor, but the page with decompiled content cannot work with re-open, which is mainly because it's a content provider instead of a custom editor I guess. If that's the case, ideally what I expect is, to show decompiled class file content directly in this custom editor, then we have better user experience and it works smoothly with vscode's custom editor. |
It's a feature request.
User case
I downloaded a .jar file, extracted it, and was inspecting class files in vscode (opening the extracted folder as root folder). The decompile functionality worked well. When I switched between different .class files I have to re-click the "Decompile Class File" again to see the content, which created a little bit overhead for me.
Is it possible that I can see the decompiled content directly (e.g. by turning on a setting)? That would create smoother user experience in this case.
The text was updated successfully, but these errors were encountered: