summaryrefslogtreecommitdiff
path: root/cli/tests/integration/lsp_tests.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-11-23 11:08:56 +1100
committerGitHub <noreply@github.com>2021-11-23 11:08:56 +1100
commitbf5657cd590a0624d614a09ff6fc3538f94643da (patch)
tree26420625430f9b043d8406ed21039fb962b7a502 /cli/tests/integration/lsp_tests.rs
parent3abe31252e02c3488727c7aa15a4d3a301d96531 (diff)
feat(lsp): add workspace symbol provider (#12787)
Diffstat (limited to 'cli/tests/integration/lsp_tests.rs')
-rw-r--r--cli/tests/integration/lsp_tests.rs114
1 files changed, 114 insertions, 0 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index c22bb3bdb..8e7de0286 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -3776,6 +3776,120 @@ fn lsp_configuration_did_change() {
}
#[test]
+fn lsp_workspace_symbol() {
+ let mut client = init("initialize_params.json");
+ did_open(
+ &mut client,
+ json!({
+ "textDocument": {
+ "uri": "file:///a/file.ts",
+ "languageId": "typescript",
+ "version": 1,
+ "text": "export class A {\n fieldA: string;\n fieldB: string;\n}\n",
+ }
+ }),
+ );
+ did_open(
+ &mut client,
+ json!({
+ "textDocument": {
+ "uri": "file:///a/file_01.ts",
+ "languageId": "typescript",
+ "version": 1,
+ "text": "export class B {\n fieldC: string;\n fieldD: string;\n}\n",
+ }
+ }),
+ );
+ let (maybe_res, maybe_err) = client
+ .write_request(
+ "workspace/symbol",
+ json!({
+ "query": "field"
+ }),
+ )
+ .unwrap();
+ assert!(maybe_err.is_none());
+ assert_eq!(
+ maybe_res,
+ Some(json!([
+ {
+ "name": "fieldA",
+ "kind": 8,
+ "location": {
+ "uri": "file:///a/file.ts",
+ "range": {
+ "start": {
+ "line": 1,
+ "character": 2
+ },
+ "end": {
+ "line": 1,
+ "character": 17
+ }
+ }
+ },
+ "containerName": "A"
+ },
+ {
+ "name": "fieldB",
+ "kind": 8,
+ "location": {
+ "uri": "file:///a/file.ts",
+ "range": {
+ "start": {
+ "line": 2,
+ "character": 2
+ },
+ "end": {
+ "line": 2,
+ "character": 17
+ }
+ }
+ },
+ "containerName": "A"
+ },
+ {
+ "name": "fieldC",
+ "kind": 8,
+ "location": {
+ "uri": "file:///a/file_01.ts",
+ "range": {
+ "start": {
+ "line": 1,
+ "character": 2
+ },
+ "end": {
+ "line": 1,
+ "character": 17
+ }
+ }
+ },
+ "containerName": "B"
+ },
+ {
+ "name": "fieldD",
+ "kind": 8,
+ "location": {
+ "uri": "file:///a/file_01.ts",
+ "range": {
+ "start": {
+ "line": 2,
+ "character": 2
+ },
+ "end": {
+ "line": 2,
+ "character": 17
+ }
+ }
+ },
+ "containerName": "B"
+ }
+ ]))
+ );
+ shutdown(&mut client);
+}
+
+#[test]
fn lsp_code_actions_ignore_lint() {
let mut client = init("initialize_params.json");
did_open(