-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Decompile .tasty files with VS Code Extension #5513
Conversation
PartialTASTYDecompiler stops where the normal decompiler would traverse the tree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
You should open an issue on the vscode repository for this. |
An issue already exists for it: microsoft/vscode#2582 |
compiler/src/dotty/tools/dotc/decompiler/PartialTASTYDecompiler.scala
Outdated
Show resolved
Hide resolved
- Change Tasty -> TASTy as language alias - Override backendPhases instead of phases - Fix inefficient string concat in StringBuilder call - Fix printNat using Yellow directly instead of treeColor preventing override
@smarter do you have more comments? |
Feature
This allows to view both decompiled scala source code and pretty printed TASTy tree when opening a
.tasty
file. The feature is similar to opening.class
files in IntelliJ.As long as the language server supports the feature the IDE will automatically request decompilation when opening a
.tasty
file. No reason to make it an explicit action after opening the file considering they are not human readable.Decompilation errors are reported to the IDE, more specific errors can be added.
Errors currently reported:
Important: files need to be in the folder structure dictated by the package the class or object belongs to, otherwise class path will fail to resolve. To decompile
Thing.tasty
containing a classfoo.bar.Thing
the language server will look forfoo/bar/Thing.class
andfoo/bar/Thing.tasty
in class path.A minor inconvenience is that there is currently no way to bypass the binary file prompt in vscode, even when the file extension is defined in
package.json
, so until that is allowed the user will always be prompted to confirm opening, and only then the decompile request will be sent.Screenshot
Result of opening
out/bootrstrap/dotty-language-server/scala-0.11/classes/dotty/tools/languageserver/Main.tasty
: