Skip to content

Commit

Permalink
revert button handling
Browse files Browse the repository at this point in the history
  • Loading branch information
idleberg committed Mar 26, 2024
1 parent ece60ea commit 3ae176c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getConfig } from 'vscode-get-config';
import { infoChannel, makensisChannel } from './channel';
import { platform } from 'node:os';

import { type MessageOptions, window } from 'vscode';
import { window } from 'vscode';
import type Makensis from 'makensis/types';

export async function compilerOutput(data: Makensis.CompilerData): Promise<void> {
Expand Down Expand Up @@ -43,28 +43,26 @@ export async function compilerExit(data: Makensis.CompilerOutput): Promise<void>
}

const outfileExists = await fileExists(String(data.outFile));
const buttons: string[] = [];

if (await isWindowsCompatible() === true && data.outFile?.length && outfileExists) {
buttons.push('Run');
}

if (outfileExists && ['win32', 'darwin', 'linux'].includes(platform())) {
buttons.push('Reveal');
}
const openButton = (await isWindowsCompatible() === true && data.outFile?.length && outfileExists)
? 'Run'
: '';
const revealButton = (outfileExists && ['win32', 'darwin', 'linux'].includes(platform()))
? 'Reveal'
: '';

if (data['warnings'] && showNotifications) {
if (showOutputView === 'On Warnings & Errors') {
makensisChannel.show(true);
}

const choice = await window.showWarningMessage(`Compiled with warnings`, buttons as MessageOptions);
const choice = await window.showWarningMessage(`Compiled with warnings`, openButton, revealButton);

if (choice) {
await buttonHandler(choice, data.outFile);
}
} else if (showNotifications) {
const choice = await window.showInformationMessage(`Compiled successfully`, buttons as MessageOptions);
const choice = await window.showInformationMessage(`Compiled successfully`, openButton, revealButton);

if (choice) {
await buttonHandler(choice, data.outFile);
Expand Down

0 comments on commit 3ae176c

Please sign in to comment.