From ca133b6ddc682f93d84eeaa6094f0711a442f100 Mon Sep 17 00:00:00 2001 From: Armando Aguirre Date: Thu, 11 Nov 2021 01:47:52 +0000 Subject: [PATCH] Cherry-pick PR #46767 into release-4.5 Component commits: 1c07983418 Removed replacement from jsx completions 20c24b970c Fixed tests --- src/services/completions.ts | 4 ---- .../cases/fourslash/jsxAttributeCompletionStyleAuto.ts | 7 ------- .../fourslash/jsxAttributeCompletionStyleBraces.ts | 10 ---------- 3 files changed, 21 deletions(-) diff --git a/src/services/completions.ts b/src/services/completions.ts index 9b2747db14d2f..9961a699945f7 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -738,10 +738,6 @@ namespace ts.Completions { insertText = `${escapeSnippetText(name)}={$1}`; isSnippet = true; } - - if (isSnippet) { - replacementSpan = createTextSpanFromNode(location, sourceFile); - } } if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) { diff --git a/tests/cases/fourslash/jsxAttributeCompletionStyleAuto.ts b/tests/cases/fourslash/jsxAttributeCompletionStyleAuto.ts index b8a5b18da8383..c3814c5fdc13a 100644 --- a/tests/cases/fourslash/jsxAttributeCompletionStyleAuto.ts +++ b/tests/cases/fourslash/jsxAttributeCompletionStyleAuto.ts @@ -31,25 +31,21 @@ verify.completions({ { name: "prop_b", insertText: "prop_b=\"$1\"", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_c", insertText: "prop_c={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_d", insertText: "prop_d={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_e", insertText: "prop_e=\"$1\"", - replacementSpan: test.ranges()[0], isSnippet: true, }, { @@ -59,13 +55,11 @@ verify.completions({ { name: "prop_g", insertText: "prop_g={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_h", insertText: "prop_h=\"$1\"", - replacementSpan: test.ranges()[0], isSnippet: true, sortText: completion.SortText.OptionalMember, }, @@ -77,7 +71,6 @@ verify.completions({ { name: "prop_j", insertText: "prop_j={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, sortText: completion.SortText.OptionalMember, } diff --git a/tests/cases/fourslash/jsxAttributeCompletionStyleBraces.ts b/tests/cases/fourslash/jsxAttributeCompletionStyleBraces.ts index 608c71787d138..cd03ab0546e1e 100644 --- a/tests/cases/fourslash/jsxAttributeCompletionStyleBraces.ts +++ b/tests/cases/fourslash/jsxAttributeCompletionStyleBraces.ts @@ -27,63 +27,53 @@ verify.completions({ { name: "prop_a", insertText: "prop_a={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_b", insertText: "prop_b={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_c", insertText: "prop_c={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_d", insertText: "prop_d={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_e", insertText: "prop_e={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_f", insertText: "prop_f={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_g", insertText: "prop_g={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, }, { name: "prop_h", insertText: "prop_h={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, sortText: completion.SortText.OptionalMember, }, { name: "prop_i", insertText: "prop_i={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, sortText: completion.SortText.OptionalMember, }, { name: "prop_j", insertText: "prop_j={$1}", - replacementSpan: test.ranges()[0], isSnippet: true, sortText: completion.SortText.OptionalMember, }