Commits
Click on a commit to change the comparison range[ruff server] Find config for files outside of open workspaces
Fixes #17944
There's two different routes we can go down for finding settings for such files:
- the file is below an open workspace, so we can add any settings we find to
that workspace
- the file is not below an open workspace, in which case we can't cache them
Given this filesystem layout:
```
.
├── dir_0
│ ├── ruff.toml
│ └── test_0.py
└── dir_1
├── ruff.toml
└── test_1.py
```
This fixes:
- cwd at top-level, opening `dir_0/test_0.py`
- cwd at top-level, opening `dir_0/test_0.py`, then `../dir_1/test_1.py` in same session
- cwd in `dir_0`, opening `../dir_1/test_1.py`
- cwd in `dir_0`, opening `test_0.py` first, then `../dir_1/test_1.py` in same session
without negatively affecting non-default workspaces (such as opening the folder
in VS Code or `lsp-mode` in Emacs).
The main downside to this approach is the lack of workspace for files in `dir_1`
-- we can't share already parsed settings.
---
This doesn't work for the situation where we're opening a file in a nested
directory below the default workspace, where we _do_ have a config file:
```
.
├── subdir
│ ├── ruff.toml
│ └── test_1.py
├── ruff.toml
└── test_0.py
```
Opening `test_0.py` first (in single file mode), and then opening
`subdir/test_1.py` still uses the settings from `./ruff.toml` instead of `subdir/ruff.toml`