tools icon indicating copy to clipboard operation
tools copied to clipboard

šŸ› Helix editor: Rome language server shadows TS

Open arendjr opened this issue 2 years ago • 9 comments

Environment information

OS: Arch Linux
Rome: v11.0.0

What happened?

I’m trying to set up the Rome Language Server with the Helix editor. While everything seems to work at first glance, I notice that functionality offered by the TypeScript language server, such as ā€œgoto definitionā€ is no longer available.

I followed the instructions for configuring the Rome language server: https://github.com/rome/tools/blob/main/editors/helix/manual.md

While the Rome language server now works, it had the unintended side-effect of making functionality from TypeScript language server unavailable.

Expected result

Both functionality from the Rome language server and the TypeScript language server should be available.

Maybe the Rome language server should forward commands it doesn’t handle to the TS language server? I did confirm that typescript-language-server was in my PATH when I ran rome start.

Code of Conduct

  • [X] I agree to follow Rome's Code of Conduct

arendjr avatar Dec 27 '22 13:12 arendjr

Rome doesn't advertise that it is a definitionProvider so related functionality should not be affected. I would suggest reporting it against the Helix editor.

rchl avatar Dec 29 '22 13:12 rchl

I reported the issue with the Helix editor and it seems a PR is already open on their side (see: https://github.com/helix-editor/helix/pull/2507) to add support for multiple language servers per language. If you don’t mind, we can keep this issue open and I’ll create a PR to update your Helix config instructions once that’s merged.

arendjr avatar Dec 29 '22 14:12 arendjr

šŸ‘‹ @rome/staff please triage this issue by adding one of the following labels: S-Bug: confirmed, S-Planned , S-Wishlist or umbrella

github-actions[bot] avatar Jan 13 '23 12:01 github-actions[bot]

@arendjr any chance you could update helix config instructions as you mentioned above?

matthewmturner avatar Jun 08 '23 15:06 matthewmturner

It might require some updating, since I think they changed some things before they merged that PR. But yeah, I’ll try to give it a go over the next week.

arendjr avatar Jun 09 '23 06:06 arendjr

I was able to get the LSP linting to work, but could not get formatting -- I think it's held up by https://github.com/helix-editor/helix/pull/5626, but if this is the case, I'm not sure how the manual demo works.

This is what I have so far:

[language-server.rome]
command = "rome"
args = ["lsp-proxy"]
formatter = { command = "rome", args = ["format", "--stdin-file-path", "test.js"]}

[[language]]
language-servers = [  "rome", { name = "typescript-language-server", except-features = [ "format" ] }]
name = "javascript"
auto-format = true

If anyone happens to know how to fix formatting, that would be appreciated!

kothavade avatar Jun 09 '23 06:06 kothavade

I am attempting to configure the Helix editor with multiple LSPs for the latest version of NextJS. I anticipate that this setup will support both linting and formatting features.

To reproduce this setup:

  1. Build the Helix editor from source (master branch) to version 23.05 (b4fe31ca). This version supports multiple LSPs.
  2. Rome 12.1.3

For the project languages setup, create a languages.toml file in the .helix directory with the following configuration:

[language-server.rome]
command = "node_modules/.bin/rome"
args = ["lsp-proxy"]
formatter = { command = "node_modules/.bin/rome", args = ["format", "--stdin-file-path", "test.tsx"] }

[[language]]
name = "tsx"
auto-format = true
language-servers = [ { name = "rome", only-features = ["format", "completion", "code-action", "diagnostics", "inlay-hints"] }, "typescript-language-server" ]

Following these steps, everything should function correctly. I've checked the Helix log and the Rome rage log, and both appear to be free of errors.

wornut avatar Jun 18 '23 00:06 wornut

I tried to give it a go, but as @wornut noticed, you currently need a build from the master branch as there are no releases yet that support multiple language servers. Note that version 23.05 is a released version, but the PR for the language servers was merged a day later. So I think it's better to revisit Rome's instructions when a new release is out. For the more courageous, it looks like @wornut's instructions would get the job done :)

arendjr avatar Jun 21 '23 15:06 arendjr

Oh interesting, I was under the impression that there was already a release with this feature as there are docs for it already - but I guess those docs are for master and not latest release.

matthewmturner avatar Jun 21 '23 16:06 matthewmturner