Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 6086e5f

Browse files
committed
Prepare RlsHandle to be transport-agnostic
1 parent 45d05de commit 6086e5f

File tree

3 files changed

+121
-74
lines changed

3 files changed

+121
-74
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ rustc-workspace-hack = "1.0.0"
6666
[dev-dependencies]
6767
difference = "2"
6868
tempfile = "3"
69-
lsp-codec = "0.1.1"
69+
lsp-codec = "0.1.2"
7070
tokio = "0.1"
7171
futures = "0.1"
7272
tokio-process = "0.2"

tests/client.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ fn client_test_infer_bin() {
5252

5353
rls.wait_for_indexing();
5454
assert!(rls.messages().iter().filter(|msg| msg["method"] != "window/progress").count() > 1);
55-
56-
rls.shutdown();
5755
}
5856

5957
/// Test includes window/progress regression testing
@@ -153,8 +151,6 @@ fn client_test_simple_workspace() {
153151
})
154152
.count();
155153
assert_eq!(count, 4);
156-
157-
rls.shutdown();
158154
}
159155

160156
#[test]
@@ -279,8 +275,6 @@ fn client_changing_workspace_lib_retains_diagnostics() {
279275
assert!(lib.diagnostics.iter().any(|m| m.message.contains("unused variable: `test_val`")));
280276
assert!(lib.diagnostics.iter().any(|m| m.message.contains("unused variable: `unused`")));
281277
assert!(bin.diagnostics[0].message.contains("unused variable: `val`"));
282-
283-
rls.shutdown();
284278
}
285279

286280
#[test]
@@ -372,8 +366,6 @@ fn client_implicit_workspace_pick_up_lib_changes() {
372366
let bin = rls.future_diagnostics("src/main.rs");
373367
let bin = rls.block_on(bin).unwrap();
374368
assert!(bin.diagnostics[0].message.contains("unused variable: `val`"));
375-
376-
rls.shutdown();
377369
}
378370

379371
#[test]
@@ -440,8 +432,6 @@ fn client_test_complete_self_crate_name() {
440432

441433
let item = items.into_iter().nth(0).expect("Racer autocompletion failed");
442434
assert_eq!(item.detail.unwrap(), "pub fn function() -> usize");
443-
444-
rls.shutdown();
445435
}
446436

447437
#[test]
@@ -534,8 +524,6 @@ fn client_completion_suggests_arguments_in_statements() {
534524

535525
let item = items.into_iter().nth(0).expect("Racer autocompletion failed");
536526
assert_eq!(item.insert_text.unwrap(), "function()");
537-
538-
rls.shutdown();
539527
}
540528

541529
#[test]
@@ -602,8 +590,6 @@ fn client_use_statement_completion_doesnt_suggest_arguments() {
602590

603591
let item = items.into_iter().nth(0).expect("Racer autocompletion failed");
604592
assert_eq!(item.insert_text.unwrap(), "function");
605-
606-
rls.shutdown();
607593
}
608594

609595
/// Test simulates typing in a dependency wrongly in a couple of ways before finally getting it
@@ -688,8 +674,6 @@ fn client_dependency_typo_and_fix() {
688674
diag.diagnostics.iter().find(|d| d.severity == Some(DiagnosticSeverity::Error)),
689675
None
690676
);
691-
692-
rls.shutdown();
693677
}
694678

695679
/// Tests correct positioning of a toml parse error, use of `==` instead of `=`.
@@ -732,8 +716,6 @@ fn client_invalid_toml_manifest() {
732716
end: Position { line: 2, character: 22 },
733717
}
734718
);
735-
736-
rls.shutdown();
737719
}
738720

739721
/// Tests correct file highlighting of workspace member manifest with invalid path dependency.
@@ -791,8 +773,6 @@ fn client_invalid_member_toml_manifest() {
791773
assert_eq!(diag.diagnostics.len(), 1);
792774
assert_eq!(diag.diagnostics[0].severity, Some(DiagnosticSeverity::Error));
793775
assert!(diag.diagnostics[0].message.contains("failed to read"));
794-
795-
rls.shutdown();
796776
}
797777

798778
#[test]
@@ -852,8 +832,6 @@ fn client_invalid_member_dependency_resolution() {
852832
assert_eq!(diag.diagnostics.len(), 1);
853833
assert_eq!(diag.diagnostics[0].severity, Some(DiagnosticSeverity::Error));
854834
assert!(diag.diagnostics[0].message.contains("no matching package named `nosuchdep123`"));
855-
856-
rls.shutdown();
857835
}
858836

859837
#[test]
@@ -892,8 +870,6 @@ fn client_handle_utf16_unit_text_edits() {
892870
text: "".to_string(),
893871
}],
894872
});
895-
896-
rls.shutdown();
897873
}
898874

899875
/// Ensures that wide characters do not prevent RLS from calculating correct
@@ -937,8 +913,6 @@ fn client_format_utf16_range() {
937913
// Actual formatting isn't important - what is, is that the buffer isn't
938914
// malformed and code stays semantically equivalent.
939915
assert_eq!(new_text, vec!["/* 😢😢😢😢😢😢😢 */\nfn main() {}\n"]);
940-
941-
rls.shutdown();
942916
}
943917

944918
#[test]
@@ -990,8 +964,6 @@ fn client_lens_run() {
990964
};
991965

992966
assert_eq!(lens, Some(vec![expected]));
993-
994-
rls.shutdown();
995967
}
996968

997969
#[test]
@@ -1068,7 +1040,6 @@ fn client_find_definitions() {
10681040
}
10691041
}
10701042
}
1071-
rls.shutdown();
10721043

10731044
// Foo
10741045
let foo_definition = Range {
@@ -1279,8 +1250,6 @@ fn client_deglob() {
12791250
})
12801251
.collect::<Vec<_>>()
12811252
);
1282-
1283-
rls.shutdown();
12841253
}
12851254

12861255
fn is_notification_for_unknown_config(msg: &serde_json::Value) -> bool {
@@ -1345,7 +1314,6 @@ fn client_init_duplicated_and_unknown_settings() {
13451314

13461315
assert!(rls.messages().iter().any(is_notification_for_unknown_config));
13471316
assert!(rls.messages().iter().any(is_notification_for_duplicated_config));
1348-
rls.shutdown();
13491317
}
13501318

13511319
#[test]
@@ -1405,6 +1373,4 @@ fn client_did_change_configuration_duplicated_and_unknown_settings() {
14051373
if !rls.messages().iter().any(is_notification_for_duplicated_config) {
14061374
rls.wait_for_message(is_notification_for_duplicated_config);
14071375
}
1408-
1409-
rls.shutdown();
14101376
}

0 commit comments

Comments
 (0)