@@ -4,6 +4,7 @@ import * as net from 'net';
44import * as glob from 'glob' ;
55import { StreamInfo , Executable , ExecutableOptions } from 'vscode-languageclient' ;
66import { RequirementsData } from './requirements' ;
7+ import { getJavaEncoding } from './settings' ;
78
89declare var v8debug ;
910const DEBUG = ( typeof v8debug === 'object' ) || startedInDebugMode ( ) ;
@@ -50,6 +51,7 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp
5051 '--add-opens' ,
5152 'java.base/java.lang=ALL-UNNAMED' ) ;
5253 }
54+
5355 params . push ( '-Declipse.application=org.eclipse.jdt.ls.core.id1' ,
5456 '-Dosgi.bundles.defaultStartLevel=4' ,
5557 '-Declipse.product=org.eclipse.jdt.ls.core.product' ) ;
@@ -58,6 +60,11 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp
5860 }
5961
6062 let vmargs = javaConfiguration . get ( 'jdt.ls.vmargs' , '' ) ;
63+ const encodingKey = '-Dfile.encoding=' ;
64+ if ( vmargs . indexOf ( encodingKey ) < 0 ) {
65+ params . push ( encodingKey + getJavaEncoding ( ) ) ;
66+ }
67+
6168 parseVMargs ( params , vmargs ) ;
6269 let server_home : string = path . resolve ( __dirname , '../server' ) ;
6370 let launchersFound : Array < string > = glob . sync ( '**/plugins/org.eclipse.equinox.launcher_*.jar' , { cwd : server_home } ) ;
0 commit comments