mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-25 14:24:10 +00:00
[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:
parent
f7fc8fb084
commit
ebc70a4002
12 changed files with 200 additions and 11 deletions
|
|
@ -226,6 +226,10 @@ impl System for MdtestSystem {
|
|||
self.as_system().user_config_directory()
|
||||
}
|
||||
|
||||
fn cache_dir(&self) -> Option<SystemPathBuf> {
|
||||
self.as_system().cache_dir()
|
||||
}
|
||||
|
||||
fn read_directory<'a>(
|
||||
&'a self,
|
||||
path: &SystemPath,
|
||||
|
|
@ -253,6 +257,10 @@ impl System for MdtestSystem {
|
|||
.glob(self.normalize_path(SystemPath::new(pattern)).as_str())
|
||||
}
|
||||
|
||||
fn as_writable(&self) -> Option<&dyn WritableSystem> {
|
||||
Some(self)
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
|
@ -263,6 +271,10 @@ impl System for MdtestSystem {
|
|||
}
|
||||
|
||||
impl WritableSystem for MdtestSystem {
|
||||
fn create_new_file(&self, path: &SystemPath) -> ruff_db::system::Result<()> {
|
||||
self.as_system().create_new_file(&self.normalize_path(path))
|
||||
}
|
||||
|
||||
fn write_file(&self, path: &SystemPath, content: &str) -> ruff_db::system::Result<()> {
|
||||
self.as_system()
|
||||
.write_file(&self.normalize_path(path), content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue