@@ -19,7 +19,7 @@ import { l10n } from "../localiser";
1919import { extCommands , nbCommands } from "./commands" ;
2020import { ICommand } from "./types" ;
2121import { wrapCommandWithProgress , wrapProjectActionWithProgress } from "./utils" ;
22- import { workspace } from "vscode" ;
22+ import { window , workspace } from "vscode" ;
2323import * as fs from 'fs' ;
2424
2525const saveFilesInWorkspaceBeforeBuild = async ( callbackFn : Function ) => {
@@ -52,22 +52,31 @@ const cleanWorkspaceHandler = () => {
5252}
5353
5454const 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
6570const 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