Skip to content

ruff native server error when working on a untitled buffer with VsCode #11674

@rainzee

Description

@rainzee

Abstract

When working in an untitled editor buffer with a local native Ruff server turned on, it consistently leads to an error.

Steps to Reproduction

To reproduce, create a new untitled editor buffer in Visual Studio Code (VSCode), choose the language Python, and write any Python code. This will result in the following error message: Ruff encountered a problem. Check the logs for more details.

1742.246534s ERROR ruff_server::server::api An error occurred while running textDocument/didChange: Tried to open unavailable document `untitled:Untitled-1`

2024-06-01 13:04:50.434 [info] [Trace - 13:04:50] Received notification 'window/showMessage'.
2024-06-01 13:04:50.436 [info] [Trace - 13:04:50] Sending notification '$/cancelRequest'.
2024-06-01 13:04:50.437 [info] ┐ruff_server::server::api::notifications::cancel::run{}
┘

2024-06-01 13:04:50.698 [info] [Trace - 13:04:50] Sending request 'textDocument/codeAction - (40)'.
2024-06-01 13:04:50.699 [info] 1742.511805s WARN ruff_server::session::workspace Workspace not found for untitled:Untitled-1. Global settings will be used for this document

2024-06-01 13:04:50.960 [info] [Trace - 13:04:50] Sending request 'textDocument/codeAction - (41)'.
2024-06-01 13:04:50.961 [info] [Trace - 13:04:50] Sending notification '$/cancelRequest'.
2024-06-01 13:04:50.962 [info] 1742.774422s WARN ruff_server::session::workspace Workspace not found for untitled:Untitled-1. Global settings will be used for this document

2024-06-01 13:04:50.962 [info] ┐ruff_server::server::api::notifications::cancel::run{}
┘

Reference

This issue was originally provided by @yanyongyu and has been consistently reproduced in my environment as well. Additionally, there was a related issue report #9870, which has been the last hurdle in our workflow. Unfortunately, that issue has been on hold for a while. Could you please investigate further or let us know if more information is needed?

Thanks for such great work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    serverRelated to the LSP server

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions