/reasonml-idea-plugin

ReasonML language plugin for idea

Primary LanguageJavaMIT LicenseMIT

reasonml-idea-plugin

ReasonML language plugin for idea

screenshot

Documentation

Please see the wiki.

Features

Reason syntax
Ocaml syntax
Dune syntax (limited support)
Structured view
Code folding
js language injection
Bucklescript compiler integration
JSX syntax & completion
Type annotation
Intentions (_ReasonML_): add braces to function, transform local open

Other features:

  • Line and block commenting
  • Pair braces matcher
  • Reformat using refmt (press crtl alt shift R or ⌘⎇⇧R on Mac)
  • Reformat on save
  • Works natively on Windows

Make sure "namespace": false is set in bsconfig.json to enable inferred types hints in the editor.

How to help

  • Be patient
  • Give this project some love, star it or star the plugin page in intellij repository
  • Fill the github repo with specific issues
  • Donate using Liberapay Support my work with liberapay
  • Donate using paypal Support my work with paypal-me

To all the people who have donated, you are awesome !! Really, this is pure anonymous donation and it blows my mind... I'm very grateful and it's kinda stupid but it keeps me motivated. So big thanks.

Many thanks also to the jetbrains team who provide me an OSS licence for their product.

Some live templates

List of templates that may help development.

abbrevation: jsp, description: create a jsProps in wrapReasonForJs

~$NAME$=jsProps##$NAME$,$END$

abbreviation: style, description: create a style module

module Styles = {
    open Css;
    let $VAR$ = style([
        $END$
    ]);
};

abbreviation: comp, description: create a reason component

let component = ReasonReact.statelessComponent("$NAME$");

let make = (~$PROP$, _children) => {...component, render: _self => <div />};
$END$
/*
 JS interop
 expose an helper for js - can be deleted when no more used by javascript code
 */
let jsComponent =
  ReasonReact.wrapReasonForJs(~component, jsProps =>
    make(~$PROP$=jsProps##$PROP$, [||])
  );

What?

  • Why don't you consider using Language Server Protocol ?

    Mainly because I want a strong integration in the IDE and I need a first class support of Windows.

  • What versions does the plugin support at the moment?

    It should work with idea 15

  • How is it different than ocaml language plugin?

    I wanted to have a plugin dedicated to reason and that's why I created one called reasonml, not ocaml. Then I realised that I still need ocaml support and that people are asking for it.

    I started this plugin by studying and copying parts of the ocaml plugin, but now the 2 projects are taking different orientations, technically.

    I am moving away from merlin and trying to use the most of Intellij structures.

    Now, they have incompatible implementations, and different goals.

  • Modules from node_modules folder are not resolved (GoTo is not working on Array.sort)?

    Ensure that node_modules folder is not excluded from IDE index.

Development

This project is heavily inspired by :