Skip to content

Commit

Permalink
Issue #51 : Update omnisharp-node-client
Browse files Browse the repository at this point in the history
Better support for dotnet-core 2.0 projects,
embeds its own version of mono

Signed-off-by: Mickael Istria <[email protected]>
  • Loading branch information
mickaelistria committed Aug 9, 2017
1 parent 8cd8fd2 commit 9390456
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 26 deletions.
4 changes: 2 additions & 2 deletions org.eclipse.acute.omnisharpServer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</goals>
<phase>generate-resources</phase>
<configuration>
<url>https://github.com/OmniSharp/omnisharp-node-client/archive/v7.0.7.zip</url>
<url>https://github.com/OmniSharp/omnisharp-node-client/archive/v7.1.2.zip</url>
<unpack>true</unpack>
<outputDirectory>server/</outputDirectory>
<skipCache>true</skipCache>
Expand All @@ -56,7 +56,7 @@
<arguments>
<arg>install</arg>
</arguments>
<workingDirectory>server/omnisharp-node-client-7.0.7</workingDirectory>
<workingDirectory>server/omnisharp-node-client-7.1.2</workingDirectory>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import java.io.BufferedReader;
import java.io.File;
import java.io.FilterInputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
Expand Down Expand Up @@ -55,7 +57,7 @@ public void start() throws IOException {
omnisharpLocation);
process = builder.start();
} else {
URL serverFileUrl = getClass().getResource("/server/omnisharp-node-client-7.0.7/languageserver/server.js");
URL serverFileUrl = getClass().getResource("/server/omnisharp-node-client-7.1.2/languageserver/server.js");
if (serverFileUrl != null) {
File serverFile = new File(FileLocator.toFileURL(serverFileUrl).getPath());
if (serverFile.exists()) {
Expand Down Expand Up @@ -128,33 +130,58 @@ public IStatus runInUIThread(IProgressMonitor monitor) {

@Override
public InputStream getInputStream() {
return process.getInputStream();
return new FilterInputStream(process.getInputStream()) {
@Override
public int read() throws IOException {
int res = super.read();
System.err.print((char) res);
return res;
}

@Override
public int read(byte[] b, int off, int len) throws IOException {
int bytes = super.read(b, off, len);
byte[] payload = new byte[bytes];
System.arraycopy(b, off, payload, 0, bytes);
System.err.print(new String(payload));
return bytes;
}

@Override
public int read(byte[] b) throws IOException {
int bytes = super.read(b);
byte[] payload = new byte[bytes];
System.arraycopy(b, 0, payload, 0, bytes);
System.err.print(new String(payload));
return bytes;
}
};
}

@Override
public OutputStream getOutputStream() {
// return new FilterOutputStream(process.getOutputStream()) {
// @Override
// public void write(int b) throws IOException {
// System.err.print(b);
// super.write(b);
// }
//
// @Override
// public void write(byte[] b) throws IOException {
// System.err.print(new String(b));
// super.write(b);
// }
//
// @Override
// public void write(byte[] b, int off, int len) throws IOException {
// byte[] actual = new byte[len];
// System.arraycopy(b, off, actual, 0, len);
// System.err.print(new String(actual));
// super.write(b, off, len);
// }
// };
return process.getOutputStream();
return new FilterOutputStream(process.getOutputStream()) {
@Override
public void write(int b) throws IOException {
System.err.print((char) b);
super.write(b);
}

@Override
public void write(byte[] b) throws IOException {
System.err.print(new String(b));
super.write(b);
}

@Override
public void write(byte[] b, int off, int len) throws IOException {
byte[] actual = new byte[len];
System.arraycopy(b, off, actual, 0, len);
System.err.print(new String(actual));
super.write(b, off, len);
}
};
// return process.getOutputStream();
}

@Override
Expand Down

0 comments on commit 9390456

Please sign in to comment.