summaryrefslogtreecommitdiff
path: root/cli/tests/integration/lsp_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration/lsp_tests.rs')
-rw-r--r--cli/tests/integration/lsp_tests.rs70
1 files changed, 70 insertions, 0 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index 6fbeec344..6e009bd20 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -1067,6 +1067,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&#8203;://127.0.0.1:4545/xTypeScriptTypes.js\n\n**Types**: http&#8203;://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");
did_open(