Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 LSP formatting not working in Helix #3325

Closed
1 task done
robintown opened this issue Jul 1, 2024 · 1 comment
Closed
1 task done

🐛 LSP formatting not working in Helix #3325

robintown opened this issue Jul 1, 2024 · 1 comment

Comments

@robintown
Copy link
Contributor

Environment information

CLI:
  Version:                      1.8.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v22.2.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/9.4.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Workspace:
  Open Documents:               0

What happened?

  1. Set up LSP integration with Helix as described in the docs
  2. Open a JavaScript file in Helix 24.3
  3. Mess up the formatting a bit
  4. Run the :format command

Nothing happens :(

Expected result

The file should be formatted.

The language server generally is working, as I can see Biome's lint diagnostics appearing in my files. The logs show that no message is sent to the language server when I run the :format command. This exchange earlier in the logs may be a hint as to why:

2024-06-30T20:56:45.154 helix_term::application [DEBUG] received editor event: LanguageServerMessage((1, MethodCall(MethodCall { jsonrpc: Some(V2), method: "client/registerCapability", params: Map({"registrations": Array [Object {"id": String("biome_range_formatting"), "method": String("textDocument/rangeFormatting")}, Object {"id": String("biome_on_type_formatting"), "method": String("textDocument/onTypeFormatting"), "registerOptions": Object {"documentSelector": Null, "firstTriggerCharacter": String("}"), "moreTriggerCharacter": Array [String("]"), String(")")]}}, Object {"id": String("biome_formatting"), "method": String("textDocument/formatting")}, Object {"id": String("biome_did_change_workspace_settings"), "method": String("workspace/didChangeWatchedFiles"), "registerOptions": Object {"watchers": Array [Object {"globPattern": String("/home/robin/code/kuna/biome.json"), "kind": Number(7)}, Object {"globPattern": String("/home/robin/code/kuna/biome.jsonc"), "kind": Number(7)}, Object {"globPattern": String("/home/robin/code/kuna/rome.json"), "kind": Number(7)}]}}]}), id: Num(2) })))
2024-06-30T20:56:45.154 helix_term::application [WARN] Ignoring a client/registerCapability request because dynamic capability registration is not enabled. Please report this upstream to the language server
2024-06-30T20:56:45.154 helix_term::application [WARN] Ignoring a client/registerCapability request because dynamic capability registration is not enabled. Please report this upstream to the language server
2024-06-30T20:56:45.154 helix_term::application [WARN] Ignoring a client/registerCapability request because dynamic capability registration is not enabled. Please report this upstream to the language server

If the Biome language server isn't statically advertising that it's capable of formatting, that could explain why Helix isn't making any formatting request. I don't know a whole lot about LSP, but this comment suggests that Helix has no plans to support dynamic capability registration, but that things should generally still work without it.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@robintown
Copy link
Contributor Author

This is actually a Helix bug: helix-editor/helix#11064

@robintown robintown closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant