rchain / bounties

RChain Bounty Program
MIT License
90 stars 62 forks source link

D> Rholang plugin for the IntelliJ Platform #127

Closed lapin7 closed 6 years ago

lapin7 commented 7 years ago

@tgrospic writes an extension for IntelliJ for a code formatter. It's under construction.

tgrospic commented 7 years ago

Or more precisely this is in fact plugin for Rholang not for Rosette. And for now it has only syntax highlighting support at the initial stage. Also it is only tested in IntelliJ Idea IDE. Contributions and feedback are very welcome. https://github.com/tgrospic/rholang-idea

Code formatting and more interesting features are comming. :)

I changed the title of the issue to be more accurate.

lapin7 commented 7 years ago

Hi @tgrospic Maybe you can look at the Language Specification of @dckc Maybe it helps with syntax highlighting in IntelliJ.

tgrospic commented 7 years ago

Thanks @lapin7!

I published (still in approval) a new version v0.0.3 of plugin which successfully highlight all examples from github.com/rchain/.../rholang/examples. :tada: Although some of the old ones are still with errors and not completely understandable to me.

As a source for plugin I'm using grammar directly from the Rholang compiler github.com/rchain/Rholang/.../rholang.cf. But in a modified version that IntelliJ can understand plugin/.../Rho.bnf. For the plugin this file is the main language definition and it should be in sync with the compiler version.

Language Specification from @dckc seems to have more features than the compiler version e.g. types, structs. Maybe I can use it and try these examples github.com/rchain/Rholang/DAO/examples.

Both the compiler and plugin are doing the same thing when parsing a source file. To do so they are also using similar libraries to generate parser and lexer. But compiler is not usualy interested in partialy correct programs while editor must be more caring to a user and still functional despite some syntax errors like open bracket or half finished expression. So when grammar translation is fixed it will be much easier to write other advanced features like formatting, goto definition, type checking, etc.

I like the way Idris compiler works. It has IDE protocol with syntax highlighting included as API. So plugin from the future will be just another independent smart contract. :smile:

Related to translation, I have a few open questions on my mind e.g. how to correctly transform _. Proc ::= Proc1 to a simpler BNF form?

lapin7 commented 7 years ago

That looks great.

AbnerZheng commented 6 years ago

@lapin7 @tgrospic When will you start to develop the remaining features? I have done two idea plugin, and I'm familiar with formatting, element resolving and so on. If there need any help, please tell me.

tgrospic commented 6 years ago

Hey @AbnerZheng! Help is always welcome. :smile:

I don't have enough information how formatter should work (we know how tabs and spaces can divide the world). If you have any idea please create an issue or ping me on Discord. It would be very helpful if you can play with the plugin and give your feedback.

It would be nice to have editor Action to compile the file or code selection. Similar how Rholang web is working. Or basic code completion at least with the words from opened file. Is this sounds interesting to you?

AbnerZheng commented 6 years ago

Yes, these ideas do sound interesting to me. I have experiences with tuning the formatter : ). And your idea of compile action is quite interesting. I'll start working on these issues and once I finish these issues, I'll create a PR.

AbnerZheng commented 6 years ago

I'll start with adding editor Action to compile the file.

tgrospic commented 6 years ago

Excellent. Thanks!

AbnerZheng commented 6 years ago

@tgrospic I have create a new PR(https://github.com/tgrospic/rholang-idea/pull/1), adding folding feature and test framework. Please have a look.

tgrospic commented 6 years ago

Thanks @AbnerZheng! You PR is merged and a new version of the plugin (v0.0.4) with the folding feature has been published. :tada:

dckc commented 6 years ago

@AbnerZheng good stuff. Be sure to fill in your part of Rewards 201801.

for reference: Jan 22 thru Jan 27 https://github.com/tgrospic/rholang-idea/commit/5153f19b858ce2549f7a268131281488016e181f https://github.com/tgrospic/rholang-idea/commit/dae77174ca852c334b06124c0813b6e28b2e6413

@tgrospic I see you filled in some rewards but did not suggest a budget. Others have suggested as low as $100, but this is clearly more work than that. I see perhaps 8 to 12 hours of work in January alone.

It's not yet clear to me whether the budget should represent just the work for this month or the whole project. I based my entry on this month's work, in this case. It's quite difficult to estimate the whole project.

tgrospic commented 6 years ago

@dckc I'm not sure how to suggest the budget, I was only try to help @AbnerZheng to be rewarded for his PR, which I only reviewed and published so my work in January is minimal.

@lapin7 can you help me here, you created this issue and I think you set the budget?

AbnerZheng commented 6 years ago

@lapin7 @tgrospic @dckc I spend almost 12 hours for adding testing framework and adding folding feature, since dckc has overvalue the budget( I think he want to adjust these 2 budget as low as 100$), and I will ask for 480$ for this work.

AbnerZheng commented 6 years ago

@tgrospic @lapin7 @dckc I have commit a new PR - "Add a working Formatter for Rholang-idea"(https://github.com/tgrospic/rholang-idea/pull/2). @tgrospic Please have a look. The function preview: image

There are still some improvement to finish, and I wish get some some feedback from user.

tgrospic commented 6 years ago

@AbnerZheng great work! I'm very happy to see this working. :smiley:

dckc commented 6 years ago

Would you please

Issues that take longer than a month fit awkwardly into our budget / reward system, not to mention all the usual challenges with large tasks. See also #273

tgrospic commented 6 years ago

@dckc that makes sense. I'm closing the issue.

@AbnerZheng please create a new issue for your open PR for formatting.