This page will walk you trough the installation process of the installation process of RefactorErl extended, beta version.

Dependencies

Erlang 24

Compilation of RefactorErl is guaranteed on this version. You can check your Erlang version, by typing erl into your shell and checking it, than exiting with q().

Please make sure that you start RefactorErl with Erlang 24+

  • if you do not have version 24 you can install it with brew install erlang@24, than put the path for brew in an earlier place with: export PATH="/usr/local/bin/:$PATH".
  • for switching between asdf and brew paths you can optionally add these aliases to your ~/.zshrc file:
# for asdf
alias asdfp='export PATH="/Users/robertfiko/.asdf/installs/erlang/22.0/bin/:$PATH"'

# for brew
alias brewp='export PATH="/usr/local/bin/:$PATH"'

Yaws

If you do not have yaws on your machine install it with brew install yaws.

Now you have yaws, you will need the path of the Yaws' ebin library. If you installed it with Brew, it is most likely under the Cellar folder, somehting like this: /usr/local/Cellar/yaws/VERSION/lib/yaws-VERSION/ebin/. Save this to somewhere in file or clipboard, you will need this later.

Other dependencies

Installing the tool itself

Download RefactorErl from here: https://fikorobert.web.elte.hu/downloads/refels.zip and unzip it. Set your working directory to tool (cd tool) and build the tool, where YAWS_PATH is the earlier saved path to your yaws' installation’s ebin directory

bin/referl -build clean
bin/referl -build tool -yaws_path "YAWS_PATH"

Note: you might want to keep your Yaws path somewhere more persistent, it might come handy for latter use

Installing the extended version of Erlang LS and Visualiser

Altough the diagnostics part is included into the offical release of Erlang LS the Code Lens, are not yet, so to get the most out of RefactorErl you might want to install this too.

To avoid VS Code’s update mechanism overriding this extension https://code.visualstudio.com/docs/editor/extension-marketplace#_extension-autoupdate

git clone https://github.com/robertfiko/refactorerl-visualiser.git

Install: Erlang LS with RefactorErl interface code

make refels (this will create a .vsix file, and install it) Note: if you just want to package (create) the .vsix file use make compile-refels

Install: Visualiser

make visualiser

To uninstall Visualiser: code --uninstall-extension robert-fiko.refactorerl-visualizer --force

Config

Put this config into your Erlang LS config file. The config file should be located in the project root and named erlang_ls.config more info here

diagnostics:
  enabled:
    - refactorerl

refactorerl:
  node: "nodeName@hostName" 		
  diagnostics:
    - "unused_macros"			
    - "unsecure_os_call"

Start

  1. Start RefactorErl by bin/referl -name name@host (make sure that the node name is the same as in the config file)
  2. Start Visual Studio Code and from the sidebar choose the RefactorErl logo.