Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(lsp): make lsp_completions_auto_import more robust #18482

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test(lsp): make lsp_completions_auto_import more robust
  • Loading branch information
bartlomieju committed Mar 28, 2023
commit 0350d7e4ac12c100643bfccfc37166c61b650b62
60 changes: 30 additions & 30 deletions cli/tests/integration/lsp_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4402,40 +4402,40 @@ fn lsp_completions_auto_import() {
json!({ "triggerKind": 1 }),
);
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");
}

// the request here is one of the items in `list`
let res = client.write_request(
"completionItem/resolve",
json!({
"label": "foo",
"kind": 6,
"sortText": "￿16",
"commitCharacters": [
".",
",",
";",
"("
],
"data": {
"tsc": {
"specifier": "file:https:///a/file.ts",
"position": 12,
"name": "foo",
"source": "./b.ts",
"data": {
"exportName": "foo",
"exportMapKey": "foo|6843|file:https:///a/b",
"moduleSpecifier": "./b.ts",
"fileName": "file:https:///a/b.ts"
},
"useCodeSnippet": false
}
let req = json!({
"label": "foo",
"kind": 6,
"sortText": "￿16",
"commitCharacters": [
".",
",",
";",
"("
],
"data": {
"tsc": {
"specifier": "file:https:///a/file.ts",
"position": 12,
"name": "foo",
"source": "./b.ts",
"data": {
"exportName": "foo",
"exportMapKey": "foo|6843|file:https:///a/b",
"moduleSpecifier": "./b.ts",
"fileName": "file:https:///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!(
res,
json!({
Expand Down