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

Decompile .tasty files with VS Code Extension #5513

Merged
merged 7 commits into from
Jan 3, 2019

Conversation

tuvior
Copy link

@tuvior tuvior commented Nov 24, 2018

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:

  • Class file not found (unfortunately a .tasty file alone can't be decompiled)
  • Old tasty signature, for tasty files produced by previous versions of the compiler
  • Generic error for any other exception thrown

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 class foo.bar.Thing the language server will look for foo/bar/Thing.class and foo/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.
image

Screenshot

Result of opening out/bootrstrap/dotty-language-server/scala-0.11/classes/dotty/tools/languageserver/Main.tasty:
image

Copy link
Member

@dottybot dottybot left a 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! ☀️

@nicolasstucki nicolasstucki self-assigned this Nov 24, 2018
@smarter
Copy link
Member

smarter commented Nov 24, 2018

A minor inconvenience is that there is currently no way to bypass the binary file prompt in vscode

You should open an issue on the vscode repository for this.

@tuvior
Copy link
Author

tuvior commented Nov 24, 2018

A minor inconvenience is that there is currently no way to bypass the binary file prompt in vscode

You should open an issue on the vscode repository for this.

An issue already exists for it: microsoft/vscode#2582

vscode-dotty/package.json Show resolved Hide resolved
vscode-dotty/package.json 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
@nicolasstucki
Copy link
Contributor

@smarter do you have more comments?

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.

5 participants