Skip to content

Commit 40779cb

Browse files
committed
fix: show a warning message instead of toggling to the SOQL Builder UI if there is no default org set
1 parent 15c9d81 commit 40779cb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/salesforcedx-vscode-soql/src/commands/soqlBuilderToggle.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,17 @@ import * as Effect from 'effect/Effect';
99
import * as vscode from 'vscode';
1010
import { URI } from 'vscode-uri';
1111
import { BUILDER_VIEW_TYPE, EDITOR_VIEW_TYPE, OPEN_WITH_COMMAND } from '../constants';
12+
import { nls } from '../messages';
13+
import { isDefaultOrgSet } from '../services/org';
1214

1315
export const soqlBuilderToggle = Effect.fn('soql_builder_toggle')(function* (doc: URI) {
16+
const hasOrg = yield* Effect.promise(() => isDefaultOrgSet());
17+
if (!hasOrg) {
18+
yield* Effect.sync(() => {
19+
void vscode.window.showWarningMessage(nls.localize('info_no_default_org'));
20+
});
21+
return;
22+
}
1423
const viewType = vscode.window.activeTextEditor ? BUILDER_VIEW_TYPE : EDITOR_VIEW_TYPE;
1524
yield* Effect.promise(() => vscode.commands.executeCommand(OPEN_WITH_COMMAND, doc, viewType));
1625
});

0 commit comments

Comments
 (0)