Code Monkey home page Code Monkey logo

rholang-idea's Introduction

Rholang IntelliJ IDEA language plugin

beta

This is the early stage of editor support for Rholang. ๐Ÿ˜„

For now, it has only support for syntax highlighting. I tried to make parser more forgiving so it can highlight wider range of correct programs. With more context information from compiler it could be much more precise.

Rholang is a fully featured, general purpose, Turing-complete programming language built from the rho-calculus. It is a behaviorally typed, r-eflective, h-igher o-rder process language and the official smart contracting language of RChain. Its purpose is to concretize fine-grained, programmatic concurrency. RChain Architecture

Rholang is currently in active development and syntax can slightly change. Current version of plugin follows this version of Rho grammar and available examples.

I found interesting that many grammar rules have a strong gravity towards Process ๐ŸŒ€ but that should not be strange for ฯ€-calculus, ฮป-expression is not the main actor here. Mobile process calculi for programming the new blockchain

Programmers in concurrent languages such as Erlang/Elixir say that one of the hardest problems is to coordinate the names (locations) of processes. It seems that Rholang with Namespace logic looks like a great solution for coordination of resources.

With all this sweet superpowers, that comes with the Rholang compiler and type checker, it will be a pleasure to write smart contracts. ๐Ÿญ

Configure custom colors on the settings page

Maybe you want to set color for Bind parameter which has no default value.

Idea settings page

Install

From JetBrains Plugins Repository searchable inside the editor.

Or download rholang-idea.jar from the latest release and install through File > Settings > Plugins menu.

Any feedback, suggestions, bugs, testing, pull-requests, issues are very welcome. ๐Ÿ˜„

Development

  • setup IntelliJ dev-plugin prerequisites
  • generate Java parser from Rho.bnf through the file context menu Generate Parser Code
  • generate Java lexer from Rho.flex through the file context menu Run JFlex Generator (choose out folder or any folder outside the project where jflex.jar will be downloaded)
  • build the project (choose IntelliJ SDK and language level 8)
  • create new Plugin Run configuration with default setup
  • run/debug in a separate editor
  • optionally, to keep formatting consistent install plugin for EditorConfig

Test

IntelliJ has provided testing framework. This framework simplifies verification. For more details, you can read IntelliJ Platform SDK DevGuide.

How to use

Just as using JUnit, there is a 'run' button on the left of the class or test case. You can click this button to run or debug. Also, right-click on the test folder has option to Run/Debug 'All Tests'.

Deployment

TODO

Release Notes

  • Updated grammar for Rholang Mercury release.
  • Implemented formatting feature.
  • Updated grammar (quick fix before Mercury) @tgrospic.
  • Implemented folding feature.
  • Added initial tests.

0.0.3

  • Syntax: Contracts as processes (recursive).
  • Syntax: Fix arithmetic operators.
  • New file icon.

0.0.2

  • Contributing info, plugin name change.

0.0.1

  • Initial release. Syntax highlighting.

License

The MIT License (MIT)

rholang-idea's People

Contributors

abnerzheng avatar tgrospic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rholang-idea's Issues

Release 0.2.0

Hi! I've noticed there are quite a few unreleased changes in the commit log. May I ask for a release? :)

Thx!

idea error, can not load the rho file

