diff --git a/packages/java/download/jdt-language-server-latest.tar.gz b/packages/java/download/jdt-language-server-latest.tar.gz index 9055419b15494..ae90534e30dc8 100644 Binary files a/packages/java/download/jdt-language-server-latest.tar.gz and b/packages/java/download/jdt-language-server-latest.tar.gz differ diff --git a/packages/java/src/browser/java-client-contribution.ts b/packages/java/src/browser/java-client-contribution.ts index 6808ec44eda25..61176ad5a54e3 100644 --- a/packages/java/src/browser/java-client-contribution.ts +++ b/packages/java/src/browser/java-client-contribution.ts @@ -8,7 +8,7 @@ import { injectable, inject } from "inversify"; import { CommandService } from "@theia/core/lib/common"; import { - Window, ILanguageClient, BaseLanguageClientContribution, Workspace, Languages, LanguageClientFactory + Window, ILanguageClient, BaseLanguageClientContribution, Workspace, Languages, LanguageClientFactory } from '@theia/languages/lib/browser'; import { JAVA_LANGUAGE_ID, JAVA_LANGUAGE_NAME } from '../common'; import { ActionableNotification, ActionableMessage } from "./java-protocol"; @@ -16,36 +16,36 @@ import { ActionableNotification, ActionableMessage } from "./java-protocol"; @injectable() export class JavaClientContribution extends BaseLanguageClientContribution { - readonly id = JAVA_LANGUAGE_ID; - readonly name = JAVA_LANGUAGE_NAME; - - constructor( - @inject(Workspace) protected readonly workspace: Workspace, - @inject(Languages) protected readonly languages: Languages, - @inject(LanguageClientFactory) protected readonly languageClientFactory: LanguageClientFactory, - @inject(Window) protected readonly window: Window, - @inject(CommandService) protected readonly commandService: CommandService - ) { - super(workspace, languages, languageClientFactory); - } - - protected get globPatterns() { - return ['**/*.java', '**/pom.xml', '**/*.gradle']; - } - - protected onReady(languageClient: ILanguageClient): void { - languageClient.onNotification(ActionableNotification.type, this.showActionableMessage.bind(this)); - super.onReady(languageClient); - } - - protected showActionableMessage(message: ActionableMessage): void { - const items = message.commands || []; - this.window.showMessage(message.severity, message.message, ...items).then(command => { - if (command) { - const args = command.arguments || []; - this.commandService.executeCommand(command.command, ...args); - } - }); - } + readonly id = JAVA_LANGUAGE_ID; + readonly name = JAVA_LANGUAGE_NAME; + + constructor( + @inject(Workspace) protected readonly workspace: Workspace, + @inject(Languages) protected readonly languages: Languages, + @inject(LanguageClientFactory) protected readonly languageClientFactory: LanguageClientFactory, + @inject(Window) protected readonly window: Window, + @inject(CommandService) protected readonly commandService: CommandService + ) { + super(workspace, languages, languageClientFactory); + } + + protected get globPatterns() { + return ['**/*.java', '**/pom.xml', '**/*.gradle']; + } + + protected onReady(languageClient: ILanguageClient): void { + languageClient.onNotification(ActionableNotification.type, this.showActionableMessage.bind(this)); + super.onReady(languageClient); + } + + protected showActionableMessage(message: ActionableMessage): void { + const items = message.commands || []; + this.window.showMessage(message.severity, message.message, ...items).then(command => { + if (command) { + const args = command.arguments || []; + this.commandService.executeCommand(command.command, ...args); + } + }); + } } diff --git a/packages/java/src/browser/monaco-contribution/index.ts b/packages/java/src/browser/monaco-contribution/index.ts index ce74c9a80b1f2..b6fdc466d47bf 100644 --- a/packages/java/src/browser/monaco-contribution/index.ts +++ b/packages/java/src/browser/monaco-contribution/index.ts @@ -5,17 +5,17 @@ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 */ -import { JAVA_LANGUAGE_ID } from '../../common'; +import { JAVA_LANGUAGE_ID, JAVA_LANGUAGE_NAME } from '../../common'; import { configuration, monarchLanguage } from "./java-monaco-language"; monaco.languages.register({ - id: JAVA_LANGUAGE_ID, - extensions: ['.java', '.jav', '.class'], - aliases: ['Java', 'java'], - mimetypes: ['text/x-java-source', 'text/x-java'], + id: JAVA_LANGUAGE_ID, + extensions: ['.java', '.jav', '.class'], + aliases: [JAVA_LANGUAGE_NAME, 'java'], + mimetypes: ['text/x-java-source', 'text/x-java'], }); monaco.languages.onLanguage(JAVA_LANGUAGE_ID, () => { - monaco.languages.setLanguageConfiguration(JAVA_LANGUAGE_ID, configuration); - monaco.languages.setMonarchTokensProvider(JAVA_LANGUAGE_ID, monarchLanguage); + monaco.languages.setLanguageConfiguration(JAVA_LANGUAGE_ID, configuration); + monaco.languages.setMonarchTokensProvider(JAVA_LANGUAGE_ID, monarchLanguage); }); diff --git a/packages/java/src/node/java-contribution.ts b/packages/java/src/node/java-contribution.ts index c9a1630a7dd06..12335af4ab031 100644 --- a/packages/java/src/node/java-contribution.ts +++ b/packages/java/src/node/java-contribution.ts @@ -22,59 +22,56 @@ configurations.set('linux', 'config_linux'); @injectable() export class JavaContribution extends BaseLanguageServerContribution { - readonly id = JAVA_LANGUAGE_ID; - readonly name = JAVA_LANGUAGE_NAME; + readonly id = JAVA_LANGUAGE_ID; + readonly name = JAVA_LANGUAGE_NAME; - start(clientConnection: IConnection): void { - const serverPath = path.resolve(__dirname, 'server'); - const jarPaths = glob.sync('**/plugins/org.eclipse.equinox.launcher_*.jar', { cwd: serverPath }); - if (jarPaths.length === 0) { - throw new Error('The Java server launcher is not found.'); - } + start(clientConnection: IConnection): void { + const serverPath = path.resolve(__dirname, 'server'); + const jarPaths = glob.sync('**/plugins/org.eclipse.equinox.launcher_*.jar', { cwd: serverPath }); + if (jarPaths.length === 0) { + throw new Error('The Java server launcher is not found.'); + } - const jarPath = path.resolve(serverPath, jarPaths[0]); - const workspacePath = path.resolve(os.tmpdir(), '_ws_' + new Date().getTime()); - const configuration = configurations.get(process.platform); - if (!configuration) { - throw new Error('Cannot find Java server configuration for ' + process.platform); - } - const configurationPath = path.resolve(serverPath, configuration); - const command = 'java'; - const args = [ - '-Declipse.application=org.eclipse.jdt.ls.core.id1', - '-Dosgi.bundles.defaultStartLevel=4', - '-Declipse.product=org.eclipse.jdt.ls.core.product' - ]; + const jarPath = path.resolve(serverPath, jarPaths[0]); + const workspacePath = path.resolve(os.tmpdir(), '_ws_' + new Date().getTime()); + const configuration = configurations.get(process.platform); + if (!configuration) { + throw new Error('Cannot find Java server configuration for ' + process.platform); + } + const configurationPath = path.resolve(serverPath, configuration); + const command = 'java'; + const args = [ + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product' + ]; - if (DEBUG_MODE) { - args.push( - '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044', - '-Dlog.protocol=true', - '-Dlog.level=ALL' - ); - } + if (DEBUG_MODE) { + args.push( + '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044', + '-Dlog.protocol=true', + '-Dlog.level=ALL' + ); + } - args.push( - '-jar', jarPath, - '-configuration', configurationPath, - '-data', workspacePath - ); + args.push( + '-jar', jarPath, + '-configuration', configurationPath, + '-data', workspacePath + ); - Promise.all([ - this.startSocketServer(), this.startSocketServer() - ]).then(servers => { - const [inServer, outServer] = servers; - const inSocket = this.accept(inServer); - const outSocket = this.accept(outServer); + Promise.all( + [this.startSocketServer()] + ).then(servers => { + const [server] = servers; + const socket = this.accept(server); - this.logInfo('logs at ' + path.resolve(workspacePath, '.metadata', '.log')); - const env = Object.create(process.env); - env.STDIN_HOST = inServer.address().address; - env.STDIN_PORT = inServer.address().port; - env.STDOUT_HOST = outServer.address().address; - env.STDOUT_PORT = outServer.address().port; - this.createProcessSocketConnection(inSocket, outSocket, command, args, { env }) - .then(serverConnection => this.forward(clientConnection, serverConnection)); - }); - } + this.logInfo('logs at ' + path.resolve(workspacePath, '.metadata', '.log')); + const env = Object.create(process.env); + env.CLIENT_HOST = server.address().address; + env.CLIENT_PORT = server.address().port; + this.createProcessSocketConnection(socket, socket, command, args, { env }) + .then(serverConnection => this.forward(clientConnection, serverConnection)); + }); + } }