Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed detection of server directory #3

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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -35,12 +36,21 @@ public PHPLanguageServer() {
commands.add("php");
Bundle bundle = Activator.getContext().getBundle();
Path workingDir = Path.EMPTY;
URL serverUrl = bundle.getEntry("/server");
if (serverUrl == null) {
// in development mode the server is copied to the target directory
serverUrl = bundle.getEntry("/target/server");
}
if (serverUrl == null) {
throw new IllegalStateException ("Language server is not available in bundle "+bundle.getSymbolicName()+".");
}
try {
workingDir = new Path(FileLocator.toFileURL(FileLocator.find(bundle, new Path("server"), null)).getPath());
commands.add(workingDir.append("/bin/php-language-server.php").toOSString());
workingDir = new Path(FileLocator.toFileURL(serverUrl).getPath());
} catch (IOException e) {
LanguageServerPlugin.logError(e);
}
commands.add(workingDir.append("/bin/php-language-server.php").toOSString());

if (Platform.getOS().equals(Platform.OS_WIN32)) {
commands.add("--tcp=127.0.0.1:" + CONNECTION_PORT);
provider = new SocketStreamConnectionProvider(commands, workingDir.toOSString(), CONNECTION_PORT);
Expand Down