feat(lsp): ability to set DENO_DIR via settings (#11527)

Ref: denoland/vscode_deno#287
This commit is contained in:
Kitson Kelly 2021-07-28 07:25:09 +10:00 committed by GitHub
parent fd0b24b246
commit 667b026798
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 213 additions and 25 deletions

View file

@ -254,8 +254,10 @@ pub struct ModuleRegistry {
impl Default for ModuleRegistry {
fn default() -> Self {
let custom_root = std::env::var("DENO_DIR").map(String::into).ok();
let dir = deno_dir::DenoDir::new(custom_root).unwrap();
// This only gets used when creating the tsc runtime and for testing, and so
// it shouldn't ever actually access the DenoDir, so it doesn't support a
// custom root.
let dir = deno_dir::DenoDir::new(None).unwrap();
let location = dir.root.join("registries");
let http_cache = HttpCache::new(&location);
let cache_setting = CacheSetting::Use;