PT #157703073: Theia commons. Refactor spring-boot and manifest-yaml
This commit is contained in:
@@ -14,8 +14,7 @@
|
||||
"@theia/languages": "latest",
|
||||
"@theia/monaco": "latest",
|
||||
"@pivotal-tools/jvm-launch-utils": "0.0.11",
|
||||
"@types/glob": "^5.0.30",
|
||||
"glob": "^7.1.2"
|
||||
"@pivotal-tools/theia-languageclient": "0.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "latest",
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import { injectable, inject } from 'inversify';
|
||||
import { BaseLanguageClientContribution, Workspace, Languages, LanguageClientFactory } from '@theia/languages/lib/browser';
|
||||
import { inject, injectable } from 'inversify';
|
||||
import { Workspace, Languages, LanguageClientFactory } from '@theia/languages/lib/browser';
|
||||
import { CF_MANIFEST_YAML_LANGUAGE_ID, CF_MANIFEST_YAML_LANGUAGE_NAME } from '../common';
|
||||
import { StsLanguageClientContribution } from '@pivotal-tools/theia-languageclient/lib/browser/language-client-contribution';
|
||||
|
||||
@injectable()
|
||||
export class CfManifestYamlClientContribution extends BaseLanguageClientContribution {
|
||||
export class CfManifestYamlClientContribution extends StsLanguageClientContribution<null> {
|
||||
|
||||
readonly id = CF_MANIFEST_YAML_LANGUAGE_ID;
|
||||
readonly name = CF_MANIFEST_YAML_LANGUAGE_NAME;
|
||||
|
||||
constructor(
|
||||
@inject(Workspace) protected readonly workspace: Workspace,
|
||||
@inject(Languages) protected readonly languages: Languages,
|
||||
@inject(LanguageClientFactory) protected readonly languageClientFactory: LanguageClientFactory,
|
||||
@inject(Workspace) workspace: Workspace,
|
||||
@inject(Languages) languages: Languages,
|
||||
@inject(LanguageClientFactory) languageClientFactory: LanguageClientFactory,
|
||||
) {
|
||||
super(workspace, languages, languageClientFactory);
|
||||
}
|
||||
|
||||
@@ -1,71 +1,20 @@
|
||||
import * as path from 'path';
|
||||
import * as glob from 'glob';
|
||||
import { injectable } from 'inversify';
|
||||
// import { DEBUG_MODE } from '@theia/core/lib/node';
|
||||
import { IConnection, BaseLanguageServerContribution } from '@theia/languages/lib/node';
|
||||
import { CF_MANIFEST_YAML_LANGUAGE_ID, CF_MANIFEST_YAML_LANGUAGE_NAME } from '../common';
|
||||
import { findJvm } from '@pivotal-tools/jvm-launch-utils';
|
||||
|
||||
import { StsLanguageServerContribution } from "@pivotal-tools/theia-languageclient/lib/node/language-server-contribution";
|
||||
|
||||
@injectable()
|
||||
export class CfManifestYamlContribution extends BaseLanguageServerContribution {
|
||||
export class CfManifestYamlContribution extends StsLanguageServerContribution {
|
||||
|
||||
readonly id = CF_MANIFEST_YAML_LANGUAGE_ID;
|
||||
readonly name = CF_MANIFEST_YAML_LANGUAGE_NAME;
|
||||
protected readonly lsJarContainerFolder = path.resolve(__dirname, '../../jars');
|
||||
protected readonly lsJarGlob = 'manifest-yaml-language-server*.jar';
|
||||
protected readonly jvmArguments = [
|
||||
// '-Xdebug',
|
||||
// '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7999',
|
||||
// '-Dlog.level=ALL',
|
||||
'-Dorg.slf4j.simpleLogger.logFile=cf-manifest-yaml.log'
|
||||
];
|
||||
|
||||
start(clientConnection: IConnection): void {
|
||||
const serverPath = path.resolve(__dirname, '../../jars');
|
||||
const jarPaths = glob.sync('manifest-yaml-language-server*.jar', { cwd: serverPath });
|
||||
if (jarPaths.length === 0) {
|
||||
throw new Error('The CF Manifest YAML server launcher is not found.');
|
||||
}
|
||||
|
||||
const jarPath = path.resolve(serverPath, jarPaths[0]);
|
||||
findJvm()
|
||||
.catch(error => {
|
||||
throw new Error('Error trying to find JVM');
|
||||
})
|
||||
.then(jvm => {
|
||||
if (!jvm) {
|
||||
throw new Error("Couldn't locate java in $JAVA_HOME or $PATH");
|
||||
}
|
||||
|
||||
this.startSocketServer().then(server => {
|
||||
const socket = this.accept(server);
|
||||
|
||||
const env = Object.create(process.env);
|
||||
const addressInfo = server.address();
|
||||
if (typeof addressInfo === 'string') {
|
||||
throw new Error(`Address info was string ${addressInfo}`);
|
||||
}
|
||||
env.CLIENT_HOST = addressInfo.address;
|
||||
env.CLIENT_PORT = addressInfo.port;
|
||||
const command = jvm.getJavaExecutable();
|
||||
const args = [
|
||||
'-Dsts.lsp.client=theia',
|
||||
'-Dlsp.completions.indentation.enable=true',
|
||||
'-Dlsp.yaml.completions.errors.disable=true',
|
||||
'-Dorg.slf4j.simpleLogger.logFile=cf-manifest-yaml.log',
|
||||
`-Dserver.port=${env.CLIENT_PORT}`
|
||||
];
|
||||
|
||||
// if (DEBUG_MODE) {
|
||||
args.push(
|
||||
'-Xdebug',
|
||||
'-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7999',
|
||||
'-Dlog.level=ALL'
|
||||
);
|
||||
// }
|
||||
|
||||
args.push(
|
||||
'-jar', jarPath,
|
||||
);
|
||||
|
||||
this.createProcessSocketConnection(socket, socket, command, args, { env })
|
||||
.then(serverConnection => this.forward(clientConnection, serverConnection));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import { injectable, inject } from "inversify";
|
||||
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService } from "@theia/core/lib/common";
|
||||
import { CommonMenus } from "@theia/core/lib/browser";
|
||||
|
||||
export const HelloWorldCommand = {
|
||||
id: 'HelloWorld.command',
|
||||
label: "Shows a message"
|
||||
};
|
||||
|
||||
@injectable()
|
||||
export class HelloWorldCommandContribution implements CommandContribution {
|
||||
|
||||
constructor(
|
||||
@inject(MessageService) private readonly messageService: MessageService,
|
||||
) { }
|
||||
|
||||
registerCommands(registry: CommandRegistry): void {
|
||||
registry.registerCommand(HelloWorldCommand, {
|
||||
execute: () => this.messageService.info('Hello World!')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@injectable()
|
||||
export class HelloWorldMenuContribution implements MenuContribution {
|
||||
|
||||
registerMenus(menus: MenuModelRegistry): void {
|
||||
menus.registerMenuAction(CommonMenus.EDIT_FIND, {
|
||||
commandId: HelloWorldCommand.id,
|
||||
label: 'Say Hello'
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Generated using theia-extension-generator
|
||||
*/
|
||||
|
||||
import { HelloWorldCommandContribution, HelloWorldMenuContribution } from './hello-world-contribution';
|
||||
import {
|
||||
CommandContribution,
|
||||
MenuContribution
|
||||
} from "@theia/core/lib/common";
|
||||
|
||||
import { ContainerModule } from "inversify";
|
||||
|
||||
export default new ContainerModule(bind => {
|
||||
// add your contribution bindings here
|
||||
|
||||
bind(CommandContribution).to(HelloWorldCommandContribution);
|
||||
bind(MenuContribution).to(HelloWorldMenuContribution);
|
||||
|
||||
});
|
||||
@@ -102,6 +102,17 @@
|
||||
version "0.0.11"
|
||||
resolved "https://registry.yarnpkg.com/@pivotal-tools/jvm-launch-utils/-/jvm-launch-utils-0.0.11.tgz#11e8cc4850aa16a91c7579a8e3ed2a071acc36ba"
|
||||
|
||||
"@pivotal-tools/theia-languageclient@0.0.1":
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@pivotal-tools/theia-languageclient/-/theia-languageclient-0.0.1.tgz#5cbc35776657aa705adc3fb126c07e4f712f4c74"
|
||||
dependencies:
|
||||
"@pivotal-tools/jvm-launch-utils" "0.0.11"
|
||||
"@theia/core" latest
|
||||
"@theia/editor" latest
|
||||
"@theia/languages" latest
|
||||
"@types/glob" "^5.0.30"
|
||||
glob "^7.1.2"
|
||||
|
||||
"@sindresorhus/df@^1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/df/-/df-1.0.1.tgz#c69b66f52f6fcdd287c807df210305dbaf78500d"
|
||||
@@ -436,8 +447,8 @@
|
||||
"@types/lodash" "*"
|
||||
|
||||
"@types/lodash@*":
|
||||
version "4.14.108"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.108.tgz#02656af3add2e5b3174f830862c47421c00ef817"
|
||||
version "4.14.109"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.109.tgz#b1c4442239730bf35cabaf493c772b18c045886d"
|
||||
|
||||
"@types/mime@*":
|
||||
version "2.0.0"
|
||||
@@ -448,12 +459,12 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
|
||||
|
||||
"@types/node@*":
|
||||
version "10.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.1.1.tgz#ca39d8607fa1fcb146b0530420b93f1dd4802f6c"
|
||||
version "10.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.1.2.tgz#1b928a0baa408fc8ae3ac012cc81375addc147c6"
|
||||
|
||||
"@types/node@^8.0.24":
|
||||
version "8.10.16"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.16.tgz#96fadb371748845a0c8ea970a565330efb0a67d5"
|
||||
version "8.10.17"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.17.tgz#d48cf10f0dc6dcf59f827f5a3fc7a4a6004318d3"
|
||||
|
||||
"@types/request@^2.0.3":
|
||||
version "2.47.0"
|
||||
@@ -622,8 +633,8 @@
|
||||
long "^3.2.0"
|
||||
|
||||
JSONStream@^1.0.4:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.2.tgz#c102371b6ec3a7cf3b847ca00c20bb0fce4c6dea"
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.3.tgz#27b4b8fbbfeab4e71bcf551e7f27be8d952239bf"
|
||||
dependencies:
|
||||
jsonparse "^1.2.0"
|
||||
through ">=2.2.7 <3"
|
||||
@@ -881,10 +892,10 @@ async@^1.4.0, async@^1.5.0:
|
||||
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
|
||||
|
||||
async@^2.5.0, async@^2.6.0:
|
||||
version "2.6.0"
|
||||
resolved "https://registry.yarnpkg.com/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4"
|
||||
version "2.6.1"
|
||||
resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610"
|
||||
dependencies:
|
||||
lodash "^4.14.0"
|
||||
lodash "^4.17.10"
|
||||
|
||||
asynckit@^0.4.0:
|
||||
version "0.4.0"
|
||||
@@ -1601,18 +1612,6 @@ boom@2.x.x:
|
||||
dependencies:
|
||||
hoek "2.x.x"
|
||||
|
||||
boom@4.x.x:
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31"
|
||||
dependencies:
|
||||
hoek "4.x.x"
|
||||
|
||||
boom@5.x.x:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02"
|
||||
dependencies:
|
||||
hoek "4.x.x"
|
||||
|
||||
boxen@^1.2.1:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b"
|
||||
@@ -1848,8 +1847,8 @@ caniuse-api@^1.5.2:
|
||||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
|
||||
version "1.0.30000842"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000842.tgz#8a82c377b8b3d6f2594478e8431ff4fd303e160c"
|
||||
version "1.0.30000844"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000844.tgz#bca5798cda2b6931d68100c2d69e55fb338cbb41"
|
||||
|
||||
capture-stack-trace@^1.0.0:
|
||||
version "1.0.0"
|
||||
@@ -2125,8 +2124,8 @@ colors@1.0.3:
|
||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b"
|
||||
|
||||
colors@^1.1.2:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc"
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.0.tgz#5f20c9fef6945cb1134260aab33bfbdc8295e04e"
|
||||
|
||||
colors@~1.1.2:
|
||||
version "1.1.2"
|
||||
@@ -2493,12 +2492,6 @@ cryptiles@2.x.x:
|
||||
dependencies:
|
||||
boom "2.x.x"
|
||||
|
||||
cryptiles@3.x.x:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe"
|
||||
dependencies:
|
||||
boom "5.x.x"
|
||||
|
||||
crypto-browserify@^3.11.0:
|
||||
version "3.12.0"
|
||||
resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
|
||||
@@ -2889,8 +2882,8 @@ electron-rebuild@^1.5.11:
|
||||
yargs "^7.0.2"
|
||||
|
||||
electron-to-chromium@^1.2.7:
|
||||
version "1.3.47"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.47.tgz#764e887ca9104d01a0ac8eabee7dfc0e2ce14104"
|
||||
version "1.3.48"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz#d3b0d8593814044e092ece2108fc3ac9aea4b900"
|
||||
|
||||
electron@1.8.2-beta.5:
|
||||
version "1.8.2-beta.5"
|
||||
@@ -3869,15 +3862,6 @@ hawk@~3.1.3:
|
||||
hoek "2.x.x"
|
||||
sntp "1.x.x"
|
||||
|
||||
hawk@~6.0.2:
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038"
|
||||
dependencies:
|
||||
boom "4.x.x"
|
||||
cryptiles "3.x.x"
|
||||
hoek "4.x.x"
|
||||
sntp "2.x.x"
|
||||
|
||||
hmac-drbg@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
|
||||
@@ -3890,10 +3874,6 @@ hoek@2.x.x:
|
||||
version "2.16.3"
|
||||
resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"
|
||||
|
||||
hoek@4.x.x:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb"
|
||||
|
||||
home-or-tmp@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
|
||||
@@ -4891,7 +4871,7 @@ lodash.uniq@^4.5.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
|
||||
|
||||
lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.10, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0:
|
||||
lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0:
|
||||
version "4.17.10"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
|
||||
|
||||
@@ -4950,10 +4930,6 @@ lru-cache@^4.0.0, lru-cache@^4.0.1, lru-cache@^4.1.1:
|
||||
pseudomap "^1.0.2"
|
||||
yallist "^2.1.2"
|
||||
|
||||
macaddress@^0.2.8:
|
||||
version "0.2.8"
|
||||
resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12"
|
||||
|
||||
make-dir@^1.0.0, make-dir@^1.1.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c"
|
||||
@@ -5186,10 +5162,10 @@ minimist@~0.0.1:
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
|
||||
|
||||
minipass@^2.2.1, minipass@^2.2.4:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.0.tgz#2e11b1c46df7fe7f1afbe9a490280add21ffe384"
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.3.tgz#a7dcc8b7b833f5d368759cce544dccb55f50f233"
|
||||
dependencies:
|
||||
safe-buffer "^5.1.1"
|
||||
safe-buffer "^5.1.2"
|
||||
yallist "^3.0.0"
|
||||
|
||||
minizlib@^1.1.0:
|
||||
@@ -6027,11 +6003,10 @@ postcss-discard-unused@^2.2.1:
|
||||
uniqs "^2.0.0"
|
||||
|
||||
postcss-filter-plugins@^2.0.0:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/postcss-filter-plugins/-/postcss-filter-plugins-2.0.2.tgz#6d85862534d735ac420e4a85806e1f5d4286d84c"
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/postcss-filter-plugins/-/postcss-filter-plugins-2.0.3.tgz#82245fdf82337041645e477114d8e593aa18b8ec"
|
||||
dependencies:
|
||||
postcss "^5.0.4"
|
||||
uniqid "^4.0.0"
|
||||
|
||||
postcss-merge-idents@^2.1.5:
|
||||
version "2.1.7"
|
||||
@@ -6695,8 +6670,8 @@ replace-ext@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
|
||||
|
||||
request@2, request@^2.45.0, request@^2.82.0:
|
||||
version "2.86.0"
|
||||
resolved "https://registry.yarnpkg.com/request/-/request-2.86.0.tgz#2b9497f449b0a32654c081a5cf426bbfb5bf5b69"
|
||||
version "2.87.0"
|
||||
resolved "https://registry.yarnpkg.com/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e"
|
||||
dependencies:
|
||||
aws-sign2 "~0.7.0"
|
||||
aws4 "^1.6.0"
|
||||
@@ -6706,7 +6681,6 @@ request@2, request@^2.45.0, request@^2.82.0:
|
||||
forever-agent "~0.6.1"
|
||||
form-data "~2.3.1"
|
||||
har-validator "~5.0.3"
|
||||
hawk "~6.0.2"
|
||||
http-signature "~1.2.0"
|
||||
is-typedarray "~1.0.0"
|
||||
isstream "~0.1.2"
|
||||
@@ -6874,8 +6848,8 @@ rxjs@5.4.3:
|
||||
symbol-observable "^1.0.1"
|
||||
|
||||
rxjs@^5.0.0-beta.11, rxjs@^5.1.1, rxjs@^5.4.2, rxjs@^5.5.2:
|
||||
version "5.5.10"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.10.tgz#fde02d7a614f6c8683d0d1957827f492e09db045"
|
||||
version "5.5.11"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.11.tgz#f733027ca43e3bec6b994473be4ab98ad43ced87"
|
||||
dependencies:
|
||||
symbol-observable "1.0.1"
|
||||
|
||||
@@ -7079,12 +7053,6 @@ sntp@1.x.x:
|
||||
dependencies:
|
||||
hoek "2.x.x"
|
||||
|
||||
sntp@2.x.x:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8"
|
||||
dependencies:
|
||||
hoek "4.x.x"
|
||||
|
||||
sort-keys@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad"
|
||||
@@ -7728,12 +7696,6 @@ uniq@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"
|
||||
|
||||
uniqid@^4.0.0:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/uniqid/-/uniqid-4.1.1.tgz#89220ddf6b751ae52b5f72484863528596bb84c1"
|
||||
dependencies:
|
||||
macaddress "^0.2.8"
|
||||
|
||||
uniqs@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/uniqs/-/uniqs-2.0.0.tgz#ffede4b36b25290696e6e165d4a59edb998e6b02"
|
||||
@@ -7772,8 +7734,8 @@ unset-value@^1.0.0:
|
||||
isobject "^3.0.0"
|
||||
|
||||
untildify@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.2.tgz#7f1f302055b3fea0f3e81dc78eb36766cb65e3f1"
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9"
|
||||
|
||||
unzip-response@^2.0.1:
|
||||
version "2.0.1"
|
||||
@@ -8223,8 +8185,8 @@ xtend@~2.1.1:
|
||||
object-keys "~0.4.0"
|
||||
|
||||
xterm@^3.0.1:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.3.0.tgz#b09a19fc2cd5decd21112e5c9dab0b61991f6cf3"
|
||||
version "3.4.1"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.4.1.tgz#12452979ea2db3371f8195832d7407abba988980"
|
||||
|
||||
y18n@^3.2.1:
|
||||
version "3.2.1"
|
||||
|
||||
5
theia-extensions/theia-commons/.gitignore
vendored
Normal file
5
theia-extensions/theia-commons/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
.browser_modules
|
||||
lib
|
||||
*.log
|
||||
|
||||
37
theia-extensions/theia-commons/package.json
Normal file
37
theia-extensions/theia-commons/package.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "@pivotal-tools/theia-languageclient",
|
||||
"version": "0.0.1",
|
||||
"description": "Theia IDE language client for STS4 language servers",
|
||||
"repository": "https://github.com/spring-projects/sts4",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"theia-extension"
|
||||
],
|
||||
"files": [
|
||||
"lib",
|
||||
"src"
|
||||
],
|
||||
"dependencies": {
|
||||
"@pivotal-tools/jvm-launch-utils": "0.0.11",
|
||||
"@theia/core": "latest",
|
||||
"@theia/editor": "latest",
|
||||
"@theia/languages": "latest",
|
||||
"@types/glob": "^5.0.30",
|
||||
"glob": "^7.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "latest",
|
||||
"typescript": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "yarn run clean && yarn run build",
|
||||
"clean": "rimraf lib",
|
||||
"build": "tsc",
|
||||
"watch": "tsc -w"
|
||||
},
|
||||
"theiaExtensions": [
|
||||
{
|
||||
"frontend": "lib/browser/language-client-frontend-module"
|
||||
}
|
||||
]
|
||||
}
|
||||
20
theia-extensions/theia-commons/src/browser/ide-helper.ts
Normal file
20
theia-extensions/theia-commons/src/browser/ide-helper.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import {EditorManager, TextEditor} from '@theia/editor/lib/browser';
|
||||
import {DiffUris} from '@theia/core/lib/browser';
|
||||
import URI from '@theia/core/lib/common/uri';
|
||||
|
||||
export class IdeHelper {
|
||||
|
||||
static async findEditorByUri(editorManager: EditorManager, uri: string): Promise<TextEditor | undefined> {
|
||||
const editorWidget = await editorManager.getByUri(new URI(uri));
|
||||
if (editorWidget) {
|
||||
const editorUri = editorWidget.editor.uri;
|
||||
const openedInEditor = editorUri.toString() === uri;
|
||||
const openedInDiffEditor = DiffUris.isDiffUri(editorUri) && DiffUris.decode(editorUri).some(u => u.toString() === uri);
|
||||
if (openedInEditor || openedInDiffEditor) {
|
||||
return editorWidget.editor;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { injectable, inject, postConstruct } from 'inversify';
|
||||
import { NotificationType } from 'vscode-jsonrpc';
|
||||
import { DidChangeConfigurationParams } from 'vscode-base-languageclient/lib/base';
|
||||
import { BaseLanguageClientContribution, Workspace, Languages, LanguageClientFactory } from '@theia/languages/lib/browser';
|
||||
import { PreferenceProxy } from '@theia/core/lib/browser';
|
||||
import { ProgressService } from './progress-service';
|
||||
import { MoveCursorService } from './move-cursor-service';
|
||||
import { Utils } from '../common/utils';
|
||||
|
||||
const CONFIG_CHANGED_NOTIFICATION_TYPE = new NotificationType<DidChangeConfigurationParams,void>('workspace/didChangeConfiguration');
|
||||
|
||||
@injectable()
|
||||
export abstract class StsLanguageClientContribution<P> extends BaseLanguageClientContribution {
|
||||
|
||||
protected readonly preferences: PreferenceProxy<P> | undefined;
|
||||
|
||||
@inject(ProgressService) protected readonly progressService: ProgressService;
|
||||
@inject(MoveCursorService) protected readonly moveCursorService: MoveCursorService;
|
||||
|
||||
constructor(workspace: Workspace, languages: Languages, languageClientFactory: LanguageClientFactory) {
|
||||
super(workspace, languages, languageClientFactory);
|
||||
}
|
||||
|
||||
@postConstruct()
|
||||
protected async init() {
|
||||
if (this.preferences) {
|
||||
await this.preferences.ready;
|
||||
|
||||
// Send settings to LS
|
||||
this.sendConfig();
|
||||
this.preferences.onPreferenceChanged(() => this.sendConfig());
|
||||
}
|
||||
this.attachMessageHandlers();
|
||||
}
|
||||
|
||||
protected attachMessageHandlers() {
|
||||
this.languageClient.then(client => {
|
||||
this.progressService.attach(client);
|
||||
this.moveCursorService.attach(client);
|
||||
});
|
||||
}
|
||||
|
||||
private sendConfig() {
|
||||
return this.languageClient.then(client => {
|
||||
const params = Utils.convertDotToNested(Object.assign({}, this.preferences));
|
||||
return client.sendNotification(CONFIG_CHANGED_NOTIFICATION_TYPE, {
|
||||
settings: params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ContainerModule } from 'inversify';
|
||||
import { ClasspathService } from './classpath-service';
|
||||
import { ProgressService } from './progress-service';
|
||||
import { MoveCursorService } from './move-cursor-service';
|
||||
|
||||
export default new ContainerModule(bind => {
|
||||
// add your contribution bindings here
|
||||
bind(ClasspathService).toSelf().inSingletonScope();
|
||||
bind(ProgressService).toSelf().inSingletonScope();
|
||||
bind(MoveCursorService).toSelf().inSingletonScope();
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
import { injectable, inject } from 'inversify';
|
||||
import { RequestType } from 'vscode-jsonrpc';
|
||||
import { Position } from 'vscode-base-languageclient/lib/base';
|
||||
import { CommandRegistry } from '@theia/core/lib/common';
|
||||
import { ILanguageClient } from '@theia/languages/lib/common';
|
||||
import {IdeHelper} from './ide-helper';
|
||||
import {EditorManager} from '@theia/editor/lib/browser';
|
||||
|
||||
export const MOVE_CURSOR_REQUEST_TYPE = new RequestType<CursorMovementParams, {}, void, void>('sts/moveCursorr');
|
||||
|
||||
@injectable()
|
||||
export class MoveCursorService {
|
||||
|
||||
constructor(
|
||||
@inject(CommandRegistry) protected readonly commands: CommandRegistry,
|
||||
@inject(EditorManager) private readonly editorManager: EditorManager
|
||||
) {}
|
||||
|
||||
attach(client: ILanguageClient) {
|
||||
client.onRequest(MOVE_CURSOR_REQUEST_TYPE, params => this.moveCursor(params));
|
||||
}
|
||||
|
||||
private async moveCursor(params: CursorMovementParams) {
|
||||
const editor = await IdeHelper.findEditorByUri(this.editorManager, params.uri);
|
||||
if (editor) {
|
||||
editor.cursor = Position.create(params.position.line, params.position.character);
|
||||
}
|
||||
return { applied: true };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface CursorMovementParams {
|
||||
readonly uri: string;
|
||||
readonly position: Position;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { injectable, inject } from 'inversify';
|
||||
import { NotificationType } from 'vscode-jsonrpc';
|
||||
import { CommandRegistry } from '@theia/core/lib/common';
|
||||
import { ILanguageClient } from '@theia/languages/lib/common';
|
||||
|
||||
const PROGRESS_NOTIFICATION_TYPE = new NotificationType<ProgressParams,void>('sts/progress');
|
||||
|
||||
@injectable()
|
||||
export class ProgressService {
|
||||
|
||||
constructor(
|
||||
@inject(CommandRegistry) protected readonly commands: CommandRegistry
|
||||
) {}
|
||||
|
||||
attach(client: ILanguageClient) {
|
||||
client.onNotification(PROGRESS_NOTIFICATION_TYPE, params => this.progress(params));
|
||||
}
|
||||
|
||||
private async progress(params: ProgressParams) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface ProgressParams {
|
||||
readonly id: string;
|
||||
readonly statusMsg: string;
|
||||
}
|
||||
@@ -24,4 +24,5 @@ export class Utils {
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import * as path from 'path';
|
||||
import * as glob from 'glob';
|
||||
import { injectable } from 'inversify';
|
||||
import { DEBUG_MODE } from '@theia/core/lib/node';
|
||||
import { IConnection, BaseLanguageServerContribution } from '@theia/languages/lib/node';
|
||||
import {findJdk, findJvm, JVM} from '@pivotal-tools/jvm-launch-utils';
|
||||
|
||||
|
||||
@injectable()
|
||||
export abstract class StsLanguageServerContribution extends BaseLanguageServerContribution {
|
||||
|
||||
protected readonly preferJdk = false;
|
||||
|
||||
protected readonly lsJarContainerFolder = path.resolve(__dirname, '../../jars');
|
||||
|
||||
protected readonly lsJarGlob = 'language-server*.jar';
|
||||
|
||||
protected readonly jvmArguments = [];
|
||||
|
||||
protected getJarPath() {
|
||||
const jarPaths = glob.sync(this.lsJarGlob, { cwd: this.lsJarContainerFolder });
|
||||
if (jarPaths.length === 0) {
|
||||
throw new Error(`The ${this.name} server launcher is not found`);
|
||||
}
|
||||
return path.resolve(this.lsJarContainerFolder, jarPaths[0]);
|
||||
}
|
||||
|
||||
protected findJvm() {
|
||||
return this.preferJdk ? findJdk() : findJvm();
|
||||
}
|
||||
|
||||
protected validate(jvm: JVM) {
|
||||
if (!jvm) {
|
||||
throw new Error("Couldn't locate java in $JAVA_HOME or $PATH");
|
||||
}
|
||||
let version = jvm.getMajorVersion();
|
||||
if (version<8) {
|
||||
throw new Error(
|
||||
'No compatible Java Runtime Environment found. The Java Runtime Environment is either below version "1.8" or is missing from the system'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
start(clientConnection: IConnection): void {
|
||||
const jarPath = this.getJarPath();
|
||||
this.findJvm()
|
||||
.catch(error => {
|
||||
throw new Error('Error trying to find JVM');
|
||||
})
|
||||
.then(jvm => {
|
||||
this.validate(jvm);
|
||||
this.startSocketServer().then(server => {
|
||||
const socket = this.accept(server);
|
||||
|
||||
const env = Object.create(process.env);
|
||||
const addressInfo = server.address();
|
||||
if (typeof addressInfo === 'string') {
|
||||
throw new Error(`Address info was string ${addressInfo}`);
|
||||
}
|
||||
env.CLIENT_HOST = addressInfo.address;
|
||||
env.CLIENT_PORT = addressInfo.port;
|
||||
|
||||
const command = jvm.getJavaExecutable();
|
||||
const args = [
|
||||
'-Dsts.lsp.client=theia',
|
||||
'-Dlsp.completions.indentation.enable=true',
|
||||
'-Dlsp.yaml.completions.errors.disable=true',
|
||||
`-Dserver.port=${env.CLIENT_PORT}`
|
||||
];
|
||||
|
||||
args.push(...this.jvmArguments);
|
||||
|
||||
if (DEBUG_MODE) {
|
||||
args.push(
|
||||
'-Xdebug',
|
||||
'-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7999',
|
||||
'-Dlog.level=ALL'
|
||||
);
|
||||
}
|
||||
|
||||
args.push(
|
||||
'-jar', jarPath,
|
||||
);
|
||||
|
||||
this.createProcessSocketConnection(socket, socket, command, args, { env })
|
||||
.then(serverConnection => this.forward(clientConnection, serverConnection));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
23
theia-extensions/theia-commons/tsconfig.json
Normal file
23
theia-extensions/theia-commons/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": false,
|
||||
"declaration": true,
|
||||
"experimentalDecorators": true,
|
||||
"noUnusedLocals": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"downlevelIteration": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
2030
theia-extensions/theia-commons/yarn.lock
Normal file
2030
theia-extensions/theia-commons/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -17,9 +17,8 @@
|
||||
"@theia/editor": "latest",
|
||||
"@theia/monaco": "latest",
|
||||
"@theia/java": "latest",
|
||||
"@pivotal-tools/jvm-launch-utils": "0.0.11",
|
||||
"@types/glob": "^5.0.30",
|
||||
"glob": "^7.1.2"
|
||||
"@pivotal-tools/theia-languageclient": "0.0.1",
|
||||
"@pivotal-tools/jvm-launch-utils": "0.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "latest",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { injectable, inject, postConstruct } from 'inversify';
|
||||
import { BaseLanguageClientContribution, Workspace, Languages, LanguageClientFactory } from '@theia/languages/lib/browser';
|
||||
import { injectable, inject } from 'inversify';
|
||||
import { Workspace, Languages, LanguageClientFactory } from '@theia/languages/lib/browser';
|
||||
import {
|
||||
SPRING_BOOT_SERVER_ID,
|
||||
SPRING_BOOT_SERVER_NAME,
|
||||
@@ -9,25 +9,21 @@ import {
|
||||
import { DocumentSelector } from '@theia/languages/lib/common';
|
||||
import { JAVA_LANGUAGE_ID } from '@theia/java/lib/common';
|
||||
import { HighlightService} from './highlight-service';
|
||||
import { ClasspathService } from './classpath-service';
|
||||
import { BootPreferences } from './boot-preferences';
|
||||
import { NotificationType } from 'vscode-jsonrpc';
|
||||
import { DidChangeConfigurationParams } from 'vscode-base-languageclient/lib/base';
|
||||
import { Utils } from './utils';
|
||||
|
||||
const CONFIG_CHANGED_NOTIFICATION_TYPE = new NotificationType<DidChangeConfigurationParams,void>('workspace/didChangeConfiguration');
|
||||
import { BootConfiguration, BootPreferences } from './boot-preferences';
|
||||
import { StsLanguageClientContribution } from "@pivotal-tools/theia-languageclient/lib/browser/language-client-contribution";
|
||||
import { ClasspathService } from '@pivotal-tools/theia-languageclient/lib/browser/classpath-service';
|
||||
|
||||
|
||||
@injectable()
|
||||
export class SpringBootClientContribution extends BaseLanguageClientContribution {
|
||||
export class SpringBootClientContribution extends StsLanguageClientContribution<BootConfiguration> {
|
||||
|
||||
readonly id = SPRING_BOOT_SERVER_ID;
|
||||
readonly name = SPRING_BOOT_SERVER_NAME;
|
||||
|
||||
constructor(
|
||||
@inject(Workspace) protected readonly workspace: Workspace,
|
||||
@inject(Languages) protected readonly languages: Languages,
|
||||
@inject(LanguageClientFactory) protected readonly languageClientFactory: LanguageClientFactory,
|
||||
@inject(Workspace) workspace: Workspace,
|
||||
@inject(Languages) languages: Languages,
|
||||
@inject(LanguageClientFactory) languageClientFactory: LanguageClientFactory,
|
||||
@inject(HighlightService) protected readonly highlightService: HighlightService,
|
||||
@inject(ClasspathService) protected readonly classpathService: ClasspathService,
|
||||
@inject(BootPreferences) protected readonly preferences: BootPreferences
|
||||
@@ -35,29 +31,14 @@ export class SpringBootClientContribution extends BaseLanguageClientContribution
|
||||
super(workspace, languages, languageClientFactory);
|
||||
}
|
||||
|
||||
@postConstruct()
|
||||
protected async init() {
|
||||
await this.preferences.ready;
|
||||
|
||||
// Send settings to LS
|
||||
this.sendConfig();
|
||||
this.preferences.onPreferenceChanged(() => this.sendConfig());
|
||||
|
||||
protected attachMessageHandlers() {
|
||||
super.attachMessageHandlers();
|
||||
this.languageClient.then(client => {
|
||||
this.highlightService.attach(client);
|
||||
// this.classpathService.attach(client);
|
||||
});
|
||||
}
|
||||
|
||||
private sendConfig() {
|
||||
return this.languageClient.then(client => {
|
||||
const params = Utils.convertDotToNested(Object.assign({}, this.preferences));
|
||||
return client.sendNotification(CONFIG_CHANGED_NOTIFICATION_TYPE, {
|
||||
settings: params
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
protected get documentSelector(): DocumentSelector | undefined {
|
||||
return [JAVA_LANGUAGE_ID, BOOT_PROPERTIES_YAML_LANGUAGE_ID, BOOT_PROPERTIES_LANGUAGE_ID];
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ContainerModule } from 'inversify';
|
||||
import './monaco-yaml-contribution';
|
||||
import './monaco-properties-contribution';
|
||||
import { HighlightService } from './highlight-service';
|
||||
import { ClasspathService } from './classpath-service';
|
||||
import { bindBootPreferences } from './boot-preferences';
|
||||
|
||||
export default new ContainerModule(bind => {
|
||||
@@ -13,5 +12,4 @@ export default new ContainerModule(bind => {
|
||||
bindBootPreferences(bind);
|
||||
bind(LanguageClientContribution).to(SpringBootClientContribution).inSingletonScope();
|
||||
bind(HighlightService).toSelf().inSingletonScope();
|
||||
bind(ClasspathService).toSelf().inSingletonScope();
|
||||
});
|
||||
@@ -1,87 +1,31 @@
|
||||
import * as path from 'path';
|
||||
import * as glob from 'glob';
|
||||
import { injectable } from 'inversify';
|
||||
// import { DEBUG_MODE } from '@theia/core/lib/node';
|
||||
import { IConnection, BaseLanguageServerContribution } from '@theia/languages/lib/node';
|
||||
import { SPRING_BOOT_SERVER_ID, SPRING_BOOT_SERVER_NAME } from '../common';
|
||||
import { findJdk } from '@pivotal-tools/jvm-launch-utils';
|
||||
|
||||
import { JVM } from '@pivotal-tools/jvm-launch-utils';
|
||||
import { StsLanguageServerContribution } from '@pivotal-tools/theia-languageclient/lib/node/language-server-contribution';
|
||||
|
||||
@injectable()
|
||||
export class SpringBootLsContribution extends BaseLanguageServerContribution {
|
||||
export class SpringBootLsContribution extends StsLanguageServerContribution {
|
||||
|
||||
readonly id = SPRING_BOOT_SERVER_ID;
|
||||
readonly name = SPRING_BOOT_SERVER_NAME;
|
||||
protected readonly lsJarContainerFolder = path.resolve(__dirname, '../../jars');
|
||||
protected readonly lsJarGlob = 'spring-boot-language-server*.jar';
|
||||
protected readonly jvmArguments = [
|
||||
// '-Xdebug',
|
||||
// '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7999',
|
||||
// '-Dlog.level=ALL',
|
||||
'-Dorg.slf4j.simpleLogger.logFile=boot-java.log'
|
||||
];
|
||||
|
||||
start(clientConnection: IConnection): void {
|
||||
const serverPath = path.resolve(__dirname, '../../jars');
|
||||
const jarPaths = glob.sync('spring-boot-language-server*.jar', { cwd: serverPath });
|
||||
if (jarPaths.length === 0) {
|
||||
throw new Error('The Spring Boot server launcher is not found.');
|
||||
validate(jvm: JVM) {
|
||||
if (!jvm.isJdk()) {
|
||||
// TODO: show message that functionality is limited for non-JDK
|
||||
// this.showErrorMessage(
|
||||
// '"Boot-Java" Package Functionality Limited',
|
||||
// 'JAVA_HOME or PATH environment variable seems to point to a JRE. A JDK is required, hence Boot Hints are unavailable.'
|
||||
// );
|
||||
}
|
||||
|
||||
const jarPath = path.resolve(serverPath, jarPaths[0]);
|
||||
findJdk()
|
||||
.catch(error => {
|
||||
throw new Error('Error trying to find JVM');
|
||||
})
|
||||
.then(jvm => {
|
||||
if (!jvm) {
|
||||
throw new Error("Couldn't locate java in $JAVA_HOME or $PATH");
|
||||
}
|
||||
let version = jvm.getMajorVersion();
|
||||
if (version<1) {
|
||||
throw new Error(
|
||||
'No compatible Java Runtime Environment found. The Java Runtime Environment is either below version "1.8" or is missing from the system'
|
||||
);
|
||||
}
|
||||
|
||||
if (!jvm.isJdk()) {
|
||||
// TODO: show message that functionality is limited for non-JDK
|
||||
// this.showErrorMessage(
|
||||
// '"Boot-Java" Package Functionality Limited',
|
||||
// 'JAVA_HOME or PATH environment variable seems to point to a JRE. A JDK is required, hence Boot Hints are unavailable.'
|
||||
// );
|
||||
}
|
||||
|
||||
this.startSocketServer().then(server => {
|
||||
const socket = this.accept(server);
|
||||
|
||||
// this.logInfo('logs at ' + path.resolve(workspacePath, '.metadata', '.log'));
|
||||
const env = Object.create(process.env);
|
||||
const addressInfo = server.address();
|
||||
if (typeof addressInfo === 'string') {
|
||||
throw new Error(`Address info was string ${addressInfo}`);
|
||||
}
|
||||
env.CLIENT_HOST = addressInfo.address;
|
||||
env.CLIENT_PORT = addressInfo.port;
|
||||
const command = jvm.getJavaExecutable();
|
||||
const args = [
|
||||
'-Dsts.lsp.client=theia',
|
||||
'-Dlsp.completions.indentation.enable=true',
|
||||
'-Dlsp.yaml.completions.errors.disable=true',
|
||||
'-Dorg.slf4j.simpleLogger.logFile=boot-java.log'
|
||||
];
|
||||
|
||||
args.push(`-Dserver.port=${env.CLIENT_PORT}`);
|
||||
|
||||
// if (DEBUG_MODE) {
|
||||
args.push(
|
||||
'-Xdebug',
|
||||
'-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7999',
|
||||
'-Dlog.level=ALL'
|
||||
);
|
||||
// }
|
||||
|
||||
args.push(
|
||||
'-jar', jarPath,
|
||||
);
|
||||
|
||||
this.createProcessSocketConnection(socket, socket, command, args, { env })
|
||||
.then(serverConnection => this.forward(clientConnection, serverConnection));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"strict": false,
|
||||
"experimentalDecorators": true,
|
||||
"noUnusedLocals": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
|
||||
@@ -102,6 +102,17 @@
|
||||
version "0.0.11"
|
||||
resolved "https://registry.yarnpkg.com/@pivotal-tools/jvm-launch-utils/-/jvm-launch-utils-0.0.11.tgz#11e8cc4850aa16a91c7579a8e3ed2a071acc36ba"
|
||||
|
||||
"@pivotal-tools/theia-languageclient@0.0.1":
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@pivotal-tools/theia-languageclient/-/theia-languageclient-0.0.1.tgz#5cbc35776657aa705adc3fb126c07e4f712f4c74"
|
||||
dependencies:
|
||||
"@pivotal-tools/jvm-launch-utils" "0.0.11"
|
||||
"@theia/core" latest
|
||||
"@theia/editor" latest
|
||||
"@theia/languages" latest
|
||||
"@types/glob" "^5.0.30"
|
||||
glob "^7.1.2"
|
||||
|
||||
"@sindresorhus/df@^1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/df/-/df-1.0.1.tgz#c69b66f52f6fcdd287c807df210305dbaf78500d"
|
||||
|
||||
Reference in New Issue
Block a user