@@ -23,10 +23,18 @@ import * as vscode from 'vscode';
23
23
import { homedir } from 'os' ;
24
24
25
25
export async function initializeRunConfiguration ( ) : Promise < boolean > {
26
- const java = await vscode . workspace . findFiles ( '**/*.java' , '**/node_modules/**' , 1 ) ;
27
- if ( java ?. length > 0 ) {
26
+ if ( vscode . workspace . name || vscode . workspace . workspaceFile ) {
27
+ const java = await vscode . workspace . findFiles ( '**/*.java' , '**/node_modules/**' , 1 ) ;
28
+ if ( java ?. length > 0 ) {
28
29
return true ;
29
- }
30
+ }
31
+ } else {
32
+ for ( let doc of vscode . workspace . textDocuments ) {
33
+ if ( doc . fileName ?. endsWith ( ".java" ) ) {
34
+ return true ;
35
+ }
36
+ }
37
+ }
30
38
return false ;
31
39
}
32
40
@@ -152,7 +160,7 @@ class RunConfigurationNode extends vscode.TreeItem {
152
160
153
161
setValue ( value : string | undefined ) {
154
162
this . value = value ;
155
- this . getConfig ( ) . update ( this . settingsKey , this . value , false ) ;
163
+ this . getConfig ( ) . update ( this . settingsKey , this . value , vscode . workspace . name || vscode . workspace . workspaceFile ? null : true ) ;
156
164
this . updateNode ( ) ;
157
165
}
158
166
@@ -192,7 +200,7 @@ const vmOptionsNode = new VMOptionsNode();
192
200
class EnvironmentVariablesNode extends RunConfigurationNode {
193
201
194
202
constructor ( ) {
195
- super ( 'Environment:' , 'Customize evironment variables' , 'Example: var1=one, varTwo=2' , 'env' ) ;
203
+ super ( 'Environment:' , 'Customize environment variables' , 'Example: var1=one, varTwo=2' , 'env' ) ;
196
204
}
197
205
198
206
}
0 commit comments