joshar.notes

Configuring Helix Editor for Javascript/Typescript

I have been exploring the world of terminal based text editors recently and came across Helix.

First impressions

seems more intuitive than Vim. But ecosystem is pretty nascent. While most major editors/IDEs will have Vim keybindings you'll be out of luck finding Helix keybindings for now. That said, it is also a baby as compared to Vim (released in 1991), so give it time.

Setting up Javascript in Helix

By default, you won't get any sort of autocompletion in JS files. But configuring that wasn't too hard.

First run hx --health javascript to see the current state of your Javascript configuration in Helix.

$ hx --health javascript    

Configured language server: typescript-language-server
Binary for language server:  Not found in $PATH  # <-- Need to download this
Configured debug adapter: 
Binary for debug adapter: Not found in $PATH
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓

Download typescript-language-server

npm install -g typescript-language-server typescript

And that's pretty much it. In a new terminal session, validate the configuration with hx --health

$ hx --health javascript   

Configured language server: typescript-language-server
Binary for language server: /Users/<your-username>/<path/to>/typescript-language-server
Configured debug adapter: 
Binary for debug adapter: Not found in $PATH
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓

Open a Javascript file and now in INS mode you should see autocomplete suggestions. Pro Tip: you can navigate the suggestions by Ctrl + j/k