rome / tools

Unified developer tools for JavaScript, TypeScript, and the web
https://docs.rome.tools/
MIT License
23.8k stars 665 forks source link

πŸ› Available rules in VSCode extension `v0.18.0` don't match CLI `v10.0.0` #3603

Closed lgarron closed 1 year ago

lgarron commented 1 year ago

Environment information


block
CLI:
  Version:              10.0.0
  Color support:        true

Platform:
  CPU Architecture:     aarch64
  OS:                   macos

Environment:
  ROME_LOG_DIR:         unset
  NO_COLOR:             unset
  TERM:                 "xterm-256color"

Rome Configuration:
  Status:               loaded
  Formatter disabled:   false
  Linter disabled:      false

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.

Γ— Workspace rage failed: Method not found

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

β”œβ”€69202401ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€69202409ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€69202411ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”œβ”€69202411ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/lgarron/Code/git/github.com/mastodon/mastodon/rome.json"
β”œβ”€69202411ms ERROR rome_service::configuration Could not find the file configuration at "/Users/lgarron/Code/git/github.com/mastodon/mastodon/rome.json"
β”œβ”€69202411ms ERROR rome_service::configuration Reason: Os { code: 2, kind: NotFound, message: "No such file or directory" }
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(0)}
β”œβ”€β”˜
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(1)}
β”œβ”€β”˜
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(2)}
β”œβ”€β”˜
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(1)}
β”œβ”€β”˜
β”œβ”€β”rome_formatter::printer::Printer::print{}
β”œβ”€β”˜
β”œβ”€70450748ms WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(2)}
β”œβ”€β”˜
β”œβ”€70453443ms INFO tower_lsp::service::layers shutdown request received, shutting down
β”œβ”€70453443ms INFO tower_lsp::service::layers exit notification received, stopping
β”œβ”€70453485ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70453488ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70453489ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”œβ”€70453489ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/lgarron/Code/git/github.com/cubing/cubing.js/rome.json"
β”œβ”€β”rome_fs::fs::os::OsFile::read_to_string{}
β”œβ”€β”˜
β”œβ”€70453489ms INFO rome_lsp::session Configuration found, and it is valid!
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(0)}
β”œβ”€β”˜
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(1)}
β”œβ”€β”˜
β”œβ”€70467808ms INFO tower_lsp::service::layers shutdown request received, shutting down
β”œβ”€70467820ms INFO tower_lsp::service::layers exit notification received, stopping
β”œβ”€70469518ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70469521ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70469522ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”œβ”€70469522ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/lgarron/Code/git/github.com/cubing/cubing.js/rome.json"
β”œβ”€β”rome_fs::fs::os::OsFile::read_to_string{}
β”œβ”€β”˜
β”œβ”€70469522ms INFO rome_lsp::session Configuration found, and it is valid!
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(0)}
β”œβ”€β”˜
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(1)}
β”œβ”€β”˜
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(1)}
β”œβ”€β”˜
β”œβ”€β”rome_formatter::printer::Printer::print{}
β”œβ”€β”˜
β”œβ”€70610318ms WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
β”œβ”€70693757ms INFO tower_lsp::service::layers shutdown request received, shutting down
β”œβ”€70693771ms INFO tower_lsp::service::layers exit notification received, stopping
β”œβ”€70693831ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70694546ms INFO tower_lsp::service::layers shutdown request received, shutting down
β”œβ”€70694556ms INFO tower_lsp::service::layers exit notification received, stopping
β”œβ”€70694889ms INFO tower_lsp::service::layers shutdown request received, shutting down
β”œβ”€70694901ms INFO tower_lsp::service::layers exit notification received, stopping
β”œβ”€70695585ms INFO tower_lsp::service::layers shutdown request received, shutting down
β”œβ”€70695593ms INFO tower_lsp::service::layers exit notification received, stopping
β”œβ”€70695602ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70700672ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70700682ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70700718ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”œβ”€70700718ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/lgarron/Code/git/github.com/lgarron/trusted-types-playground/rome.json"
β”œβ”€70700718ms ERROR rome_service::configuration Could not find the file configuration at "/Users/lgarron/Code/git/github.com/lgarron/trusted-types-playground/rome.json"
β”œβ”€70700718ms ERROR rome_service::configuration Reason: Os { code: 2, kind: NotFound, message: "No such file or directory" }
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(0)}
β”œβ”€β”˜
β”œβ”€70701052ms WARN tower_lsp::service::pending client asked to cancel request 1, but no such pending request exists, ignoring
β”œβ”€70701724ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70701776ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70701915ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”œβ”€70701915ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/lgarron/Code/git/github.com/cubing/timer/rome.json"
β”œβ”€β”rome_fs::fs::os::OsFile::read_to_string{}
β”œβ”€β”˜
β”œβ”€70701916ms INFO rome_lsp::session Configuration found, and it is valid!
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(0)}
β”œβ”€β”˜
β”œβ”€70704351ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70704372ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70704394ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”œβ”€70704394ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/lgarron/Code/git/github.com/mastodon/mastodon/rome.json"
β”œβ”€70704394ms ERROR rome_service::configuration Could not find the file configuration at "/Users/lgarron/Code/git/github.com/mastodon/mastodon/rome.json"
β”œβ”€70704394ms ERROR rome_service::configuration Reason: Os { code: 2, kind: NotFound, message: "No such file or directory" }
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(0)}
β”œβ”€β”˜
β”œβ”€70705148ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70705153ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70705159ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”œβ”€70705160ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/lgarron/Code/git/github.com/cubing/alg.cubing.net/rome.json"
β”œβ”€70705160ms ERROR rome_service::configuration Could not find the file configuration at "/Users/lgarron/Code/git/github.com/cubing/alg.cubing.net/rome.json"
β”œβ”€70705160ms ERROR rome_service::configuration Reason: Os { code: 2, kind: NotFound, message: "No such file or directory" }
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(0)}
β”œβ”€β”˜
β”œβ”€70743407ms WARN tower_lsp::service::pending client asked to cancel request 1, but no such pending request exists, ignoring
β”œβ”€70743437ms WARN tower_lsp::service::pending client asked to cancel request 2, but no such pending request exists, ignoring
β”œβ”€70743455ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70743455ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70743468ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”œβ”€70743468ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/lgarron/Code/git/github.com/cubing/cubing.js/rome.json"
β”œβ”€β”rome_fs::fs::os::OsFile::read_to_string{}
β”œβ”€β”˜
β”œβ”€70743469ms INFO rome_lsp::session Configuration found, and it is valid!
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(0)}
β”œβ”€β”˜
β”œβ”€β”rome_js_parser::parse::parse{file_id=FileId(1)}
β”œβ”€β”˜
β”œβ”€70911321ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70911322ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
β”œβ”€70919313ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€70919314ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)

What happened?

git clone https://github.com/cubing/cubing.js && cd cubing.js
git checkout 0f0d36c7b88458e326f5754338ae01296dbe3383
npm install rome@latest
npx rome check ./script ./src

Now, the CLI halts on the following "unknown" rules, which were previously valid:

Removing those from rome.json allows the CLI to run, but now it expects correctness/useTemplate to be called style/useTemplate on this line: https://github.com/cubing/cubing.js/blob/0f0d36c7b88458e326f5754338ae01296dbe3383/src/sites/experiments.cubing.net/cubing.js/speechcubing/index.ts#L39 However, changing that line to use // rome-ignore lint(style/useTemplate) now causes the Rome VSCode extension to make the rome-ignore comment rule as unknown, and the relevant code to be marked with an error.

Also see: https://github.com/rome/tools/issues/3507#issuecomment-1293122392

Expected result

The CLI and the extension agree on rules.

Ideally, they would also do one of the following:

Alternatively, it would be nice to be able have the extension use the CLI from node_modules, so that they're always consistent: https://github.com/rome/tools/discussions/3218

Code of Conduct

MichaReiser commented 1 year ago

From the rage command I can see that the Rome server used by the LSP must be older than the 10.0 version as it doesn't support the rage command.

Can you try running npx rome stop to force a restart of the Rome LSP. It is a known limitation that you must restart Rome after updating it in the package.json

lgarron commented 1 year ago

Can you try running npx rome stop to force a restart of the Rome LSP.

This somehow seems to prevent the extension from properly working at all, even after a full VSCode restart. If I mangle some code enable verbose trace logging, I see messages like the following in the trace log, but they are not highlighted in the VSCode editor at all.

[Trace - 11:23:04 PM] Received response 'textDocument/codeAction - (14)' in 4ms.
Result: [
    {
        "edit": {
            "changes": {
                "file:///Users/lgarron/Downloads/sdkfljdsf/cubing.js/src/sites/experiments.cubing.net/cubing.js/speechcubing/index.ts": [
                    {
                        "newText": " {",
                        "range": {
                            "end": {
                                "character": 19,
                                "line": 84
                            },
                            "start": {
                                "character": 19,
                                "line": 84
                            }
                        }
                    },
                    {
                        "newText": "}\n      ",
                        "range": {
                            "end": {
                                "character": 6,
                                "line": 88
                            },
                            "start": {
                                "character": 6,
                                "line": 88
                            }
                        }
                    }
                ]
            }
        },
        "kind": "quickfix",
        "title": "Wrap the statements in a block"
    }
]

npx rome rage does seem to show it successfully using v10.0.0 of the CLI, but I'd have to manually redact the full output before sharing.

MichaReiser commented 1 year ago

npx rome rage does seem to show it successfully using v10.0.0 of the CLI, but I'd have to manually redact the full output before sharing.

You can share the output of rome rage without the logs attached. That may already be helpful to understand if we are running into a version mismatch or not.

github-actions[bot] commented 1 year ago

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

lgarron commented 1 year ago

Now that the CLI is able to use the version of Rome from node_modules, I no longer run into this issue.