Skip to content

Commit 2e24e4c

Browse files
Add better error message for FSAC spawn
1 parent e37ec3e commit 2e24e4c

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/Core/LanguageService.fs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ open System
44
open FunScript
55
open FunScript.TypeScript
66
open FunScript.TypeScript.fs
7+
open FunScript.TypeScript.vscode
78
open FunScript.TypeScript.child_process
89

910
open DTO
@@ -116,12 +117,20 @@ module LanguageService =
116117
"" |> request (url "compilerlocation") |> send 0
117118

118119
let start () =
119-
let path = (VSCode.getPluginPath "Ionide.Ionide-fsharp") + "/bin/FsAutoComplete.Suave.exe"
120-
let child = if Process.isMono () then Globals.spawn("mono", [| path; string port|]) else Globals.spawn(path, [| string port|])
121-
service <- Some child
122-
child.stderr.on("data", unbox<Function>( fun n -> Globals.console.error (n.ToString()))) |> ignore
123-
child.stdout.on("data", unbox<Function>( fun n -> Globals.console.log (n.ToString()))) |> ignore
124-
()
120+
try
121+
let path = (VSCode.getPluginPath "Ionide.Ionide-fsharp") + "/bin/FsAutoComplete.Suave.exe"
122+
let child = if Process.isMono () then Globals.spawn("mono", [| path; string port|]) else Globals.spawn(path, [| string port|])
123+
service <- Some child
124+
child.stderr.on("data", unbox<Function>( fun n -> Globals.console.error (n.ToString()))) |> ignore
125+
child.stdout.on("data", unbox<Function>( fun n -> Globals.console.log (n.ToString()))) |> ignore
126+
with
127+
| _ ->
128+
if Process.isMono () then
129+
"Failed to start language services. Please check if mono is in PATH"
130+
else
131+
"Failed to start language services. Please check if Microsoft Built Tools 2013 are installed"
132+
|> window.Globals.showErrorMessage
133+
|> ignore
125134

126135
let stop () =
127136
service |> Option.iter (fun n -> n.kill "SIGKILL")

0 commit comments

Comments
 (0)