Skip to content

Server log messages should use window/logMessage #10968

Description

@dhruvmanila

Currently, the server uses the tracing module for log messages which sends everything to stderr. This gets picked up by the client and is added to the log messages at different level regardless of the level used in the server. This level is set by the client.

Here's what VS Code shows:

2024-04-16 12:00:50.229 [info] ┐ruff_server::server::api::notifications::did_change::run{file=file:///Users/dhruv/playground/python/animation.py}
┘
2024-04-16 11:59:47.905 [info]    0.101369s ERROR ruff_server::session The following error occurred when trying to find a configuration file at `/Users/dhruv/playground/python`:
No pyproject.toml/ruff.toml/.ruff.toml file was found
   0.101425s ERROR ruff_server::session Falling back to default configuration for `/Users/dhruv/playground/python`

Here's what Neovim shows:

[START][2024-04-16 12:06:02] LSP logging initiated
[ERROR][2024-04-16 12:06:02] .../vim/lsp/rpc.lua:789	"rpc"	"/Users/dhruv/work/astral/ruff-test/target/debug/ruff"	"stderr"	"   0.001027s DEBUG ruff_server::server No workspace(s) were provided during initialization. Using the current working directory as a default workspace...\n"
[ERROR][2024-04-16 12:06:02] .../vim/lsp/rpc.lua:789	"rpc"	"/Users/dhruv/work/astral/ruff-test/target/debug/ruff"	"stderr"	"   0.041356s ERROR ruff_server::session The following error occurred when trying to find a configuration file at `/Users/dhruv/playground/python`:\nNo pyproject.toml/ruff.toml/.ruff.toml file was found\n   0.041386s ERROR ruff_server::session Falling back to default configuration for `/Users/dhruv/playground/python`\n"
[ERROR][2024-04-16 12:06:02] .../vim/lsp/rpc.lua:789	"rpc"	"/Users/dhruv/work/astral/ruff-test/target/debug/ruff"	"stderr"	"   0.044606s WARN ruff_server::server LSP client does not support dynamic capability registration - automatic configuration reloading will not be available.\n┐ruff_server::server::api::notifications::did_open::run{file=file:///Users/dhruv/playground/python/errors.py}\n┘\n"

This is not a high priority. We would need to look at all the messages using tracing and convert most of them to use the notification request instead.

Activity

  1. dhruvmanila commented on Apr 16, 2024

    @dhruvmanila
    MemberAuthor
  2. self-assigned this
    on Apr 16, 2024
  3. snowsignal commented on Apr 16, 2024

    @snowsignal
    Contributor

    Thanks for opening an issue for this @dhruvmanila

  4. added this to the Ruff Server: Beta milestone on Apr 16, 2024
  5. removed this from the Ruff Server: Beta milestone on May 22, 2024
  6. snowsignal commented on Jun 9, 2024

    @snowsignal
    Contributor

    We decided to continue using stderr for now. I'll keep this issue open to track the tracing rewrite.

  7. added a commit that references this issue on Jun 11, 2024
    507f5c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

serverRelated to the Ruff or ty LSP server

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions