summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests_lsp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration_tests_lsp.rs')
-rw-r--r--cli/tests/integration_tests_lsp.rs116
1 files changed, 115 insertions, 1 deletions
diff --git a/cli/tests/integration_tests_lsp.rs b/cli/tests/integration_tests_lsp.rs
index cb9eae5a8..10797a326 100644
--- a/cli/tests/integration_tests_lsp.rs
+++ b/cli/tests/integration_tests_lsp.rs
@@ -1092,7 +1092,7 @@ fn lsp_code_lens_impl() {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
- "text": "interface A {\n b(): void;\n}\n\nclass B implements A {\n b() {\n console.log(\"b\");\n }\n}\n"
+ "text": "interface A {\n b(): void;\n}\n\nclass B implements A {\n b() {\n console.log(\"b\");\n }\n}\n\ninterface C {\n c: string;\n}\n"
}
}),
);
@@ -1137,6 +1137,47 @@ fn lsp_code_lens_impl() {
maybe_res,
Some(load_fixture("code_lens_resolve_response_impl.json"))
);
+ let (maybe_res, maybe_err) = client
+ .write_request::<_, _, Value>(
+ "codeLens/resolve",
+ json!({
+ "range": {
+ "start": {
+ "line": 10,
+ "character": 10
+ },
+ "end": {
+ "line": 10,
+ "character": 11
+ }
+ },
+ "data": {
+ "specifier": "file:///a/file.ts",
+ "source": "implementations"
+ }
+ }),
+ )
+ .unwrap();
+ assert!(maybe_err.is_none());
+ assert_eq!(
+ maybe_res,
+ Some(json!({
+ "range": {
+ "start": {
+ "line": 10,
+ "character": 10
+ },
+ "end": {
+ "line": 10,
+ "character": 11
+ }
+ },
+ "command": {
+ "title": "0 implementations",
+ "command": ""
+ }
+ }))
+ );
shutdown(&mut client);
}
@@ -1226,6 +1267,79 @@ fn lsp_code_lens_non_doc_nav_tree() {
}
#[test]
+fn lsp_nav_tree_updates() {
+ let mut client = init("initialize_params.json");
+ did_open(
+ &mut client,
+ json!({
+ "textDocument": {
+ "uri": "file:///a/file.ts",
+ "languageId": "typescript",
+ "version": 1,
+ "text": "interface A {\n b(): void;\n}\n\nclass B implements A {\n b() {\n console.log(\"b\");\n }\n}\n\ninterface C {\n c: string;\n}\n"
+ }
+ }),
+ );
+ let (maybe_res, maybe_err) = client
+ .write_request(
+ "textDocument/codeLens",
+ json!({
+ "textDocument": {
+ "uri": "file:///a/file.ts"
+ }
+ }),
+ )
+ .unwrap();
+ assert!(maybe_err.is_none());
+ assert_eq!(
+ maybe_res,
+ Some(load_fixture("code_lens_response_impl.json"))
+ );
+ client
+ .write_notification(
+ "textDocument/didChange",
+ json!({
+ "textDocument": {
+ "uri": "file:///a/file.ts",
+ "version": 2
+ },
+ "contentChanges": [
+ {
+ "range": {
+ "start": {
+ "line": 10,
+ "character": 0
+ },
+ "end": {
+ "line": 13,
+ "character": 0
+ }
+ },
+ "text": ""
+ }
+ ]
+ }),
+ )
+ .unwrap();
+ let (maybe_res, maybe_err) = client
+ .write_request(
+ "textDocument/codeLens",
+ json!({
+ "textDocument": {
+ "uri": "file:///a/file.ts"
+ }
+ }),
+ )
+ .unwrap();
+ assert!(maybe_err.is_none());
+ assert_eq!(
+ maybe_res,
+ Some(load_fixture("code_lens_response_changed.json"))
+ );
+ shutdown(&mut client);
+}
+
+#[test]
fn lsp_signature_help() {
let mut client = init("initialize_params.json");
did_open(