Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
doc(editors): how to use rome as a language server in helix (#3225)
Browse files Browse the repository at this point in the history
* feat: 🎸 init

* chore: 🤖 update video

* chore: 🤖 tweak grammar

* fix: 🐛 cr issues

* Update editors/helix/manual.md

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update editors/helix/manual.md

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
  • Loading branch information
IWANABETHATGUY and ematipico committed Sep 16, 2022
1 parent 553f4d6 commit 4e2403b
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions editors/helix/manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Configuration
Currently, rome supports the following file extensions: `js`, `jsx`, `ts`, `tsx` and `d.ts`.

Rome uses a file socket to connect the editor client, which may be different from other language servers using a binary e.g. `rust-analyzer`.

You can use `nc -U ${LANGUAGE_SERVER_SOCKET_PATH}` to connect to the Rome language server. `LANGUAGE_SERVER_SOCKET_PATH` is path to where the Rome's socket is created. Rome creates that socket inside the temporary folder of the operative system, inside a folder called `rome-socket`.

To know the path of your OS, run the command:
```shell
rome __print_socket
```
More details why we need `nc`, please read the [wiki page of helix](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers)

**languages.toml**
```toml
[[language]]
name = "javascript"
scope = "source.js"
file-types = ["js"]
language-server = { command = "nc", args = ["-U", "/tmp/rome-socket"] }
formatter = { command = "rome", args = ["format", "--stdin-file-path", "test.js"]}
auto-format = true

[[language]]
name = "jsx"
scope = "source.jsx"
file-types = ["jsx"]
language-server = { command = "nc", args = ["-U", "/tmp/rome-socket"] }
formatter = { command = "rome", args = ["format", "--stdin-file-path", "test.jsx"]}
auto-format = true
[[language]]
name = "typescript"
scope = "source.ts"
file-types = ["ts"]
language-server = { command = "nc", args = ["-U", "/tmp/rome-socket"] }
formatter = { command = "rome", args = ["format", "--stdin-file-path", "test.ts"]}
auto-format = true

[[language]]
name = "tsx"
scope = "source.tsx"
file-types = ["tsx"]
language-server = { command = "nc", args = ["-U", "/tmp/rome-socket"] }
formatter = { command = "rome", args = ["format", "--stdin-file-path", "test.tsx"]}
auto-format = true

```
`/tmp/rome-socket` is the default socket file path in Linux. Use the command `rome __print_socket` and use the correct value.

# Limitation
1. The socket is not automatically created, and you need to call the command [`rome start`](https://rome.tools/#rome-start) in order to create one. Use the command [`rome stop`](https://rome.tools/#rome-stop) to free the socket.

# Video record
## Code Action
https://user-images.githubusercontent.com/17974631/190205045-aeb86f87-1915-4d8b-8aad-2c046443ba83.mp4

## Formatting
https://user-images.githubusercontent.com/17974631/190205065-ddfde866-5f7c-4f53-8a62-b6cbb577982f.mp4

0 comments on commit 4e2403b

Please sign in to comment.