khaled alomar
khaled alomar

Reputation: 683

elm : install elm format extension

I have installed elm-format package (using amp install elm-format) and I want to run it from the command line , example elm-format mypage.elm

In order to run it from the command line it should be available in one of the environment path let's say usr/local/bin while the elm-format directory is installed in the following path Users/myuser/.atom/packages and none is available in env path

what should I move to the PATH (usr/local/bin) , is the whole folder or an executable file

note : when i run ls Users/myuser/.atom/packages/elm-format i get the followings :

CHANGELOG.md README.md keymaps menus src LICENSE.md example lib package.json

Upvotes: 4

Views: 1698

Answers (4)

Hien
Hien

Reputation: 2120

For Atom configures: https://atom.io/packages/language-elm for Syntax highlighting and autocompletion, for auto format on saving https://atom.io/packages/elm-format

For the others IDE https://guide.elm-lang.org/install.html (VScode, Atom, Sublime, Vim,...)

Upvotes: 0

vince
vince

Reputation: 8306

For anyone using VS Code (on a Mac / Linux system):

1) Choose Download ZIP in the 'Clone or Download' dropdown on the elm-format Github repo.

2) To move the elm-format executable to your 'PATH', open the Terminal application and enter the following command:

mv ~/Downloads/elm-format /usr/local/bin/elm-format

3) Open VS Code and install the extension elm-format.

4) Still in VS Code, open User Settings. (Do this by pressing CMD + SHIFT + P to open the available commands search bar and type User Settings -- press enter. Alternatively, you can use the shortcut CMD + , to open the User Settings.)

5) In the file that shows up on the right side of the editor (your personal settings overrides), add the following line:

 "elm-format.formatOnSave": true

Save.

Cheers!

Upvotes: 1

kkpoon
kkpoon

Reputation: 1989

According to npm website You could install elm-format by npm install -g elm-format.

Upvotes: 1

khaled alomar
khaled alomar

Reputation: 683

I will answer my question since I have solved it.

first you have to install the elm-format binary file using your browser form the following URL

after installing the binary file extract it add the path to the environment path for windows user add elm-format.exe or mac user add elm-format

since I am a mac user I used the below command to add it : mv ~/Download/elm-format /usr/local/bin/elm-format after installing the binary now we need to install elm-format extention for the appropriate editor since I am using atom editor I have used the following command apm install elm -format

now we can used elm-format command line to format the elm page

command line : elm-format pagename.elm

Upvotes: 2

Related Questions