From 625a9319f68148e24d64b15653c03c4d02b18405 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Mon, 4 Mar 2024 15:48:23 +0000 Subject: feat(lsp): include registry url in jsr import hover text (#22676) --- tests/integration/lsp_tests.rs | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'tests/integration/lsp_tests.rs') diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index cbf272581..4ea4336a5 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -2514,6 +2514,55 @@ fn lsp_hover_typescript_types() { client.shutdown(); } +#[test] +fn lsp_hover_jsr() { + 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(); + client.did_open(json!({ + "textDocument": { + "uri": temp_dir.uri().join("file.ts").unwrap(), + "languageId": "typescript", + "version": 1, + "text": "import \"jsr:@denotest/add@1.0.0\";\n", + } + })); + client.write_request( + "workspace/executeCommand", + json!({ + "command": "deno.cache", + "arguments": [[], temp_dir.uri().join("file.ts").unwrap()], + }), + ); + let res = client.write_request( + "textDocument/hover", + json!({ + "textDocument": { + "uri": temp_dir.uri().join("file.ts").unwrap(), + }, + "position": { "line": 0, "character": 7 }, + }), + ); + assert_eq!( + res, + json!({ + "contents": { + "kind": "markdown", + "value": "**Resolved Dependency**\n\n**Code**: jsr​:​@denotest/add​@1.0.0 ()\n", + }, + "range": { + "start": { "line": 0, "character": 7 }, + "end": { "line": 0, "character": 32 }, + }, + }), + ); + client.shutdown(); +} + #[test] fn lsp_hover_jsdoc_symbol_link() { let context = TestContextBuilder::new().use_temp_cwd().build(); -- cgit v1.2.3