@@ -45,10 +45,32 @@ public OmnisharpStreamConnectionProvider() {
45
45
46
46
@ Override
47
47
public void start () throws IOException {
48
+ // workaround for https://github.com/OmniSharp/omnisharp-node-client/issues/265
49
+ String [] command ;
50
+ try {
51
+ command = new String [] { "/bin/bash" , "-c" , AcutePlugin .getDotnetCommand (), "restore" };
52
+ if (Platform .getOS ().equals (Platform .OS_WIN32 )) {
53
+ command = new String [] { "cmd" , "/c" , AcutePlugin .getDotnetCommand (), "restore" };
54
+ }
55
+ Process restoreProcess = Runtime .getRuntime ().exec (command );
56
+ try {
57
+ restoreProcess .waitFor ();
58
+ } catch (InterruptedException e ) {
59
+ AcutePlugin .logError (e );
60
+ }
61
+ } catch (IllegalStateException e ) {
62
+ AcutePlugin .getDefault ().getLog ().log (new Status (IStatus .ERROR ,
63
+ AcutePlugin .getDefault ().getBundle ().getSymbolicName (),
64
+ "`dotnet restore` not performed!\n "
65
+ + "Main issue and remediation: The `dotnet` path is not set in the .NET Core preferences. Please set it.\n "
66
+ + "Possible alternative remediation:\n "
67
+ + "* `dotnet` (v2.0 or later) is a prerequisite. Install it on your system if missing." ));
68
+ }
69
+
48
70
String commandLine = System .getenv ("OMNISHARP_LANGUAGE_SERVER_COMMAND" );
49
71
String omnisharpLocation = System .getenv ("OMNISHARP_LANGUAGE_SERVER_LOCATION" );
50
72
if (commandLine != null ) {
51
- String [] command = new String [] {"/bin/bash" , "-c" , commandLine };
73
+ command = new String [] {"/bin/bash" , "-c" , commandLine };
52
74
if (Platform .getOS ().equals (Platform .OS_WIN32 )) {
53
75
command = new String [] {"cmd" , "/c" , commandLine };
54
76
}
0 commit comments