11
2- import * as path from 'path' ;
3- import * as net from 'net' ;
2+ import * as fs from 'fs' ;
43import * as glob from 'glob' ;
4+ import * as net from 'net' ;
55import * as os from 'os' ;
6- import * as fs from 'fs' ;
7- import { StreamInfo , Executable , ExecutableOptions } from 'vscode-languageclient/node' ;
8- import { RequirementsData } from './requirements' ;
9- import { getJavaEncoding , IS_WORKSPACE_VMARGS_ALLOWED , getKey , getJavaagentFlag , isInWorkspaceFolder } from './settings' ;
6+ import * as path from 'path' ;
7+ import { ExtensionContext , workspace } from 'vscode' ;
8+ import { Executable , ExecutableOptions , StreamInfo } from 'vscode-languageclient/node' ;
109import { logger } from './log' ;
11- import { getJavaConfiguration , deleteDirectory , ensureExists , getTimestamp } from './utils' ;
12- import { workspace , ExtensionContext , window } from 'vscode' ;
1310import { addLombokParam , isLombokSupportEnabled } from './lombokSupport' ;
11+ import { RequirementsData } from './requirements' ;
12+ import { getJavaagentFlag , getJavaEncoding , getKey , isInWorkspaceFolder , IS_WORKSPACE_VMARGS_ALLOWED } from './settings' ;
13+ import { deleteDirectory , ensureExists , getJavaConfiguration , getTimestamp } from './utils' ;
1414
1515// eslint-disable-next-line no-var
1616declare var v8debug ;
@@ -30,6 +30,13 @@ export function prepareExecutable(requirements: RequirementsData, workspacePath,
3030 const executable : Executable = Object . create ( null ) ;
3131 const options : ExecutableOptions = Object . create ( null ) ;
3232 options . env = Object . assign ( { syntaxserver : isSyntaxServer } , process . env ) ;
33+ if ( os . platform ( ) === 'win32' ) {
34+ const vmargs = getJavaConfiguration ( ) . get ( 'jdt.ls.vmargs' , '' ) ;
35+ const watchParentProcess = '-DwatchParentProcess=false' ;
36+ if ( vmargs . indexOf ( watchParentProcess ) < 0 ) {
37+ options . detached = true ;
38+ }
39+ }
3340 executable . options = options ;
3441 executable . command = path . resolve ( `${ requirements . tooling_jre } /bin/java` ) ;
3542 executable . args = prepareParams ( requirements , javaConfig , workspacePath , context , isSyntaxServer ) ;
@@ -106,12 +113,6 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp
106113 if ( vmargs . indexOf ( encodingKey ) < 0 ) {
107114 params . push ( encodingKey + getJavaEncoding ( ) ) ;
108115 }
109- if ( os . platform ( ) === 'win32' ) {
110- const watchParentProcess = '-DwatchParentProcess=' ;
111- if ( vmargs . indexOf ( watchParentProcess ) < 0 ) {
112- params . push ( `${ watchParentProcess } false` ) ;
113- }
114- }
115116 if ( vmargs . indexOf ( '-Xlog:' ) < 0 ) {
116117 params . push ( '-Xlog:disable' ) ;
117118 }
0 commit comments