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

doc(editors): how to use rome as a language server in helix #3225

Merged
merged 6 commits into from
Sep 16, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions editors/helix/manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Configuration
Currently, rome support `js`, `jsx`, `ts`, `tsx` four languages. 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 could use `nc -U ${LANGUAGE_SERVER_SOCKET_PATH}` to connect your rome language server, `LANGUAGE_SERVER_SOCKET_PATH` could be got by
`rome __print_socket`, by default it is `/tmp/rome-socket`. More details why we need nc you could reference https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers
IWANABETHATGUY marked this conversation as resolved.
Show resolved Hide resolved

**languages.toml**
```toml
[[language]]
name = "javascript"
scope = "source.js"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find this scope in their wiki... do you have a link that shows how it's used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

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

```

# Limitation
1. The `rome-socket` will not automatically create when you reboot until you use the command `rome __print_socket`. As a workaround,
you could write a init startup bash script.
IWANABETHATGUY marked this conversation as resolved.
Show resolved Hide resolved
IWANABETHATGUY marked this conversation as resolved.
Show resolved Hide resolved

# 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