summaryrefslogtreecommitdiff
path: root/tests/integration/lsp_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/lsp_tests.rs')
-rw-r--r--tests/integration/lsp_tests.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs
index 3ae738111..cbf272581 100644
--- a/tests/integration/lsp_tests.rs
+++ b/tests/integration/lsp_tests.rs
@@ -349,6 +349,7 @@ fn lsp_import_map_embedded_in_config_file() {
temp_dir.write(
"deno.embedded_import_map.jsonc",
r#"{
+ // some comment
"imports": {
"/~/": "./lib/"
}
@@ -655,6 +656,51 @@ fn lsp_import_map_config_file_auto_discovered_symlink() {
}
#[test]
+fn lsp_deno_json_imports_comments_cache() {
+ let context = TestContextBuilder::new()
+ .use_http_server()
+ .use_temp_cwd()
+ .build();
+ let temp_dir = context.temp_dir();
+ temp_dir.write(
+ "deno.jsonc",
+ r#"{
+ // comment
+ "imports": {
+ "print_hello": "http://localhost:4545/import_maps/print_hello.ts",
+ },
+ }"#,
+ );
+ temp_dir.write(
+ "file.ts",
+ r#"
+ import { printHello } from "print_hello";
+ printHello();
+ "#,
+ );
+ let mut client = context.new_lsp_command().build();
+ client.initialize_default();
+ client.write_request(
+ "workspace/executeCommand",
+ json!({
+ "command": "deno.cache",
+ "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ }),
+ );
+
+ let diagnostics = client.did_open(json!({
+ "textDocument": {
+ "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "languageId": "typescript",
+ "version": 1,
+ "text": temp_dir.read_to_string("file.ts"),
+ }
+ }));
+ assert_eq!(diagnostics.all(), vec![]);
+ client.shutdown();
+}
+
+#[test]
fn lsp_import_map_node_specifiers() {
let context = TestContextBuilder::for_npm().use_temp_cwd().build();
let temp_dir = context.temp_dir();