From afcea6c233dad9b1c3e8202b950d38bf0c472c40 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Fri, 14 Oct 2022 23:04:38 +1100 Subject: fix(lsp): properly handle snippets on completions (#16274) Fixes #15367 --- cli/tests/integration/lsp_tests.rs | 185 +++++++++++++++++++++ cli/tests/testdata/lsp/initialize_params.json | 5 + .../testdata/lsp/initialize_params_no_snippet.json | 77 +++++++++ 3 files changed, 267 insertions(+) create mode 100644 cli/tests/testdata/lsp/initialize_params_no_snippet.json (limited to 'cli/tests') diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 130ffe742..cc8625476 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -3654,6 +3654,191 @@ fn lsp_completions_auto_import() { ); } +#[test] +fn lsp_completions_snippet() { + let mut client = init("initialize_params.json"); + did_open( + &mut client, + json!({ + "textDocument": { + "uri": "file:///a/a.tsx", + "languageId": "typescriptreact", + "version": 1, + "text": "function A({ type }: { type: string }) {\n return type;\n}\n\nfunction B() {\n return