We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a6ec94 commit 6dbe2f0Copy full SHA for 6dbe2f0
extensions/git/src/model.ts
@@ -548,9 +548,12 @@ export class Model implements Disposable {
548
: await workspace.openTextDocument(Uri.file(ignoreFile).with({ scheme: 'untitled' }));
549
550
await window.showTextDocument(document);
551
+
552
const edit = new WorkspaceEdit();
553
+ const lastLine = document.lineAt(document.lineCount - 1);
554
+ const text = lastLine.isEmptyOrWhitespace ? `${textToAppend}\n` : `\n${textToAppend}\n`;
555
- edit.insert(document.uri, document.lineAt(document.lineCount - 1).range.end, `${textToAppend}\n`);
556
+ edit.insert(document.uri, lastLine.range.end, text);
557
workspace.applyEdit(edit);
558
});
559
}
0 commit comments