mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
test(lsp): make lsp_completions_auto_import more robust (#18482)
A completely unrelated change in https://github.com/denoland/deno/pull/18286 threw of this test. These changes make it more robust and easier to update in such cases.
This commit is contained in:
parent
c5302a0587
commit
ceab7a8d23
1 changed files with 30 additions and 30 deletions
|
@ -4402,40 +4402,40 @@ fn lsp_completions_auto_import() {
|
||||||
json!({ "triggerKind": 1 }),
|
json!({ "triggerKind": 1 }),
|
||||||
);
|
);
|
||||||
assert!(!list.is_incomplete);
|
assert!(!list.is_incomplete);
|
||||||
if !list.items.iter().any(|item| item.label == "foo") {
|
let item = list.items.iter().find(|item| item.label == "foo");
|
||||||
|
if item.is_none() {
|
||||||
panic!("completions items missing 'foo' symbol");
|
panic!("completions items missing 'foo' symbol");
|
||||||
}
|
}
|
||||||
|
|
||||||
// the request here is one of the items in `list`
|
let req = json!({
|
||||||
let res = client.write_request(
|
"label": "foo",
|
||||||
"completionItem/resolve",
|
"kind": 6,
|
||||||
json!({
|
"sortText": "16",
|
||||||
"label": "foo",
|
"commitCharacters": [
|
||||||
"kind": 6,
|
".",
|
||||||
"sortText": "16",
|
",",
|
||||||
"commitCharacters": [
|
";",
|
||||||
".",
|
"("
|
||||||
",",
|
],
|
||||||
";",
|
"data": {
|
||||||
"("
|
"tsc": {
|
||||||
],
|
"specifier": "file:///a/file.ts",
|
||||||
"data": {
|
"position": 12,
|
||||||
"tsc": {
|
"name": "foo",
|
||||||
"specifier": "file:///a/file.ts",
|
"source": "./b.ts",
|
||||||
"position": 12,
|
"data": {
|
||||||
"name": "foo",
|
"exportName": "foo",
|
||||||
"source": "./b.ts",
|
"exportMapKey": "foo|6843|file:///a/b",
|
||||||
"data": {
|
"moduleSpecifier": "./b.ts",
|
||||||
"exportName": "foo",
|
"fileName": "file:///a/b.ts"
|
||||||
"exportMapKey": "foo|6843|file:///a/b",
|
},
|
||||||
"moduleSpecifier": "./b.ts",
|
"useCodeSnippet": false
|
||||||
"fileName": "file:///a/b.ts"
|
|
||||||
},
|
|
||||||
"useCodeSnippet": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}),
|
}
|
||||||
);
|
});
|
||||||
|
assert_eq!(serde_json::to_value(item.unwrap()).unwrap(), req);
|
||||||
|
|
||||||
|
let res = client.write_request("completionItem/resolve", req);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res,
|
res,
|
||||||
json!({
|
json!({
|
||||||
|
|
Loading…
Reference in a new issue