[ty] Support LSP go-to with vendored typeshed stubs (#19057)

## Summary

Extracts the vendored typeshed stubs lazily and caches them on the local
filesystem to support go-to in the LSP.

Resolves https://github.com/astral-sh/ty/issues/77.
This commit is contained in:
Ibraheem Ahmed 2025-07-02 07:58:58 -04:00 committed by GitHub
parent f7fc8fb084
commit ebc70a4002
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 200 additions and 11 deletions

View file

@ -8,7 +8,7 @@ use ruff_db::source::{line_index, source_text};
use ruff_db::system::walk_directory::WalkDirectoryBuilder;
use ruff_db::system::{
CaseSensitivity, DirectoryEntry, GlobError, MemoryFileSystem, Metadata, PatternError, System,
SystemPath, SystemPathBuf, SystemVirtualPath,
SystemPath, SystemPathBuf, SystemVirtualPath, WritableSystem,
};
use ruff_notebook::Notebook;
use ruff_python_formatter::formatted_file;
@ -695,6 +695,10 @@ impl System for WasmSystem {
None
}
fn cache_dir(&self) -> Option<SystemPathBuf> {
None
}
fn read_directory<'a>(
&'a self,
path: &SystemPath,
@ -715,6 +719,10 @@ impl System for WasmSystem {
Ok(Box::new(self.fs.glob(pattern)?))
}
fn as_writable(&self) -> Option<&dyn WritableSystem> {
None
}
fn as_any(&self) -> &dyn Any {
self
}