java.lang.NoClassDefFoundError: com/intellij/ide/highlighter/JavaHighlightingColors
	at coop.rchain.lang.RhoColor.<clinit>(RhoColors.kt:15)
	at coop.rchain.lang.RhoSyntaxHighlighter$Companion.map(RhoSyntaxHighlighter.kt:31)
	at coop.rchain.lang.RhoSyntaxHighlighter.getTokenHighlights(RhoSyntaxHighlighter.kt:24)
	at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.a(LexerEditorHighlighter.java:415)
	at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.access$200(LexerEditorHighlighter.java:53)
	at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter$HighlighterIteratorImpl.getTextAttributes(LexerEditorHighlighter.java:531)
	at com.intellij.openapi.editor.impl.view.IterationState.a(IterationState.java:509)
	at com.intellij.openapi.editor.impl.view.IterationState.a(IterationState.java:483)
	at com.intellij.openapi.editor.impl.view.IterationState.advance(IterationState.java:302)
	at com.intellij.openapi.editor.impl.view.IterationState.<init>(IterationState.java:156)
	at com.intellij.openapi.editor.impl.view.LineLayout$Chunk.a(LineLayout.java:608)
	at com.intellij.openapi.editor.impl.view.LineLayout$Chunk.access$2800(LineLayout.java:587)
	at com.intellij.openapi.editor.impl.view.LineLayout$VisualOrderIterator.hasNext(LineLayout.java:725)
	at com.intellij.openapi.editor.impl.view.VisualLineFragmentsIterator.hasNext(VisualLineFragmentsIterator.java:224)
	at com.intellij.openapi.editor.impl.view.EditorCoordinateMapper.logicalToVisualPosition(EditorCoordinateMapper.java:71)
	at com.intellij.openapi.editor.impl.view.EditorView.logicalToVisualPosition(EditorView.java:169)
	at com.intellij.openapi.editor.impl.EditorImpl.logicalToVisualPosition(EditorImpl.java:2097)
	at com.intellij.openapi.editor.impl.CaretImpl.updateVisualPosition(CaretImpl.java:722)
	at com.intellij.openapi.editor.impl.CaretModelImpl.updateVisualPosition(CaretModelImpl.java:129)
	at com.intellij.openapi.editor.impl.EditorImpl.reinitSettings(EditorImpl.java:884)
	at com.intellij.openapi.editor.impl.EditorImpl.setHighlighter(EditorImpl.java:1239)
	at com.intellij.openapi.fileEditor.impl.text.TextEditorImpl.a(TextEditorImpl.java:68)
	at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl.a(PsiAwareTextEditorImpl.java:57)
	at com.intellij.openapi.fileEditor.impl.text.AsyncEditorLoader.a(AsyncEditorLoader.java:135)
	at com.intellij.openapi.fileEditor.impl.text.AsyncEditorLoader.start(AsyncEditorLoader.java:69)
	at com.intellij.openapi.fileEditor.impl.text.TextEditorImpl.<init>(TextEditorImpl.java:59)
	at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl.<init>(PsiAwareTextEditorImpl.java:44)
	at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider.createEditor(PsiAwareTextEditorProvider.java:35)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.a(FileEditorManagerImpl.java:857)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:652)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:665)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4(FileEditorManagerImpl.java:960)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl3(FileEditorManagerImpl.java:782)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.a(FileEditorManagerImpl.java:764)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:131)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:97)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:87)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:73)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl2(FileEditorManagerImpl.java:764)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:695)
	at com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.openFile(FileEditorManagerEx.java:145)
	at com.intellij.codeInsight.navigation.NavigationUtil.a(NavigationUtil.java:201)
	at com.intellij.codeInsight.navigation.NavigationUtil.a(NavigationUtil.java:171)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:139)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:97)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:87)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:73)
	at com.intellij.codeInsight.navigation.NavigationUtil.openFileWithPsiElement(NavigationUtil.java:170)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.navigate(AbstractPsiBasedNode.java:220)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.navigate(AbstractPsiBasedNode.java:230)
	at com.intellij.ide.projectView.impl.nodes.PsiFileNode.navigate(PsiFileNode.java:133)
	at com.intellij.util.OpenSourceUtil.navigateToSource(OpenSourceUtil.java:119)
	at com.intellij.util.OpenSourceUtil.navigate(OpenSourceUtil.java:74)
	at com.intellij.util.OpenSourceUtil.navigate(OpenSourceUtil.java:58)
	at com.intellij.util.OpenSourceUtil.navigate(OpenSourceUtil.java:51)
	at com.intellij.util.OpenSourceUtil.openSourcesFrom(OpenSourceUtil.java:19)
	at com.intellij.util.EditSourceOnDoubleClickHandler$TreeMouseListener.processDoubleClick(EditSourceOnDoubleClickHandler.java:128)
	at com.intellij.util.EditSourceOnDoubleClickHandler$TreeMouseListener.onDoubleClick(EditSourceOnDoubleClickHandler.java:120)
	at com.intellij.ui.DoubleClickListener.onClick(DoubleClickListener.java:30)
	at com.intellij.ui.ClickListener$1.mouseReleased(ClickListener.java:73)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.Component.processMouseEvent(Component.java:6548)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
	at com.intellij.ui.treeStructure.Tree.processMouseEvent(Tree.java:424)
	at com.intellij.ide.dnd.aware.DnDAwareTree.processMouseEvent(DnDAwareTree.java:58)
	at java.awt.Component.processEvent(Component.java:6313)
	at java.awt.Container.processEvent(Container.java:2237)
	at java.awt.Component.dispatchEventImpl(Component.java:4903)
	at java.awt.Container.dispatchEventImpl(Container.java:2295)
	at java.awt.Component.dispatchEvent(Component.java:4725)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
	at java.awt.Container.dispatchEventImpl(Container.java:2281)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4725)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
	at java.awt.EventQueue.access$500(EventQueue.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:715)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
	at java.awt.EventQueue$4.run(EventQueue.java:737)
	at java.awt.EventQueue$4.run(EventQueue.java:735)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
	at com.intellij.ide.IdeEventQueue.s(IdeEventQueue.java:781)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:718)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: com.intellij.ide.highlighter.JavaHighlightingColors PluginClassLoader[coop.rchain.lang, 0.2.0] com.intellij.ide.plugins.cl.PluginClassLoader@30fd920a
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:63)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 100 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.