Skip to content

Commit 62ede83

Browse files
authored
Merge pull request #438 from Achal1607/commands-fix
Fixed project clean and project compile commands in the command palette
2 parents 319bd82 + e3adfad commit 62ede83

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

vscode/src/commands/buildOperations.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { l10n } from "../localiser";
1919
import { extCommands, nbCommands } from "./commands";
2020
import { ICommand } from "./types";
2121
import { wrapCommandWithProgress, wrapProjectActionWithProgress } from "./utils";
22-
import { workspace } from "vscode";
22+
import { window, workspace } from "vscode";
2323
import * as fs from 'fs';
2424

2525
const saveFilesInWorkspaceBeforeBuild = async (callbackFn: Function) => {
@@ -52,22 +52,31 @@ const cleanWorkspaceHandler = () => {
5252
}
5353

5454
const compileProjectHandler = (args: any) => {
55+
let commandArgs = args;
56+
if (!commandArgs) {
57+
commandArgs = window.activeTextEditor?.document.uri.toString();
58+
}
59+
5560
const compileProjectFunction = () =>
5661
wrapProjectActionWithProgress('build',
5762
undefined, l10n.value('jdk.extension.command.progress.compilingProject'),
5863
LOGGER.getOutputChannel(),
59-
args
64+
commandArgs
6065
);
6166

6267
saveFilesInWorkspaceBeforeBuild(compileProjectFunction);
6368
}
6469

6570
const cleanProjectHandler = (args: any) => {
71+
let commandArgs = args;
72+
if (!commandArgs) {
73+
commandArgs = window.activeTextEditor?.document.uri.toString();
74+
}
6675
const cleanProjectHandler = () => wrapProjectActionWithProgress('clean',
6776
undefined,
6877
l10n.value('jdk.extension.command.progress.cleaningProject'),
6978
LOGGER.getOutputChannel(),
70-
args
79+
commandArgs
7180
);
7281

7382
saveFilesInWorkspaceBeforeBuild(cleanProjectHandler);

0 commit comments

Comments
 (0)