1
1
2
- import * as path from 'path' ;
3
- import * as net from 'net' ;
2
+ import * as fs from 'fs' ;
4
3
import * as glob from 'glob' ;
4
+ import * as net from 'net' ;
5
5
import * 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' ;
10
9
import { logger } from './log' ;
11
- import { getJavaConfiguration , deleteDirectory , ensureExists , getTimestamp } from './utils' ;
12
- import { workspace , ExtensionContext , window } from 'vscode' ;
13
10
import { 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' ;
14
14
15
15
// eslint-disable-next-line no-var
16
16
declare var v8debug ;
@@ -30,6 +30,13 @@ export function prepareExecutable(requirements: RequirementsData, workspacePath,
30
30
const executable : Executable = Object . create ( null ) ;
31
31
const options : ExecutableOptions = Object . create ( null ) ;
32
32
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
+ }
33
40
executable . options = options ;
34
41
executable . command = path . resolve ( `${ requirements . tooling_jre } /bin/java` ) ;
35
42
executable . args = prepareParams ( requirements , javaConfig , workspacePath , context , isSyntaxServer ) ;
@@ -106,12 +113,6 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp
106
113
if ( vmargs . indexOf ( encodingKey ) < 0 ) {
107
114
params . push ( encodingKey + getJavaEncoding ( ) ) ;
108
115
}
109
- if ( os . platform ( ) === 'win32' ) {
110
- const watchParentProcess = '-DwatchParentProcess=' ;
111
- if ( vmargs . indexOf ( watchParentProcess ) < 0 ) {
112
- params . push ( `${ watchParentProcess } false` ) ;
113
- }
114
- }
115
116
if ( vmargs . indexOf ( '-Xlog:' ) < 0 ) {
116
117
params . push ( '-Xlog:disable' ) ;
117
118
}
0 commit comments