summaryrefslogtreecommitdiff
path: root/cli/tests/integration/lsp_tests.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2022-01-07 11:27:13 +1100
committerGitHub <noreply@github.com>2022-01-07 11:27:13 +1100
commit57bfa87b2c56809eedcc64bf63be9dcdd6c7400f (patch)
treea93fe2d056323754f8d45d64c5fbc7204b06ee12 /cli/tests/integration/lsp_tests.rs
parent2067820714fea49be1692fa678754488ace8228b (diff)
feat(lsp): provide registry details on hover if present (#13294)
Closes: #13272
Diffstat (limited to 'cli/tests/integration/lsp_tests.rs')
-rw-r--r--cli/tests/integration/lsp_tests.rs39
1 files changed, 37 insertions, 2 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index a3e1138b6..6a7002b49 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -3044,7 +3044,8 @@ fn lsp_cache_location() {
let _g = http_server();
let temp_dir = TempDir::new().expect("could not create temp dir");
let mut params: lsp::InitializeParams =
- serde_json::from_value(load_fixture("initialize_params.json")).unwrap();
+ serde_json::from_value(load_fixture("initialize_params_registry.json"))
+ .unwrap();
params.root_uri = Some(Url::from_file_path(temp_dir.path()).unwrap());
if let Some(Value::Object(mut map)) = params.initialization_options {
@@ -3075,7 +3076,7 @@ fn lsp_cache_location() {
load_fixture("did_open_params_import_hover.json"),
);
let diagnostics = diagnostics.into_iter().flat_map(|x| x.diagnostics);
- assert_eq!(diagnostics.count(), 12);
+ assert_eq!(diagnostics.count(), 14);
let (maybe_res, maybe_err) = client
.write_request::<_, _, Value>(
"deno/cache",
@@ -3123,6 +3124,40 @@ fn lsp_cache_location() {
}
}))
);
+ let (maybe_res, maybe_err) = client
+ .write_request::<_, _, Value>(
+ "textDocument/hover",
+ json!({
+ "textDocument": {
+ "uri": "file:///a/file.ts",
+ },
+ "position": {
+ "line": 7,
+ "character": 28
+ }
+ }),
+ )
+ .unwrap();
+ assert!(maybe_err.is_none());
+ assert_eq!(
+ maybe_res,
+ Some(json!({
+ "contents": {
+ "kind": "markdown",
+ "value": "**Resolved Dependency**\n\n**Code**: http&#8203;://localhost:4545/x/a/mod.ts\n\n\n---\n\n**a**\n\nmod.ts"
+ },
+ "range": {
+ "start": {
+ "line": 7,
+ "character": 19
+ },
+ "end": {
+ "line": 7,
+ "character": 53
+ }
+ }
+ }))
+ );
let cache_path = temp_dir.path().join(".cache");
assert!(cache_path.is_dir());
assert!(cache_path.join("gen").is_dir());