mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
fix(lsp): disable no-cache diagnostics for jsr specifiers (#22284)
This commit is contained in:
parent
7c111da5f6
commit
327b5b280b
2 changed files with 25 additions and 0 deletions
|
@ -1332,6 +1332,8 @@ fn diagnose_resolution(
|
||||||
None => diagnostics.push(DenoDiagnostic::NoAttributeType),
|
None => diagnostics.push(DenoDiagnostic::NoAttributeType),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if specifier.scheme() == "jsr" {
|
||||||
|
// TODO(nayeemrmn): Check if jsr specifiers are cached.
|
||||||
} else if let Ok(pkg_ref) =
|
} else if let Ok(pkg_ref) =
|
||||||
NpmPackageReqReference::from_specifier(specifier)
|
NpmPackageReqReference::from_specifier(specifier)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4657,6 +4657,29 @@ fn lsp_code_actions_deno_cache() {
|
||||||
client.shutdown();
|
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]
|
#[test]
|
||||||
fn lsp_code_actions_deno_cache_npm() {
|
fn lsp_code_actions_deno_cache_npm() {
|
||||||
let context = TestContextBuilder::new().use_temp_cwd().build();
|
let context = TestContextBuilder::new().use_temp_cwd().build();
|
||||||
|
|
Loading…
Reference in a new issue