Skip to content

Commit e6b985b

Browse files
committed
fix-163 Studio Context Actions command errored if no file open
1 parent fbb94e9 commit e6b985b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@
130130
{
131131
"command": "vscode-objectscript.studio.actions",
132132
"when": "vscode-objectscript.connectActive && resourceScheme == isfs"
133+
},
134+
{
135+
"command": "vscode-objectscript.studio.contextActions",
136+
"when": "false"
133137
}
134138
],
135139
"view/title": [

src/commands/studio.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,8 @@ class StudioActions {
337337
}
338338
}
339339

340-
// export function contextMenu(uri: vscode.Uri): Promise<void> {
341-
// return doMenuAction(uri, "context");
342-
// }
343-
344340
export async function mainMenu(uri: vscode.Uri) {
345-
uri = uri || vscode.window.activeTextEditor.document.uri;
341+
uri = uri || vscode.window.activeTextEditor?.document.uri;
346342
if (!uri || uri.scheme !== FILESYSTEM_SCHEMA) {
347343
return;
348344
}
@@ -351,8 +347,8 @@ export async function mainMenu(uri: vscode.Uri) {
351347
}
352348

353349
export async function contextMenu(node: PackageNode | ClassNode | RoutineNode): Promise<any> {
354-
const nodeOrUri = node || vscode.window.activeTextEditor.document.uri;
355-
if(!nodeOrUri || (nodeOrUri instanceof vscode.Uri && nodeOrUri.scheme !== FILESYSTEM_SCHEMA)) {
350+
const nodeOrUri = node || vscode.window.activeTextEditor?.document.uri;
351+
if (!nodeOrUri || (nodeOrUri instanceof vscode.Uri && nodeOrUri.scheme !== FILESYSTEM_SCHEMA)) {
356352
return;
357353
}
358354
const studioActions = new StudioActions(nodeOrUri);

0 commit comments

Comments
 (0)