Files
Charlie Marsh 295982d191 [ty] Skip inclusion checks when selecting a program under a source root (#30702)
## Summary

On every workspace symbol search, ty rechecks the project’s include and
exclude patterns for each file to decide which Python environment to
use. Even an excluded file under a first-party source root gets the
project’s environment: the dependency lookup prefers the project’s
search paths over any script’s.

After checking for a standalone script, return the project program for
files under a first-party root. This changes neither which files we
check nor which environment they use. Files outside those roots still go
through the existing checks after an extra prefix test per root.

Searching [mypy’s
package](https://github.com/python/mypy/tree/412c19a6bde31e7afa7f41afdf8356664689ae80/mypy)
for each prefix from `check_overlapp` through `check_overlapping_ov`
used **13.69–14.91% fewer instructions**. Cachegrind counted the
language server from startup to shutdown in two pairs run in opposite
orders. All seven responses matched byte for byte. Consecutive baseline
counts differed by 0.35%.

Passing all 682 [django-stubs
files](https://github.com/typeddjango/django-stubs/tree/ac7aec200cc78902dd48ab8ceb23cd8434b3b72d/django-stubs)
individually to `ty check` used **31.62–31.70% fewer instructions**.
Passing the directory instead saved 0.83–0.92%. All runs produced the
same 502 diagnostics.
2026-11-21 10:31:00 -05:00
..