mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-05 11:18:09 +00:00
![]() ## Summary This PR updates the server to keep track of open files both system and virtual files. This is done by updating the project by adding the file in the open file set in `didOpen` notification and removing it in `didClose` notification. This does mean that for workspace diagnostics, ty will only check open files because the behavior of different diagnostic builder is to first check `is_file_open` and only add diagnostics for open files. So, this required updating the `is_file_open` model to be `should_check_file` model which validates whether the file needs to be checked based on the `CheckMode`. If the check mode is open files only then it will check whether the file is open. If it's all files then it'll return `true` by default. Closes: astral-sh/ty#619 ## Test Plan ### Before There are two files in the project: `__init__.py` and `diagnostics.py`. In the video, I'm demonstrating the old behavior where making changes to the (open) `diagnostics.py` file results in re-parsing the file: https://github.com/user-attachments/assets/c2ac0ecd-9c77-42af-a924-c3744b146045 ### After Same setup as above. In the video, I'm demonstrating the new behavior where making changes to the (open) `diagnostics.py` file doesn't result in re-parting the file: https://github.com/user-attachments/assets/7b82fe92-f330-44c7-b527-c841c4545f8f |
||
---|---|---|
.. | ||
assertion.rs | ||
config.rs | ||
db.rs | ||
diagnostic.rs | ||
lib.rs | ||
matcher.rs | ||
parser.rs |