From 71fa0e5ef9a2507c24d50c83545df999b1f70706 Mon Sep 17 00:00:00 2001 From: chemzqm Date: Fri, 28 Dec 2018 17:54:02 +0800 Subject: [PATCH] fix snippet for function call --- src/server/features/completionItemProvider.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/features/completionItemProvider.ts b/src/server/features/completionItemProvider.ts index 95ca8b9..3ed4d81 100644 --- a/src/server/features/completionItemProvider.ts +++ b/src/server/features/completionItemProvider.ts @@ -356,6 +356,10 @@ export default class TypeScriptCompletionItemProvider implements CompletionItemP const parameterListParts = getParameterListParts(displayParts) let { parts, hasOptionalParameters } = parameterListParts let idx = 1 + if (parts.length == 0 && hasOptionalParameters) { + item.insertText = snippet + '${1})$0' + return + } for (let part of parts) { snippet += '${' + idx + ':' + part.text + '}' // tslint:disable-line if (idx == parts.length) {