diff --git a/src/server/features/completionItemProvider.ts b/src/server/features/completionItemProvider.ts index fc35ccc..d5bc697 100644 --- a/src/server/features/completionItemProvider.ts +++ b/src/server/features/completionItemProvider.ts @@ -300,7 +300,7 @@ export default class TypeScriptCompletionItemProvider implements CompletionItemP if (additionalTextEdits.length && this.noSemicolons) { // remove comma additionalTextEdits.forEach(o => { - o.newText = o.newText.replace(/;(?:(\n|$))/g, '') + o.newText = o.newText.replace(/;(?=(\n|$))/g, '') }) } return { diff --git a/src/server/organizeImports.ts b/src/server/organizeImports.ts index 6675bd6..302eeb0 100644 --- a/src/server/organizeImports.ts +++ b/src/server/organizeImports.ts @@ -50,7 +50,7 @@ export class OrganizeImportsCommand implements Command { if (changes) { for (let c of Object.keys(changes)) { for (let textEdit of changes[c]) { - textEdit.newText = textEdit.newText.replace(/;(?:(\n|$))/g, '') + textEdit.newText = textEdit.newText.replace(/;(?=(\n|$))/g, '') } } }