mirror of
https://github.com/denoland/deno.git
synced 2025-09-30 22:21:15 +00:00
fix(lsp): display module types only dependencies on hover (#12683)
Fixes: #12675
This commit is contained in:
parent
91f8bdda2c
commit
182de1452b
3 changed files with 115 additions and 10 deletions
|
@ -1066,6 +1066,76 @@ fn lsp_hover_dependency() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lsp_hover_typescript_types() {
|
||||
let _g = http_server();
|
||||
let mut client = init("initialize_params.json");
|
||||
did_open(
|
||||
&mut client,
|
||||
json!({
|
||||
"textDocument": {
|
||||
"uri": "file:///a/file.ts",
|
||||
"languageId": "typescript",
|
||||
"version": 1,
|
||||
"text": "import * as a from \"http://127.0.0.1:4545/xTypeScriptTypes.js\";\n\nconsole.log(a.foo);\n",
|
||||
}
|
||||
}),
|
||||
);
|
||||
let (maybe_res, maybe_err) = client
|
||||
.write_request::<_, _, Value>(
|
||||
"deno/cache",
|
||||
json!({
|
||||
"referrer": {
|
||||
"uri": "file:///a/file.ts",
|
||||
},
|
||||
"uris": [
|
||||
{
|
||||
"uri": "http://127.0.0.1:4545/xTypeScriptTypes.js",
|
||||
}
|
||||
],
|
||||
}),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(maybe_err.is_none());
|
||||
assert!(maybe_res.is_some());
|
||||
let (maybe_res, maybe_err) = client
|
||||
.write_request::<_, _, Value>(
|
||||
"textDocument/hover",
|
||||
json!({
|
||||
"textDocument": {
|
||||
"uri": "file:///a/file.ts"
|
||||
},
|
||||
"position": {
|
||||
"line": 0,
|
||||
"character": 24
|
||||
}
|
||||
}),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(maybe_res.is_some());
|
||||
assert!(maybe_err.is_none());
|
||||
assert_eq!(
|
||||
json!(maybe_res.unwrap()),
|
||||
json!({
|
||||
"contents": {
|
||||
"kind": "markdown",
|
||||
"value": "**Resolved Dependency**\n\n**Code**: http​://127.0.0.1:4545/xTypeScriptTypes.js\n\n**Types**: http​://127.0.0.1:4545/xTypeScriptTypes.d.ts\n"
|
||||
},
|
||||
"range": {
|
||||
"start": {
|
||||
"line": 0,
|
||||
"character": 19
|
||||
},
|
||||
"end": {
|
||||
"line": 0,
|
||||
"character": 62
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
shutdown(&mut client);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lsp_call_hierarchy() {
|
||||
let mut client = init("initialize_params.json");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue