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

Commit 6465541

Browse files
committed
Translate handle_utf16_unit_text_edits
1 parent 0ff2282 commit 6465541

File tree

2 files changed

+46
-59
lines changed

2 files changed

+46
-59
lines changed

tests/client.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,3 +880,49 @@ fn client_invalid_member_dependency_resolution() {
880880

881881
rls.shutdown();
882882
}
883+
884+
#[test]
885+
fn client_handle_utf16_unit_text_edits() {
886+
let p = project("client_handle_utf16_unit_text_edits")
887+
.file(
888+
"Cargo.toml",
889+
r#"[package]
890+
name = "client_handle_utf16_unit_text_edits"
891+
version = "0.1.0"
892+
authors = ["example@example.com"]
893+
"#,
894+
)
895+
.file("src/main.rs", "fn main() {}")
896+
.file("src/some.rs", "😢")
897+
.build();
898+
let root_path = p.root();
899+
let mut rls = p.spawn_rls_async();
900+
901+
rls.request::<Initialize>(0, initialize_params(root_path));
902+
903+
rls.wait_for_indexing();
904+
905+
rls.notify::<DidChangeTextDocument>(DidChangeTextDocumentParams {
906+
text_document: VersionedTextDocumentIdentifier {
907+
uri: Url::from_file_path(p.root().join("src/some.rs")).unwrap(),
908+
version: Some(0),
909+
},
910+
// "😢" -> ""
911+
content_changes: vec![TextDocumentContentChangeEvent {
912+
range: Some(Range {
913+
start: Position {
914+
line: 0,
915+
character: 0,
916+
},
917+
end: Position {
918+
line: 0,
919+
character: 2
920+
}
921+
}),
922+
range_length: Some(2),
923+
text: "".to_string(),
924+
}]
925+
});
926+
927+
rls.shutdown();
928+
}

tests/tests.rs

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,6 @@ use self::support::{fixtures_dir, rls_timeout};
1212
#[allow(dead_code)]
1313
mod support;
1414

15-
#[test]
16-
fn cmd_handle_utf16_unit_text_edits() {
17-
let project = project("cmd_handle_utf16_unit_text_edits")
18-
.file(
19-
"Cargo.toml",
20-
r#"[package]
21-
name = "cmd_handle_utf16_unit_text_edits"
22-
version = "0.1.0"
23-
authors = ["example@example.com"]
24-
"#,
25-
)
26-
.file("src/main.rs", "fn main() {}")
27-
.file("src/unrelated.rs", "😢")
28-
.build();
29-
let root_path = project.root();
30-
let mut rls = project.spawn_rls();
31-
32-
rls.request(
33-
0,
34-
"initialize",
35-
Some(json!({
36-
"rootPath": root_path,
37-
"capabilities": {}
38-
})),
39-
)
40-
.unwrap();
41-
42-
rls.wait_until_done_indexing(rls_timeout());
43-
44-
rls.notify(
45-
"textDocument/didChange",
46-
Some(json!(
47-
{"textDocument": {
48-
"uri": format!("file://{}/src/unrelated.rs", root_path.display()),
49-
"version": 1
50-
},
51-
// "😢" -> ""
52-
"contentChanges": [
53-
{
54-
"range": {
55-
"start": {
56-
"line":0,
57-
"character":0
58-
},
59-
"end":{
60-
"line":0,
61-
"character":2
62-
}
63-
},
64-
"rangeLength":2,
65-
"text":""
66-
}
67-
]
68-
}))
69-
).unwrap();
70-
71-
rls.shutdown(rls_timeout());
72-
}
73-
7415
/// Ensures that wide characters do not prevent RLS from calculating correct
7516
/// 'whole file' LSP range.
7617
#[test]

0 commit comments

Comments
 (0)