Skip to content

Commit

Permalink
fix(#92): activate extension on all commands (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Feb 16, 2022
1 parent 26adb02 commit 108ace3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
],
"activationEvents": [
"workspaceContains:**/*playwright*.config.{ts,js,mjs}",
"onCommand:pw.extension.install"
"onCommand:pw.extension.install",
"onCommand:pw.extension.recordTest",
"onCommand:pw.extension.refreshTests"
],
"main": "./out/extension.js",
"contributes": {
Expand Down
12 changes: 10 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,18 @@ export class Extension {
vscode.window.onDidChangeVisibleTextEditors(() => {
this._updateVisibleEditorItems();
}),
vscode.commands.registerCommand('pw.extension.refreshTests', () => {
this._rebuildModel();
vscode.commands.registerCommand('pw.extension.refreshTests', async () => {
await this._rebuildModel();
if (!this._models.length) {
vscode.window.showWarningMessage('No Playwright Test config files found.');
return;
}
}),
vscode.commands.registerCommand('pw.extension.recordTest', async () => {
if (!this._models.length) {
vscode.window.showWarningMessage('No Playwright Test config files found.');
return;
}
this._recorder.record(this._models);
}),
vscode.commands.registerCommand('pw.extension.install', () => {
Expand Down

0 comments on commit 108ace3

Please sign in to comment.