Skip to content

Commit 91b166a

Browse files
authored
fix: Rename setting "methodSnippetsInsertText" to "previewMethodSignatureInCompletions` (#179)
1 parent 3096cc1 commit 91b166a

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ function Foo() {
321321
}
322322
```
323323

324-
`tsEssentialPlugins.methodSnippetsInsertText`:
324+
`tsEssentialPlugins.methodSnippets.previewSignature`:
325325

326326
Optionally resolve insertText of all completion at suggest trigger:
327327

src/configurationType.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export type Configuration = {
385385
* Recommended to try!
386386
* @default disable
387387
*/
388-
methodSnippetsInsertText: 'disable' | 'only-local' | 'all'
388+
'methodSnippets.previewSignature': 'disable' | 'only-local' | 'all'
389389
/**
390390
* ```ts
391391
* const example = ({ a }, b?, c = 5, ...d) => { }
@@ -572,7 +572,7 @@ export type Configuration = {
572572
'experiments.excludeNonJsxCompletions': boolean
573573
/**
574574
* Wether to change function completions to function kind
575-
* @deprecated Use `methodSnippetsInsertText` instead
575+
* @deprecated Use `methodSnippets.previewSignature` instead
576576
* @default false
577577
*/
578578
'experiments.changeKindToFunction': boolean

src/migrateSettings.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ export default () => {
3333
mustBePrimitive: false,
3434
},
3535
},
36+
{
37+
rename: {
38+
old: 'methodSnippetsInsertText',
39+
new: 'methodSnippets.previewSignature',
40+
mustBePrimitive: false,
41+
},
42+
},
3643
{
3744
async detect(configuration) {
3845
return !!(await migrateSettingValues(configuration, true))

src/onCompletionAccepted.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export default (tsApi: { onCompletionAccepted }) => {
6262
const nextChar = editor.document.getText(new vscode.Range(startPos, startPos.translate(0, 1)))
6363
if (!params || ['(', '.', '`'].includes(nextChar)) return
6464

65-
if (getExtensionSetting('methodSnippetsInsertText') === 'disable') {
66-
// handle insertion only if it wasn't handled by methodSnippetsInsertText already
65+
if (getExtensionSetting('methodSnippets.previewSignature') === 'disable') {
66+
// handle insertion only if it wasn't handled by 'methodSnippets.previewSignature' already
6767
if (isAmbiguous && lastAcceptedAmbiguousMethodSnippetSuggestion !== suggestionName) {
6868
lastAcceptedAmbiguousMethodSnippetSuggestion = suggestionName
6969
return

typescript/src/completions/functionCompletions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { sharedCompletionContext } from './sharedContext'
66
export default (entries: ts.CompletionEntry[]) => {
77
const { languageService, c, sourceFile, position, prior } = sharedCompletionContext
88

9-
const methodSnippetInsertTextMode = c('methodSnippetsInsertText')
9+
const methodSnippetInsertTextMode = c('methodSnippets.previewSignature')
1010
const fullText = sourceFile.getFullText()
1111
const nextChar = fullText.slice(position, position + 1)
1212
const prevChar = fullText.slice(position - 1, position)

typescript/test/completions.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,9 @@ describe('Method snippets', () => {
293293
compareMethodSnippetAgainstMarker(markers, 2, 'ambiguous')
294294
})
295295

296-
test('methodSnippetsInsertText all', () => {
296+
test('methodSnippets.previewSignature all', () => {
297297
overrideSettings({
298-
methodSnippetsInsertText: 'all',
298+
'methodSnippets.previewSignature': 'all',
299299
})
300300
fileContentsSpecialPositions(/* ts */ `
301301
const a = (a, b) => {}

0 commit comments

Comments
 (0)