Skip to content

Commit 8e260e2

Browse files
committed
Added error message
1 parent 0764b09 commit 8e260e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/util/commands/addComment.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77

88
import { Range, window } from 'vscode';
99
import { constants, GCommands } from '../constants';
10+
import { Messages } from '../messages';
1011
import { GCommand } from './base';
1112

1213
export class AddComment extends GCommand {
1314
constructor() {
1415
super(GCommands.AddComment);
1516
}
1617

17-
execute() {
18+
async execute() {
1819
const editor = window.activeTextEditor;
1920
let replace = '';
2021

@@ -34,9 +35,11 @@ export class AddComment extends GCommand {
3435
replace += `(${lines[i]})${i + 1 === lines.length ? '' : '\n'}`;
3536
}
3637

37-
void editor.edit(editBuilder => {
38+
await editor.edit(editBuilder => {
3839
editBuilder.replace(select, replace);
3940
});
41+
} else {
42+
await Messages.showErrorMessage('Editor does not contain G-Code');
4043
}
4144
}
4245
}

0 commit comments

Comments
 (0)