Cleanup JDK9 LS launch support for Atom extensions
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
const path = require('path');
|
||||
const { JarLanguageClient, StsAdapter } = require('pivotal-atom-languageclient-commons');
|
||||
const { JavaProcessLanguageClient, StsAdapter } = require('pivotal-atom-languageclient-commons');
|
||||
const { Convert } = require('atom-languageclient');
|
||||
const PROPERTIES = require('../properties.json');
|
||||
|
||||
const BOOT_DATA_MARKER_TYPE = 'BootApp-Hint';
|
||||
const BOOT_HINT_GUTTER_NAME = 'boot-hint-gutter';
|
||||
|
||||
class BootJavaLanguageClient extends JarLanguageClient {
|
||||
class BootJavaLanguageClient extends JavaProcessLanguageClient {
|
||||
|
||||
constructor() {
|
||||
//noinspection JSAnnotator
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"pivotal-atom-languageclient-commons": "0.0.14"
|
||||
"pivotal-atom-languageclient-commons": "0.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffeelint": "^1.10.1"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const path = require('path');
|
||||
const { JarLanguageClient } = require('pivotal-atom-languageclient-commons');
|
||||
const { JavaProcessLanguageClient } = require('pivotal-atom-languageclient-commons');
|
||||
const PROPERTIES = require('../properties.json');
|
||||
|
||||
class BoshYamlClient extends JarLanguageClient {
|
||||
class BoshYamlClient extends JavaProcessLanguageClient {
|
||||
|
||||
constructor() {
|
||||
//noinspection JSAnnotator
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"pivotal-atom-languageclient-commons": "0.0.14"
|
||||
"pivotal-atom-languageclient-commons": "0.0.15"
|
||||
},
|
||||
"configSchema": {
|
||||
"bosh": {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const path = require('path');
|
||||
const { JarLanguageClient } = require('pivotal-atom-languageclient-commons');
|
||||
const { JavaProcessLanguageClient } = require('pivotal-atom-languageclient-commons');
|
||||
const PROPERTIES = require('../properties.json');
|
||||
|
||||
class ManifestYamlLanguageClient extends JarLanguageClient {
|
||||
class ManifestYamlLanguageClient extends JavaProcessLanguageClient {
|
||||
|
||||
constructor() {
|
||||
//noinspection JSAnnotator
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"pivotal-atom-languageclient-commons": "0.0.14"
|
||||
"pivotal-atom-languageclient-commons": "0.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffeelint": "^1.10.1"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { JarLanguageClient } from './jar-language-client';
|
||||
import { JavaProcessLanguageClient } from './jave-process-language-client';
|
||||
import { StsAdapter } from './sts-adapter';
|
||||
|
||||
export { JarLanguageClient, StsAdapter };
|
||||
export { JavaProcessLanguageClient, StsAdapter };
|
||||
@@ -11,7 +11,7 @@ const { Disposable } = require('atom');
|
||||
import { StsAdapter } from './sts-adapter';
|
||||
|
||||
|
||||
export class JarLanguageClient extends AutoLanguageClient {
|
||||
export class JavaProcessLanguageClient extends AutoLanguageClient {
|
||||
|
||||
DEBUG = false;
|
||||
|
||||
@@ -88,17 +88,25 @@ export class JarLanguageClient extends AutoLanguageClient {
|
||||
launchProcess(port) {
|
||||
const command = this.findJavaFile('bin', this.correctBinname('java'));
|
||||
|
||||
return this.compatibleJavaVersion(command).then(version => {
|
||||
return this.javaVesrion(command).then(version => {
|
||||
if (version) {
|
||||
return this.launchVmArgs(version).then(args => {
|
||||
if (version >= 9) {
|
||||
args.push('--add-modules=java.se.ee');
|
||||
}
|
||||
args.push(`-Dserver.port=${port}`);
|
||||
return this.getOrInstallLauncher().then(launcher => this.doLaunchProcess(command, launcher, port, args));
|
||||
});
|
||||
} else {
|
||||
this.logger.error('Java executable is not Java 8 or higher');
|
||||
const notification = atom.notifications.addError('Cannot start Language Server', {
|
||||
dismissable: true,
|
||||
detail: 'No compatible Java Runtime Environment found',
|
||||
description: 'The Java Runtime Environment is either below version "1.8" or is missing from the system',
|
||||
buttons: [{
|
||||
text: 'OK',
|
||||
onDidClick: () => {
|
||||
notification.dismiss()
|
||||
},
|
||||
}],
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -209,18 +217,16 @@ export class JarLanguageClient extends AutoLanguageClient {
|
||||
return binname;
|
||||
}
|
||||
|
||||
compatibleJavaVersion(javaExecutablePath) {
|
||||
javaVesrion(javaExecutablePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cp.execFile(javaExecutablePath, ['-version'], {}, (error, stdout, stderr) => {
|
||||
cp.execFile(javaExecutablePath, ['-version'], {}, (error, stdout, stderr) => {
|
||||
if (stderr.indexOf('1.8') >= 0) {
|
||||
resolve(8);
|
||||
} else if (stderr.indexOf('java version "9"') >= 0) {
|
||||
resolve(9);
|
||||
} else {
|
||||
resolve(0);
|
||||
}
|
||||
});
|
||||
if (stderr.indexOf('1.8') >= 0) {
|
||||
resolve(8);
|
||||
} else if (stderr.indexOf('java version "9"') >= 0) {
|
||||
resolve(9);
|
||||
} else {
|
||||
resolve(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pivotal-atom-languageclient-commons",
|
||||
"version": "0.0.14",
|
||||
"version": "0.0.15",
|
||||
"description": "Atom language client commons for STS4 language servers",
|
||||
"repository": "https://github.com/spring-projects/sts4",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const path = require('path');
|
||||
const { JarLanguageClient } = require('pivotal-atom-languageclient-commons');
|
||||
const { JavaProcessLanguageClient } = require('pivotal-atom-languageclient-commons');
|
||||
const PROPERTIES = require('../properties.json');
|
||||
|
||||
class ConcourseCiYamlClient extends JarLanguageClient {
|
||||
class ConcourseCiYamlClient extends JavaProcessLanguageClient {
|
||||
|
||||
constructor() {
|
||||
//noinspection JSAnnotator
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"dependencies": {
|
||||
"atom-package-deps": "^4.6.0",
|
||||
"download": "^6.2.5",
|
||||
"pivotal-atom-languageclient-commons": "0.0.14"
|
||||
"pivotal-atom-languageclient-commons": "0.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffeelint": "^1.10.1"
|
||||
|
||||
Reference in New Issue
Block a user