From 1abf949a05076516c2fcc3662305d729208bd899 Mon Sep 17 00:00:00 2001 From: RicardoASJunior Date: Mon, 29 Sep 2025 22:56:04 -0300 Subject: [PATCH] fix: prevent unwanted semicolon insertion --- src/extension.ts | 3 +++ src/test/suite/extension.test.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index 6ed8fb06..f3567c4d 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1098,6 +1098,9 @@ export async function activate(context: vscode.ExtensionContext): Promise { } const newLine = event.document.lineAt(newLineNumber); + if (newLine.text.trim().length > 0) { + continue; + } if (newLine.text.startsWith(insertText)) { continue; } diff --git a/src/test/suite/extension.test.ts b/src/test/suite/extension.test.ts index 3f4ba604..05016507 100644 --- a/src/test/suite/extension.test.ts +++ b/src/test/suite/extension.test.ts @@ -91,6 +91,22 @@ suite("Extension Test Suite", () => { } }); + test("Moving lines across dot-prefixed semicolon comments doesn't add semicolons", async () => { + const document = await vscode.workspace.openTextDocument({ + language: "objectscript", + content: " . Do ##class(Test).Run()\n . ; Comment", + }); + const editor = await vscode.window.showTextDocument(document); + try { + editor.selection = new vscode.Selection(new vscode.Position(0, 0), new vscode.Position(0, 0)); + await vscode.commands.executeCommand("editor.action.moveLinesDownAction"); + const expectedText = " . ; Comment\n . Do ##class(Test).Run()"; + await waitForCondition(() => document.getText() === expectedText); + assert.strictEqual(document.getText(), expectedText); + } finally { + await vscode.commands.executeCommand("workbench.action.closeActiveEditor"); + } + }); test("Go to Definition resolves to sibling workspace folder", async function () { this.timeout(10000); await waitForIndexedDocument("MultiRoot.Shared.cls", "shared");