From ec6317e8944d87cb412128f44fe4bb4c2a2d136f Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Thu, 1 Apr 2021 20:18:51 +1100 Subject: fix(lsp): ensure insert_text is passed back on completions (#9951) Fixes #9920 --- cli/tests/lsp/completion_request_optional.json | 18 ++++++++++++++++++ .../lsp/completion_resolve_request_optional.json | 20 ++++++++++++++++++++ .../did_open_notification_completion_optional.json | 12 ++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 cli/tests/lsp/completion_request_optional.json create mode 100644 cli/tests/lsp/completion_resolve_request_optional.json create mode 100644 cli/tests/lsp/did_open_notification_completion_optional.json (limited to 'cli/tests/lsp') diff --git a/cli/tests/lsp/completion_request_optional.json b/cli/tests/lsp/completion_request_optional.json new file mode 100644 index 000000000..5e86c33ff --- /dev/null +++ b/cli/tests/lsp/completion_request_optional.json @@ -0,0 +1,18 @@ +{ + "jsonrpc": "2.0", + "id": 2, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "file:///a/file.ts" + }, + "position": { + "line": 8, + "character": 4 + }, + "context": { + "triggerKind": 2, + "triggerCharacter": "." + } + } +} diff --git a/cli/tests/lsp/completion_resolve_request_optional.json b/cli/tests/lsp/completion_resolve_request_optional.json new file mode 100644 index 000000000..ffa60b919 --- /dev/null +++ b/cli/tests/lsp/completion_resolve_request_optional.json @@ -0,0 +1,20 @@ +{ + "jsonrpc": "2.0", + "id": 4, + "method": "completionItem/resolve", + "params": { + "label": "b?", + "kind": 5, + "sortText": "1", + "filterText": "b", + "insertText": "b", + "data": { + "tsc": { + "specifier": "file:///a/file.ts", + "position": 79, + "name": "b", + "useCodeSnippet": false + } + } + } +} diff --git a/cli/tests/lsp/did_open_notification_completion_optional.json b/cli/tests/lsp/did_open_notification_completion_optional.json new file mode 100644 index 000000000..5e919c80a --- /dev/null +++ b/cli/tests/lsp/did_open_notification_completion_optional.json @@ -0,0 +1,12 @@ +{ + "jsonrpc": "2.0", + "method": "textDocument/didOpen", + "params": { + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "interface A {\n b?: string;\n}\n\nconst o: A = {};\n\nfunction c(s: string) {}\n\nc(o.)" + } + } +} -- cgit v1.2.3