Open ArcticOc opened 1 day ago
Can you provide the logs using the following VS Code settings?
{
"ruff.trace.server": "messages",
"ruff.logLevel": "debug"
}
During the initialization of ruff, the following error appeared:
Error while resolving settings from workspace /. Please refer to the logs for more details.
Have you opened the editor in the system root directory? If so, then the extension would traverse the entire system to collect all the configuration that are present in the nested directories and it could happen that one or the other configuration file is invalid.
Can you provide the logs using the following VS Code settings?
{ "ruff.trace.server": "messages", "ruff.logLevel": "debug" }
I think I get it. When opening a single file instead of a folder, Ruff cannot find the workspace and can only use workspace /
, which causes an error. But when opening a folder, there is no problem.
2024-10-08 17:19:07.605 [info] [Trace - 5:19:07 PM] 0.000051083s WARN main ruff_server::server: No workspace(s) were provided during initialization. Using the current working directory as a default workspace...
2024-10-08 17:19:07.605 [info] [Trace - 5:19:07 PM] 0.000541417s WARN main ruff_server::server: No workspace settings found for file:///
Same issue here. Interestingly, I tried reverting to previous versions of the extension but the problem is also there.
When opening a single file instead of a folder, Ruff cannot find the workspace and can only use workspace
/
, which causes an error. But when opening a folder, there is no problem.
This is not exactly true. The client is responsible for providing the workspace, so in your case, the client wasn't able to find any workspace. This leads to Ruff using the current working directory as the default workspace which in your case seems to be the system root directory (/
).
Can you provide the log messages after turning them on to diagnose the error notification that you received?
Same issue here. Interestingly, I tried reverting to previous versions of the extension but the problem is also there.
@ffisc Please provide any log messages if possible to help diagnose the issue.
This is not exactly true. The client is responsible for providing the workspace, so in your case, the client wasn't able to find any workspace. This leads to Ruff using the current working directory as the default workspace which in your case seems to be the system root directory (
/
).
However, when I open the folder containing the file, it finds the correct workspace and works fine.
Here is the entire log.
However, when I open the folder containing the file, it finds the correct workspace and works fine.
I think that is an expected behavior.
Thanks for providing the logs although I don't see any error messages in it. As mentioned, I think you were opening the editor in the system root directory which means it would take some time to load the extension completely because it tries to index the entire root directory. I'm really curious to know why the error is occurring although I'm mostly sure that one of the config on your system is invalid :)
I can reproduce this behavior.
Ruff ends up indexing the entire root partition. This is unlikely what the user wanted. I don't have a good suggestion on what the extension should do in this case. What are other extensions doing in this case?
And that file is in the root directory, right? This is related to https://github.com/astral-sh/ruff/issues/11366 then. One solution would be to not index the workspace if there's none provided aka using the server for single file. Any nested configs shouldn't affect the output for this specific file.
No. The file is in a subdirectory of my home directory
@ffisc Please provide any log messages if possible to help diagnose the issue.
Sure, here:
2024-10-09 13:01:55.788 [info] Name: Ruff
2024-10-09 13:01:55.788 [info] Module: ruff
2024-10-09 13:01:55.788 [info] Python extension loading
2024-10-09 13:01:55.788 [info] Waiting for interpreter from python extension.
2024-10-09 13:01:56.175 [info] Python extension loaded
2024-10-09 13:01:56.190 [info] Using interpreter: /Users/ffi/dev/benchmarks/foo/bar/.venv/bin/python
2024-10-09 13:01:56.206 [info] Using bundled executable: /Users/ff/.vscode-insiders/extensions/charliermarsh.ruff-2024.50.0-darwin-arm64/bundled/libs/bin/ruff
2024-10-09 13:01:56.318 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-10-09 13:01:56.321 [info] Found Ruff 0.6.6 at /Users/ff/.vscode-insiders/extensions/charliermarsh.ruff-2024.50.0-darwin-arm64/bundled/libs/bin/ruff
2024-10-09 13:01:56.321 [info] Server run command: /Users/ff/.vscode-insiders/extensions/charliermarsh.ruff-2024.50.0-darwin-arm64/bundled/libs/bin/ruff server
2024-10-09 13:01:56.322 [info] Server: Start requested.
Hi,
The ruff extension could not resolve the configuration path set in the
settings.json
suddenly.During the initialization of ruff, the following error appeared:
Error while resolving settings from workspace /. Please refer to the logs for more details.
Here is the log.
Version
Ruff: 0.6.6 (v2024.50.0) VSCode: 1.94