From 6afd696b36d4bb72d0cc04fa2f91416cc4bc5ffb Mon Sep 17 00:00:00 2001 From: BoykoAlex Date: Thu, 10 May 2018 12:08:00 -0400 Subject: [PATCH] Support `workspace/executeClientCommand` protocol extension --- lib/main.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 6c9de10..820e257 100644 --- a/lib/main.js +++ b/lib/main.js @@ -11,9 +11,9 @@ const { removeUnusedImportProvider } = actionProviders -const serverDownloadUrl = 'http://download.eclipse.org/jdtls/milestones/0.14.0/jdt-language-server-0.14.0-201802282111.tar.gz' +const serverDownloadUrl = 'http://download.eclipse.org/jdtls/milestones/0.17.0/jdt-language-server-0.17.0-201804162308.tar.gz' const serverDownloadSize = 35873467 -const serverLauncher = '/plugins/org.eclipse.equinox.launcher_1.5.0.v20180119-0753.jar' +const serverLauncher = '/plugins/org.eclipse.equinox.launcher_1.5.0.v20180207-1446.jar' const minJavaRuntime = 1.8 const bytesToMegabytes = 1024 * 1024 @@ -85,6 +85,19 @@ class JavaLanguageClient extends AutoLanguageClient { ) } + postInitialization(server) { + server.connection._onRequest( {method: 'workspace/executeClientCommand'}, params => this.executeClientCommand(params)); + } + + executeClientCommand(params) { + const commands = this.getLspCommandsRegistry(); + return commands.execute(params.command, params.arguments); + } + + getLspCommandsRegistry() { + return global.lspCommandRegistry; + } + checkJavaVersion (command) { return new Promise((resolve, reject) => { const childProcess = cp.spawn(command, [ '-showversion', '-version' ]) @@ -209,7 +222,7 @@ class JavaLanguageClient extends AutoLanguageClient { return atom.packages.getLoadedPackages() .filter(pkg => Array.isArray(pkg.metadata.javaExtensions)) .map(pkg => pkg.metadata.javaExtensions.map(p => path.resolve(pkg.path, p))) - .reduce(e => e.concat([]), []); + .reduce((a, e) => a.concat(e)); } updateInstallStatus (status) {