|
| 1 | +package org.eclipse.lsp4e.freemarker; |
| 2 | + |
| 3 | +import java.util.ArrayList; |
| 4 | +import java.util.List; |
| 5 | + |
| 6 | +import org.eclipse.core.runtime.Path; |
| 7 | +import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider; |
| 8 | +import org.osgi.framework.Bundle; |
| 9 | + |
| 10 | +public class FreemarkerLanguageServer extends ProcessStreamConnectionProvider { |
| 11 | + |
| 12 | + public FreemarkerLanguageServer() { |
| 13 | + List<String> commands = new ArrayList<>(); |
| 14 | + commands.add("java"); |
| 15 | + commands.add("-jar"); |
| 16 | + commands.add("D:\\_Personal\\Freemarker\\org.lsp4fm\\target\\freemarker-server-all.jar"); |
| 17 | +// commands.add("-Declipse.application=org.eclipse.jdt.ls.core.id1"); |
| 18 | +// commands.add("-Dosgi.bundles.defaultStartLevel=4"); |
| 19 | +// commands.add("-Declipse.product=org.eclipse.jdt.ls.core.product"); |
| 20 | +// commands.add("-Dlog.protocol=true"); |
| 21 | +// commands.add("-Dlog.level=ALL"); |
| 22 | +// commands.add("-noverify"); |
| 23 | +// commands.add("-Xmx1G"); |
| 24 | +// commands.add("-jar"); |
| 25 | +// commands.add("./plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar"); |
| 26 | +// commands.add("-configuration"); |
| 27 | +// if (Platform.getOS().equals(Platform.OS_WIN32)) { |
| 28 | +// commands.add("./config_win"); |
| 29 | +// } |
| 30 | +// if (Platform.getOS().equals(Platform.OS_LINUX)) { |
| 31 | +// commands.add("./config_linux"); |
| 32 | +// } |
| 33 | +// if (Platform.getOS().equals(Platform.OS_MACOSX)) { |
| 34 | +// commands.add("./config_mac"); |
| 35 | +// } |
| 36 | +// commands.add("-data"); |
| 37 | +// commands.add("./data"); |
| 38 | + |
| 39 | + setCommands(commands); |
| 40 | + |
| 41 | + Bundle bundle = Activator.getDefault().getBundle(); |
| 42 | + Path workingDir = Path.EMPTY; |
| 43 | + //try { |
| 44 | + workingDir = new Path("D:\\_Personal\\Freemarker\\org.lsp4fm\\target"); //new Path(FileLocator.toFileURL(FileLocator.find(bundle, new Path("server"), null)).getPath()); |
| 45 | + setWorkingDirectory(workingDir.toOSString()); |
| 46 | +// } catch (IOException e) { |
| 47 | +// LanguageServerPlugin.logError(e); |
| 48 | +// } |
| 49 | + } |
| 50 | + |
| 51 | + @Override |
| 52 | + public String toString() { |
| 53 | + return "Java Language Server" + super.toString(); |
| 54 | + } |
| 55 | +} |
0 commit comments