PT #164851432: Support custom VM args in Atom extensions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as path from 'path';
|
||||
import {JavaProcessLanguageClient} from '@pivotal-tools/atom-languageclient-commons';
|
||||
import {JavaProcessLanguageClient, JavaOptions} from '@pivotal-tools/atom-languageclient-commons';
|
||||
import {ActiveServer} from 'atom-languageclient';
|
||||
import {JVM} from '@pivotal-tools/jvm-launch-utils';
|
||||
|
||||
@@ -49,4 +49,14 @@ export class BoshYamlClient extends JavaProcessLanguageClient {
|
||||
server.connection.didChangeConfiguration({ settings: atom.config.get('bosh-yaml') });
|
||||
}
|
||||
|
||||
getJavaOptions(): JavaOptions {
|
||||
const home = atom.config.get('bosh-yaml.java.home');
|
||||
const vmargs = atom.config.get('bosh-yaml.java.vmargs');
|
||||
return {
|
||||
home: typeof home === 'string' ? home : undefined,
|
||||
vmargs: Array.isArray(vmargs) ? vmargs : undefined
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -45,12 +45,29 @@
|
||||
"description": "Number of seconds before CLI commands are terminated with a timeout"
|
||||
}
|
||||
}
|
||||
},
|
||||
"java": {
|
||||
"type": "object",
|
||||
"description": "JVM settings for starting the Language Server",
|
||||
"properties": {
|
||||
"vmargs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Custom VM arguments to start the Language Server"
|
||||
},
|
||||
"home": {
|
||||
"type": "string",
|
||||
"description": "Java home folder to use to start the Language Server"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"@pivotal-tools/atom-languageclient-commons": "0.0.12"
|
||||
"@pivotal-tools/atom-languageclient-commons": "0.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^2.7.2",
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"jarUrl": "https://s3.amazonaws.com/dist.springsource.com/release/STS4/fatjars/bosh-language-server-1.2.0-201812201255.jar"
|
||||
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/bosh-language-server-1.6.0-201904021915.jar"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as path from 'path';
|
||||
import { JavaProcessLanguageClient } from '@pivotal-tools/atom-languageclient-commons';
|
||||
import { JavaProcessLanguageClient, JavaOptions } from '@pivotal-tools/atom-languageclient-commons';
|
||||
import {JVM} from '@pivotal-tools/jvm-launch-utils';
|
||||
|
||||
export class ManifestYamlLanguageClient extends JavaProcessLanguageClient {
|
||||
@@ -42,4 +42,13 @@ export class ManifestYamlLanguageClient extends JavaProcessLanguageClient {
|
||||
|
||||
}
|
||||
|
||||
getJavaOptions(): JavaOptions {
|
||||
const home = atom.config.get('cf-manifest-yaml.java.home');
|
||||
const vmargs = atom.config.get('cf-manifest-yaml.java.vmargs');
|
||||
return {
|
||||
home: typeof home === 'string' ? home : undefined,
|
||||
vmargs: Array.isArray(vmargs) ? vmargs : undefined
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,8 +18,27 @@
|
||||
"server/",
|
||||
"properties.json"
|
||||
],
|
||||
"configSchema": {
|
||||
"java": {
|
||||
"type": "object",
|
||||
"description": "JVM settings for starting the Language Server",
|
||||
"properties": {
|
||||
"vmargs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Custom VM arguments to start the Language Server"
|
||||
},
|
||||
"home": {
|
||||
"type": "string",
|
||||
"description": "Java home folder to use to start the Language Server"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@pivotal-tools/atom-languageclient-commons": "0.0.12",
|
||||
"@pivotal-tools/atom-languageclient-commons": "0.0.15",
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5"
|
||||
},
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/manifest-yaml-language-server-1.2.0-201812201255.jar"
|
||||
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/manifest-yaml-language-server-1.6.0-201904021915.jar"
|
||||
}
|
||||
|
||||
@@ -121,7 +121,9 @@ export class JavaProcessLanguageClient extends AutoLanguageClient {
|
||||
}
|
||||
|
||||
findJvm(): Promise<JVM | null> {
|
||||
return this.preferJdk() ? findJdk() : findJvm();
|
||||
const options = this.getJavaOptions();
|
||||
const javaHome = options ? this.getJavaOptions().home : '';
|
||||
return this.preferJdk() ? findJdk(javaHome) : findJvm(javaHome);
|
||||
}
|
||||
|
||||
private launchProcess(port: number): Promise<LanguageServerProcess> {
|
||||
@@ -162,6 +164,11 @@ export class JavaProcessLanguageClient extends AutoLanguageClient {
|
||||
'-Dlsp.yaml.completions.errors.disable=true',
|
||||
]);
|
||||
|
||||
const javaOptions = this.getJavaOptions();
|
||||
if (javaOptions && javaOptions.vmargs) {
|
||||
vmArgs.push(...javaOptions.vmargs);
|
||||
}
|
||||
|
||||
this.logger.debug(`starting "${jvm.getJavaExecutable()} ${vmArgs.join('\n')}\n-jar ${launcher}"`);
|
||||
return jvm.jarLaunch(launcher, vmArgs, { cwd: this.serverHome });
|
||||
}
|
||||
@@ -170,5 +177,14 @@ export class JavaProcessLanguageClient extends AutoLanguageClient {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected getJavaOptions(): JavaOptions {
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface JavaOptions {
|
||||
home?: string;
|
||||
vmargs?: string[];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import {JavaProcessLanguageClient} from './java-process-language-client';
|
||||
import {JavaProcessLanguageClient, JavaOptions} from './java-process-language-client';
|
||||
import {StsAdapter, CursorMovementParams, HighlightParams, ProgressParams} from './sts-adapter';
|
||||
|
||||
export {
|
||||
JavaProcessLanguageClient,
|
||||
JavaOptions,
|
||||
StsAdapter,
|
||||
CursorMovementParams,
|
||||
HighlightParams,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pivotal-tools/atom-languageclient-commons",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.15",
|
||||
"description": "Atom language client commons for STS4 language servers",
|
||||
"repository": "https://github.com/spring-projects/sts4",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as path from 'path';
|
||||
import { JavaProcessLanguageClient } from '@pivotal-tools/atom-languageclient-commons';
|
||||
import { JavaProcessLanguageClient, JavaOptions } from '@pivotal-tools/atom-languageclient-commons';
|
||||
import {JVM} from '@pivotal-tools/jvm-launch-utils';
|
||||
|
||||
export class ConcourseCiYamlClient extends JavaProcessLanguageClient {
|
||||
@@ -39,4 +39,13 @@ export class ConcourseCiYamlClient extends JavaProcessLanguageClient {
|
||||
|
||||
}
|
||||
|
||||
getJavaOptions(): JavaOptions {
|
||||
const home = atom.config.get('concourse-pipeline-yaml.java.home');
|
||||
const vmargs = atom.config.get('concourse-pipeline-yaml.java.vmargs');
|
||||
return {
|
||||
home: typeof home === 'string' ? home : undefined,
|
||||
vmargs: Array.isArray(vmargs) ? vmargs : undefined
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,10 +18,29 @@
|
||||
"server/",
|
||||
"properties.json"
|
||||
],
|
||||
"configSchema": {
|
||||
"java": {
|
||||
"type": "object",
|
||||
"description": "JVM settings for starting the Language Server",
|
||||
"properties": {
|
||||
"vmargs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Custom VM arguments to start the Language Server"
|
||||
},
|
||||
"home": {
|
||||
"type": "string",
|
||||
"description": "Java home folder to use to start the Language Server"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"@pivotal-tools/atom-languageclient-commons": "0.0.12"
|
||||
"@pivotal-tools/atom-languageclient-commons": "0.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^2.7.2",
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"jarUrl": "https://s3.amazonaws.com/dist.springsource.com/release/STS4/fatjars/concourse-language-server-1.2.0-201812201255.jar"
|
||||
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/concourse-language-server-1.6.0-201904021915.jar"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as path from 'path';
|
||||
import {JavaProcessLanguageClient} from '@pivotal-tools/atom-languageclient-commons';
|
||||
import {JavaProcessLanguageClient, JavaOptions} from '@pivotal-tools/atom-languageclient-commons';
|
||||
import {BootStsAdapter} from './boot-sts-adapter';
|
||||
import {ActiveServer} from 'atom-languageclient';
|
||||
import {JVM} from '@pivotal-tools/jvm-launch-utils';
|
||||
@@ -18,11 +18,11 @@ export class SpringBootLanguageClient extends JavaProcessLanguageClient {
|
||||
protected postInitialization(server: ActiveServer) {
|
||||
super.postInitialization(server);
|
||||
this.sendConfig(server);
|
||||
(<any>this)._disposable.add(atom.config.observe('boot-java', () => this.sendConfig(server)));
|
||||
(<any>this)._disposable.add(atom.config.observe('spring-boot', () => this.sendConfig(server)));
|
||||
}
|
||||
|
||||
private sendConfig(server: ActiveServer) {
|
||||
server.connection.didChangeConfiguration({ settings: {'boot-java': atom.config.get('boot-java') }});
|
||||
server.connection.didChangeConfiguration({ settings: {'boot-java': atom.config.get('spring-boot') }});
|
||||
}
|
||||
|
||||
getGrammarScopes() {
|
||||
@@ -71,4 +71,13 @@ export class SpringBootLanguageClient extends JavaProcessLanguageClient {
|
||||
return filePath.endsWith('.gradle') || filePath.endsWith(path.join('', 'pom.xml'));
|
||||
}
|
||||
|
||||
getJavaOptions(): JavaOptions {
|
||||
const home = atom.config.get('spring-boot.java.home');
|
||||
const vmargs = atom.config.get('spring-boot.java.vmargs');
|
||||
return {
|
||||
home: typeof home === 'string' ? home : undefined,
|
||||
vmargs: Array.isArray(vmargs) ? vmargs : undefined
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,10 +49,27 @@
|
||||
}
|
||||
},
|
||||
"description": "Array of jmx urls pointing to remote spring boot applications to poll for live hover information. A typical url looks something like this: `service:jmx:rmi://localhost:9111/jndi/rmi://localhost:9111/jmxrmi`"
|
||||
},
|
||||
"java": {
|
||||
"type": "object",
|
||||
"description": "JVM settings for starting the Language Server",
|
||||
"properties": {
|
||||
"vmargs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Custom VM arguments to start the Language Server"
|
||||
},
|
||||
"home": {
|
||||
"type": "string",
|
||||
"description": "Java home folder to use to start the Language Server"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@pivotal-tools/atom-languageclient-commons": "0.0.12",
|
||||
"@pivotal-tools/atom-languageclient-commons": "0.0.15",
|
||||
"vscode-languageserver-protocol": "3.12.0",
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"jarUrl": "https://s3.amazonaws.com/dist.springsource.com/release/STS4/fatjars/spring-boot-language-server-1.2.0-201812201255.jar"
|
||||
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/spring-boot-language-server-1.6.0-201904021915.jar"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user