Skip to content

Commit

Permalink
fix: Cannot click on statusBar without devmode enabled (#466)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangjian <[email protected]>

Co-authored-by: zhangjian <[email protected]>
  • Loading branch information
zhangjian10 and zhangjian authored Mar 24, 2022
1 parent a0ad5bf commit 514a5e7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
29 changes: 11 additions & 18 deletions src/main/commands/sync/OpenSyncCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,20 @@ export default class OpenSyncCommand implements ICommand {
async execCommand(ary: any) {
const [msg, sync] = ary as [SyncMsg, Sync];

let commands: { [key: string]: Function } = {};
let commands: { [key: string]: Function } = {
[localize("overrideRemoteChang", "Overwrite Remote File")]:
vscode.commands.executeCommand.bind(null, OVERRIDE_SYNC, sync),
};

if (msg.status === "disconnected") {
commands[
localize("resumeSync", "Resume File Sync")
] = vscode.commands.executeCommand.bind(null, RECONNECT_SYNC, sync);
commands[localize("resumeSync", "Resume File Sync")] =
vscode.commands.executeCommand.bind(null, RECONNECT_SYNC, sync);
}

commands = Object.assign(commands, {
[localize(
"overrideRemoteChang",
"Overwrite Remote File"
)]: vscode.commands.executeCommand.bind(null, OVERRIDE_SYNC, sync),
[localize(
"sync.openDashboard",
"Open Sync Dashboard"
)]: vscode.commands.executeCommand.bind(
null,
OPEN_SYNC_DASHBOARD,
msg.gui
),
});
if (msg.gui) {
commands[localize("sync.openDashboard", "Open Sync Dashboard")] =
vscode.commands.executeCommand.bind(null, OPEN_SYNC_DASHBOARD, msg.gui);
}

const result = await host.showQuickPick(Object.keys(commands));

Expand Down
15 changes: 10 additions & 5 deletions src/main/commands/sync/SyncServiceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@ export default class SyncServiceCommand implements ICommand {

host.statusBar.text = `$(${this.getIcon(r.status)}) ${r.msg}`;
host.statusBar.tooltip = r.tips;
host.statusBar.command = {
title: OPEN_SYNC_COMMAND,
command: OPEN_SYNC_COMMAND,
arguments: [[r, syncData]],
};

if (r.status !== "end") {
host.statusBar.command = {
title: OPEN_SYNC_COMMAND,
command: OPEN_SYNC_COMMAND,
arguments: [[r, syncData]],
};
} else {
host.statusBar.command = null;
}

host.statusBar.show();
} catch (e) {
Expand Down

0 comments on commit 514a5e7

Please sign in to comment.