Allow overriding vscode language server options
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.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pivotal-tools/commons-vscode",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"description": "commons-vscode",
|
||||
"license": "MIT",
|
||||
"repository": "",
|
||||
|
||||
@@ -31,13 +31,14 @@ export interface ActivatorOptions {
|
||||
extensionId: string;
|
||||
clientOptions: LanguageClientOptions;
|
||||
jvmHeap?: string;
|
||||
workspaceOptions?: VSCode.WorkspaceConfiguration;
|
||||
workspaceOptions: VSCode.WorkspaceConfiguration;
|
||||
checkjvm?: (context: VSCode.ExtensionContext, jvm: JVM) => any;
|
||||
preferJdk?: boolean;
|
||||
}
|
||||
|
||||
type JavaOptions = {
|
||||
heap?: string
|
||||
home?: string
|
||||
}
|
||||
|
||||
function getUserDefinedJvmHeap(wsOpts : VSCode.WorkspaceConfiguration, dflt : string) : string {
|
||||
@@ -48,6 +49,14 @@ function getUserDefinedJvmHeap(wsOpts : VSCode.WorkspaceConfiguration, dflt : s
|
||||
return (javaOptions && javaOptions.heap) || dflt;
|
||||
}
|
||||
|
||||
function getUserDefinedJavaHome(wsOpts : VSCode.WorkspaceConfiguration) : string {
|
||||
if (!wsOpts) {
|
||||
return null;
|
||||
}
|
||||
let javaOptions : JavaOptions = wsOpts.get("java");
|
||||
return javaOptions && javaOptions.home;
|
||||
}
|
||||
|
||||
export function activate(options: ActivatorOptions, context: VSCode.ExtensionContext): Thenable<LanguageClient> {
|
||||
let DEBUG = options.DEBUG;
|
||||
let jvmHeap = getUserDefinedJvmHeap(options.workspaceOptions, options.jvmHeap);
|
||||
@@ -74,7 +83,7 @@ export function activate(options: ActivatorOptions, context: VSCode.ExtensionCon
|
||||
|
||||
let findJRE = options.preferJdk ? findJdk : findJvm;
|
||||
|
||||
return findJRE()
|
||||
return findJRE(getUserDefinedJavaHome(options.workspaceOptions))
|
||||
.catch(error => {
|
||||
VSCode.window.showErrorMessage("Error trying to find JVM: "+error);
|
||||
return Promise.reject(error);
|
||||
|
||||
@@ -32,6 +32,7 @@ export function activate(context: VSCode.ExtensionContext) {
|
||||
CONNECT_TO_LS: false,
|
||||
extensionId: 'vscode-bosh',
|
||||
jvmHeap: "48m",
|
||||
workspaceOptions: VSCode.workspace.getConfiguration("bosh.ls"),
|
||||
clientOptions: {
|
||||
documentSelector: [
|
||||
"bosh-deployment-manifest",
|
||||
|
||||
@@ -64,6 +64,14 @@
|
||||
"type": "object",
|
||||
"title": "Bosh CLI Configuration",
|
||||
"properties": {
|
||||
"bosh.ls.java.heap": {
|
||||
"type": ["string", "null"],
|
||||
"description": "Passed as an `-Xmx` argument to the language server JVM process"
|
||||
},
|
||||
"bosh.ls.java.home": {
|
||||
"type": ["string", "null"],
|
||||
"description": "Overrides JAVA_HOME used for launching the language server JVM process"
|
||||
},
|
||||
"bosh.cli.command": {
|
||||
"type": [
|
||||
"string",
|
||||
@@ -99,7 +107,7 @@
|
||||
"vsce-package": "vsce package"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pivotal-tools/commons-vscode": "^0.2.0",
|
||||
"@pivotal-tools/commons-vscode": "file:../commons-vscode/pivotal-tools-commons-vscode-0.2.2.tgz",
|
||||
"vscode-languageclient": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -33,11 +33,12 @@
|
||||
"title": "Concourse Language Server Options",
|
||||
"properties": {
|
||||
"concourse.ls.java.heap": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "Passed as an `-Xmx` argument to the concourse language server process"
|
||||
"type": ["string", "null"],
|
||||
"description": "Passed as an `-Xmx` argument to the language server JVM process"
|
||||
},
|
||||
"concourse.ls.java.home": {
|
||||
"type": ["string", "null"],
|
||||
"description": "Overrides JAVA_HOME used for launching the language server JVM process"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -90,7 +91,7 @@
|
||||
"vsce-package": "vsce package"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pivotal-tools/commons-vscode": "^0.2.0",
|
||||
"@pivotal-tools/commons-vscode": "file:../commons-vscode/pivotal-tools-commons-vscode-0.2.2.tgz",
|
||||
"vscode-languageclient": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -31,6 +31,7 @@ export function activate(context: VSCode.ExtensionContext) {
|
||||
DEBUG : false,
|
||||
CONNECT_TO_LS: false,
|
||||
extensionId: 'vscode-manifest-yaml',
|
||||
workspaceOptions: VSCode.workspace.getConfiguration("cloudfoundry-manifest.ls"),
|
||||
jvmHeap: '64m',
|
||||
clientOptions: {
|
||||
documentSelector: ["manifest-yaml"]
|
||||
|
||||
@@ -45,7 +45,20 @@
|
||||
"scopeName": "source.yaml",
|
||||
"path": "./yaml-support/yaml.tmLanguage"
|
||||
}
|
||||
]
|
||||
],
|
||||
"configuration": {
|
||||
"title": "Cloudfoundry Manifest Language Server Configuration",
|
||||
"properties": {
|
||||
"cloudfoundry-manifest.ls.java.heap": {
|
||||
"type": ["string", "null"],
|
||||
"description": "Passed as an `-Xmx` argument to the language server JVM process"
|
||||
},
|
||||
"cloudfoundry-manifest.ls.java.home": {
|
||||
"type": ["string", "null"],
|
||||
"description": "Overrides JAVA_HOME used for launching the language server JVM process"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"main": "./out/lib/Main",
|
||||
"scripts": {
|
||||
@@ -58,7 +71,7 @@
|
||||
"vsce-package": "vsce package"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pivotal-tools/commons-vscode": "file:../commons-vscode/pivotal-tools-commons-vscode-0.2.1.tgz",
|
||||
"@pivotal-tools/commons-vscode": "file:../commons-vscode/pivotal-tools-commons-vscode-0.2.2.tgz",
|
||||
"vscode-languageclient": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -26,6 +26,7 @@ export function activate(context: VSCode.ExtensionContext) {
|
||||
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: {
|
||||
|
||||
@@ -66,7 +66,17 @@
|
||||
"boot-java.boot-hints.on": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Enable/Disable Spring running Boot application live hints decorators in the source code"
|
||||
"description": "Enable/Disable Spring running Boot application live hints decorators in Java source code"
|
||||
},
|
||||
"spring-boot.ls.java.home": {
|
||||
"type": ["string", null],
|
||||
"default": null,
|
||||
"description": "Override JAVA_HOME used for launching the spring-boot-language-server JVM process."
|
||||
},
|
||||
"spring-boot.ls.java.heap": {
|
||||
"type": ["string", null],
|
||||
"default": null,
|
||||
"description": "Max JVM heap value, passed via -Xmx argument when launching spring-boot-language-server JVM process."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -94,7 +104,7 @@
|
||||
"vsce-package": "vsce package"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pivotal-tools/commons-vscode": "file:../commons-vscode/pivotal-tools-commons-vscode-0.2.1.tgz",
|
||||
"@pivotal-tools/commons-vscode": "file:../commons-vscode/pivotal-tools-commons-vscode-0.2.2.tgz",
|
||||
"vscode-languageclient": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user