fix(lsp): disable no-cache diagnostics for jsr specifiers (#22284)

This commit is contained in:
Nayeem Rahman 2024-02-06 14:56:26 +00:00 committed by GitHub
parent 7c111da5f6
commit 327b5b280b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View file

@ -1332,6 +1332,8 @@ fn diagnose_resolution(
None => diagnostics.push(DenoDiagnostic::NoAttributeType),
}
}
} else if specifier.scheme() == "jsr" {
// TODO(nayeemrmn): Check if jsr specifiers are cached.
} else if let Ok(pkg_ref) =
NpmPackageReqReference::from_specifier(specifier)
{

View file

@ -4657,6 +4657,29 @@ fn lsp_code_actions_deno_cache() {
client.shutdown();
}
#[test]
fn lsp_jsr_uncached() {
let context = TestContextBuilder::new()
.use_http_server()
.use_temp_cwd()
.build();
let temp_dir = context.temp_dir();
let mut client = context.new_lsp_command().build();
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
"uri": temp_dir.uri().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"import "jsr:@foo/bar";"#,
},
}));
// TODO(nayeemrmn): This should check if the jsr dep is cached and give a
// diagnostic.
assert_eq!(json!(diagnostics.all()), json!([]));
client.shutdown();
}
#[test]
fn lsp_code_actions_deno_cache_npm() {
let context = TestContextBuilder::new().use_temp_cwd().build();