Skip to content

Commit e37e84e

Browse files
authored
Merge pull request #431 from SanjulaGanepola/fix/update-prefix-with-comments
Ignore commented lines when using `update` prefix
2 parents 5adafbe + e702978 commit e37e84e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/views/results/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ async function runHandler(options?: StatementInfo) {
264264
vscode.commands.executeCommand('vscode-db2i.dove.close');
265265

266266
if (optionsIsValid || (editor && editor.document.languageId === `sql`)) {
267+
const eol = editor.document.eol === vscode.EndOfLine.CRLF ? `\r\n` : `\n`;
267268
let chosenView = resultSetProvider;
268269

269270
const useWindow = (title: string, column?: ViewColumn) => {
@@ -377,8 +378,10 @@ async function runHandler(options?: StatementInfo) {
377378
updatableTable = refs[0];
378379
}
379380

381+
const basicSelect = statementDetail.content.split(eol).filter(line => !line.trimStart().startsWith(`--`)).join(eol);
382+
380383
chosenView.setScrolling({ // Never errors
381-
basicSelect: statementDetail.content,
384+
basicSelect: basicSelect,
382385
withCancel: inWindow,
383386
ref: updatableTable,
384387
parameters,

0 commit comments

Comments
 (0)