ruff server default to current working directory in environments without any root directories or workspaces#10398
Conversation
|
|
Testing this out... |
|
It's not giving me any diagnostics. The LSP logs have this error: I suspect this is because there's no workspace associated with that document, so the |
|
@dhruvmanila Right, it's failing to open because the file isn't associated with any workspace. The assumption that the server has made up until now is that any file being opened by the editor would have an associated workspace folder the client would have previously told us about, but this is clearly not the case. |
|
Actually, maybe what we need to do is just always create a new workspace in the session as a fallback mechanism if an file being opened isn't in a workspace path already. |
dhruvmanila
left a comment
There was a problem hiding this comment.
Thank you! I tested out using diagnostics, code actions, formatting and range formatting. It works well. LGTM!
ruff server now works in environments without any root directories or workspacesruff server default to current working directory in environments without any root directories or workspaces
Summary
Fixes #10324
This removes an overeager failure case where we would exit early if no root directory or workspace folders were provided on server initialization. We now fall-back to the current working directory as a workspace for that file.
Test Plan
N/A