From ccd6ee5c2394418c078f1a1be9e5cc1012829cbc Mon Sep 17 00:00:00 2001 From: Yuki Tanaka Date: Tue, 16 Feb 2021 11:34:09 +0900 Subject: feat(lsp): Implement `textDocument/signatureHelp` (#9330) Co-authored-by: Kitson Kelly --- .../signature_help_did_change_notification.json | 25 ++++++++++++++++++++++ .../lsp/signature_help_did_open_notification.json | 12 +++++++++++ cli/tests/lsp/signature_help_request_01.json | 19 ++++++++++++++++ cli/tests/lsp/signature_help_request_02.json | 14 ++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 cli/tests/lsp/signature_help_did_change_notification.json create mode 100644 cli/tests/lsp/signature_help_did_open_notification.json create mode 100644 cli/tests/lsp/signature_help_request_01.json create mode 100644 cli/tests/lsp/signature_help_request_02.json (limited to 'cli/tests') diff --git a/cli/tests/lsp/signature_help_did_change_notification.json b/cli/tests/lsp/signature_help_did_change_notification.json new file mode 100644 index 000000000..f88eaa9ff --- /dev/null +++ b/cli/tests/lsp/signature_help_did_change_notification.json @@ -0,0 +1,25 @@ +{ + "jsonrpc": "2.0", + "method": "textDocument/didChange", + "params": { + "textDocument": { + "uri": "file:///a/file.ts", + "version": 2 + }, + "contentChanges": [ + { + "range": { + "start": { + "line": 9, + "character": 4 + }, + "end": { + "line": 9, + "character": 4 + } + }, + "text": "123, " + } + ] + } +} diff --git a/cli/tests/lsp/signature_help_did_open_notification.json b/cli/tests/lsp/signature_help_did_open_notification.json new file mode 100644 index 000000000..1ba1f7586 --- /dev/null +++ b/cli/tests/lsp/signature_help_did_open_notification.json @@ -0,0 +1,12 @@ +{ + "jsonrpc": "2.0", + "method": "textDocument/didOpen", + "params": { + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "/**\n * Adds two numbers.\n * @param a This is a first number.\n * @param b This is a second number.\n */\nfunction add(a: number, b: number) {\n return a + b;\n}\n\nadd(" + } + } +} diff --git a/cli/tests/lsp/signature_help_request_01.json b/cli/tests/lsp/signature_help_request_01.json new file mode 100644 index 000000000..c3e185e08 --- /dev/null +++ b/cli/tests/lsp/signature_help_request_01.json @@ -0,0 +1,19 @@ +{ + "jsonrpc": "2.0", + "id": 1, + "method": "textDocument/signatureHelp", + "params": { + "textDocument": { + "uri": "file:///a/file.ts" + }, + "position": { + "character": 4, + "line": 9 + }, + "context": { + "triggerKind": 2, + "triggerCharacter": "(", + "isRetrigger": false + } + } +} diff --git a/cli/tests/lsp/signature_help_request_02.json b/cli/tests/lsp/signature_help_request_02.json new file mode 100644 index 000000000..c2a6e0abb --- /dev/null +++ b/cli/tests/lsp/signature_help_request_02.json @@ -0,0 +1,14 @@ +{ + "id": 2, + "jsonrpc": "2.0", + "method": "textDocument/signatureHelp", + "params": { + "textDocument": { + "uri": "file:///a/file.ts" + }, + "position": { + "character": 8, + "line": 9 + } + } +} -- cgit v1.2.3