@@ -23,11 +23,11 @@ import * as path from 'path';
2323import { Uri , workspace } from 'vscode' ;
2424
2525const expandHomeDir = require ( 'expand-home-dir' ) ;
26- import * as findJavaHome from 'find-java-home' ;
26+ const findJavaHome = require ( 'find-java-home' ) ;
2727import { JavaExtensionAPI } from '../extension' ;
2828import { localize } from './i18nUtil' ;
2929const isWindows = process . platform . indexOf ( 'win' ) === 0 ;
30- const JAVA_FILENAME = 'java' + ( isWindows ? '.exe' : '' ) ;
30+ const JAVA_FILENAME = 'java' + ( isWindows ? '.exe' : '' ) ;
3131
3232const REQUIRED_JAVA_VERSION = 21 ;
3333
@@ -58,18 +58,18 @@ export async function resolveRequirements(api: JavaExtensionAPI): Promise<Requir
5858
5959 const javaHome = await checkJavaRuntime ( 'java.jdt.ls.java.home' ) ;
6060 const javaVersion = await checkJavaVersion ( javaHome , true ) ;
61- return Promise . resolve ( { tooling_jre : javaHome , tooling_jre_version : javaVersion , java_home : javaHome , java_version : javaVersion } ) ;
61+ return Promise . resolve ( { tooling_jre : javaHome , tooling_jre_version : javaVersion , java_home : javaHome , java_version : javaVersion } ) ;
6262}
6363
64- export async function resolveLclsRequirements ( api :JavaExtensionAPI ) {
64+ export async function resolveLclsRequirements ( api : JavaExtensionAPI ) {
6565 const javaHome = await checkJavaRuntime ( 'xml.java.home' ) ;
6666 return checkJavaVersion ( javaHome , false ) ;
6767}
6868
6969function checkJavaRuntime ( property : string ) : Promise < string > {
7070 return new Promise ( ( resolve , reject ) => {
7171 let source : string ;
72- let javaHome : string | undefined = readJavaHomeConfig ( property ) ;
72+ let javaHome : string | undefined = readJavaHomeConfig ( property ) ;
7373
7474 if ( javaHome ) {
7575 source = localize ( "check.java.runtime.vscode.java.home" ) ;
@@ -94,6 +94,7 @@ function checkJavaRuntime(property: string): Promise<string> {
9494 }
9595 // No settings, let's try to detect as last resort.
9696 findJavaHome ( { allowJre : true } , ( err : any , home : any ) => {
97+ require
9798 if ( err ) {
9899 openJDKDownload ( reject , localize ( "check.java.runtime.failed.locate" ) ) ;
99100 }
@@ -104,7 +105,7 @@ function checkJavaRuntime(property: string): Promise<string> {
104105 } ) ;
105106}
106107
107- function readJavaHomeConfig ( property : string ) : string | undefined {
108+ function readJavaHomeConfig ( property : string ) : string | undefined {
108109 const config = workspace . getConfiguration ( ) ;
109110 let javaHome = config . get < string > ( property ) ;
110111 return ( javaHome != null ) ? javaHome : config . get < string > ( 'java.home' ) ;
0 commit comments