JAVA_HOME and heap can now be overridden by the user from vscode worspace settings, in a similar way for all our language servers, by setting XXX.java.home and XXX.java.heap configuration keys.
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
'use strict';
|
|
|
|
import * as VSCode from 'vscode';
|
|
import * as Path from 'path';
|
|
import * as FS from 'fs';
|
|
import * as Net from 'net';
|
|
import * as ChildProcess from 'child_process';
|
|
import {LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, StreamInfo} from 'vscode-languageclient';
|
|
import { workspace, TextDocument } from 'vscode';
|
|
|
|
import * as commons from '@pivotal-tools/commons-vscode';
|
|
|
|
const PROPERTIES_LANGUAGE_ID = "spring-boot-properties";
|
|
const YAML_LANGUAGE_ID = "spring-boot-properties-yaml";
|
|
const JAVA_LANGUAGE_ID = "java";
|
|
|
|
/** Called when extension is activated */
|
|
export function activate(context: VSCode.ExtensionContext) {
|
|
let options : commons.ActivatorOptions = {
|
|
DEBUG: false,
|
|
CONNECT_TO_LS: false,
|
|
extensionId: 'vscode-spring-boot',
|
|
preferJdk: true,
|
|
checkjvm: (context: VSCode.ExtensionContext, jvm: commons.JVM) => {
|
|
if (!jvm.isJdk()) {
|
|
VSCode.window.showWarningMessage('JAVA_HOME or PATH environment variable seems to point to a JRE. A JDK is required, hence Boot Hints are unavailable.');
|
|
}
|
|
},
|
|
workspaceOptions: VSCode.workspace.getConfiguration("spring-boot.ls"),
|
|
clientOptions: {
|
|
documentSelector: [ PROPERTIES_LANGUAGE_ID, YAML_LANGUAGE_ID, JAVA_LANGUAGE_ID ],
|
|
synchronize: {
|
|
configurationSection: 'boot-java'
|
|
},
|
|
initializationOptions: {
|
|
workspaceFolders: workspace.workspaceFolders ? workspace.workspaceFolders.map(f => f.uri.toString()) : null
|
|
}
|
|
}
|
|
};
|
|
|
|
return commons.activate(options, context);
|
|
}
|