tools icon indicating copy to clipboard operation
tools copied to clipboard

πŸ› Text formatting capabilities not reported in Neovim

Open ProspectPyxis opened this issue 2 years ago β€’ 3 comments

Environment information

CLI:
  Version:                      0.0.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  ROME_LOG_DIR:                 unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

Rome Configuration:
  Status:                       unset

Workspace:
  Open Documents:               0

Discovering running Rome servers...

Running Rome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The client isn't connected to any server but rage discovered this running Rome server.

Server:
  Version:                      0.0.0
  Name:                         rome_lsp
  CPU Architecture:             x86_64
  OS:                           linux

Workspace:
  Open Documents:               0

Other Active Server Workspaces:

Workspace:
  Open Documents:               1
  Client Name:                  Neovim
  Client Version:               0.9.0

Rome Server Log:

! Please review the content of the log file before sharing it publicly as it may contain sensitive information:
  * Path names that may reveal your name, a project name, or the name of your employer.
  * Source code

β”œβ”€β”rome_lsp::server::initialize{capabilities=ClientCapabilities { workspace: None, text_document: None, window: None, general: None, experimental: None }, client_info=ClientInfo { name: "rome_service", version: Some("0.0.0") }}
β”‚ β”œβ”€0ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€β”˜
β”œβ”€β”rome_lsp::server::rome/rage{params=RageParams}
β”œβ”€β”˜
β”œβ”€β”rome_lsp::server::initialize{capabilities=ClientCapabilities { workspace: None, text_document: None, window: None, general: None, experimental: None }, client_info=ClientInfo { name: "rome_service", version: Some("0.0.0") }}
β”‚ β”œβ”€0ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€β”˜
β”œβ”€β”rome_lsp::server::rome/rage{params=RageParams}
β”œβ”€β”˜

What happened?

  1. Setup the rome language server with nvim-lspconfig in Neovim, with no extra config options
  2. Open a typescript file in Neovim
  3. Attempt to run the command :lua vim.lsp.buf.format()
  4. File isn't formatted, and error message appears:
[LSP] Format request failed, no matching language servers.

Looking at the logs here: https://gist.github.com/ProspectPyxis/d3e665dedf1c0091cb27c0ec0b63ff0f, it seems like somehow, Rome just doesn't report textDocument/formatting as a capability when initializing.

Expected result

Rome should report the capability correctly and allow Neovim to format with the command.

Code of Conduct

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

ProspectPyxis avatar May 09 '23 10:05 ProspectPyxis

you can format with rome with null-ls or just set up a format command with efm-langserver

yoomaxxx avatar May 10 '23 15:05 yoomaxxx

I'm aware and have been using null-ls as a workaround, though I'd prefer to have a non-null-ls setup if possible.

ProspectPyxis avatar May 11 '23 01:05 ProspectPyxis

I have a PR that adds support for dynamic registration to Neovim. Once it's merged, formatting will work as intended.

https://github.com/neovim/neovim/pull/23681

folke avatar May 19 '23 15:05 folke