Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

[DO NOT MERGE] Support workspace/executeClientCommand protocol extension #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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' ])
Expand Down Expand Up @@ -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) {
Expand Down