@@ -5,7 +5,7 @@ open Fable.Core.JsInterop
5
5
open Fable.Import
6
6
open Fable.Import .VSCode
7
7
open Fable.Import .VSCode .Vscode
8
- open global. Node
8
+
9
9
open Ionide.VSCode .Helpers
10
10
open DTO
11
11
@@ -91,7 +91,7 @@ module Debugger =
91
91
92
92
let debuggerRuntime project = Some " coreclr"
93
93
94
- let debugProject ( project : Project ) ( args : string []) =
94
+ let debugProject ( project : Project ) ( args : string []) =
95
95
promise {
96
96
//TODO check if portablepdb, require info from FSAC
97
97
@@ -158,13 +158,11 @@ module Debugger =
158
158
promise {
159
159
match Project.getLoaded () with
160
160
| [] -> return None
161
- | project:: [] -> return Some project
161
+ | project :: [] -> return Some project
162
162
| projects ->
163
163
let picks =
164
164
projects
165
- |> List.map ( fun p ->
166
- createObj [ " data" ==> p
167
- " label" ==> p.Project ])
165
+ |> List.map ( fun p -> createObj [ " data" ==> p; " label" ==> p.Project ])
168
166
|> ResizeArray
169
167
170
168
let! proj = window.showQuickPick ( unbox< U2< ResizeArray< QuickPickItem>, _>> picks)
@@ -198,7 +196,7 @@ module Debugger =
198
196
abstract member Item: string -> 't
199
197
200
198
[<Emit( " Object.keys($0)" ) >]
201
- abstract member Keys: string []
199
+ abstract member Keys: string []
202
200
203
201
[<Interface>]
204
202
type LaunchSettingsConfiguration =
@@ -268,35 +266,42 @@ module Debugger =
268
266
c.request <- " launch"
269
267
c?program <- projectExecutable
270
268
c?args <- cliArgs
269
+
271
270
match buildTaskOpt with
272
271
| Some bt -> c?preLaunchTask <- $" Build: {bt.name}"
273
272
| None -> ()
274
273
275
- c?cwd <- ls.workingDirectory
276
- |> Option.defaultValue " ${workspaceFolder}"
274
+ c?cwd <-
275
+ ls.workingDirectory
276
+ |> Option.defaultValue " ${workspaceFolder}"
277
277
278
278
279
279
280
280
match ls.launchBrowser with
281
281
| Some true ->
282
- c?serverReadyAction <- {| action = " openExternally"
283
- pattern = " \\ bNow listening on:\\ s+(https?://\\ S+)" |} // TODO: make this pattern extendable?
282
+ c?serverReadyAction <-
283
+ {| action = " openExternally"
284
+ pattern = " \\ bNow listening on:\\ s+(https?://\\ S+)" |} // TODO: make this pattern extendable?
284
285
| _ -> ()
285
286
286
287
if JS.isDefined ls.environmentVariables then
287
288
let vars =
288
289
ls.environmentVariables.Keys
289
290
|> Array.choose ( fun k ->
290
291
let value = ls.environmentVariables[ k]
292
+
291
293
if JS.isDefined value then
292
294
let replaced = Environment.expand value
293
- Some ( k, box replaced)
294
- else None
295
- )
295
+ Some( k, box replaced)
296
+ else
297
+ None )
296
298
297
299
c?env <- createObj vars
298
300
299
- if not ( JS.isDefined ls.environmentVariables[ " ASPNETCORE_URLS" ]) && Option.isSome ls.applicationUrl then
301
+ if
302
+ not ( JS.isDefined ls.environmentVariables[ " ASPNETCORE_URLS" ])
303
+ && Option.isSome ls.applicationUrl
304
+ then
300
305
c?env?ASPNETCORE_ URLS <- ls.applicationUrl.Value
301
306
302
307
c?console <- " internalConsole"
@@ -326,7 +331,7 @@ module Debugger =
326
331
None
327
332
else
328
333
let c = createEmpty< DebugConfiguration>
329
- c.name <- $" {path.basename p.Project}"
334
+ c.name <- $" {node. path.basename p.Project}"
330
335
c.`` type `` <- " coreclr"
331
336
c.request <- " launch"
332
337
c?program <- p.Output
@@ -335,6 +340,7 @@ module Debugger =
335
340
336
341
c?console <- " internalConsole"
337
342
c?stopAtEntry <- false
343
+
338
344
match buildTaskOpt with
339
345
| Some bt -> c?preLaunchTask <- $" Build: {bt.name}"
340
346
| None -> ()
@@ -352,29 +358,38 @@ module Debugger =
352
358
353
359
{ new DebugConfigurationProvider with
354
360
override x.provideDebugConfigurations ( folder : option < WorkspaceFolder >, token : option < CancellationToken >) =
355
- let generate () = promise {
356
- logger.Info $" Evaluating launch settings configurations for workspace '%A {folder}'"
357
- let projects = Project.getLoaded()
358
- let! msbuildTasks = tasks.fetchTasks( msbuildTasksFilter)
359
- let tasks =
360
- projects
361
- |> Seq.collect ( fun ( p : Project ) ->
362
- seq {
363
- let projectFile = path.basename p.Project
364
- let buildTaskForProject = msbuildTasks |> Seq.tryFind ( fun t -> t.group = Some vscode.TaskGroup.Build && t.name = projectFile)
365
- // emit configurations for any launchsettings for this project
366
- match readSettingsForProject p with
367
- | Some launchSettings -> yield ! configsForProject ( p, launchSettings, buildTaskForProject)
368
- | None -> ()
369
- // emit a default configuration for this project if it is an executable
370
- match defaultConfigForProject ( p, buildTaskForProject) with
371
- | Some p -> yield p
372
- | None -> ()
373
- })
374
- return ResizeArray tasks
375
- }
376
-
377
- generate()
361
+ let generate () =
362
+ promise {
363
+ logger.Info $" Evaluating launch settings configurations for workspace '%A {folder}'"
364
+ let projects = Project.getLoaded ()
365
+ let! msbuildTasks = tasks.fetchTasks ( msbuildTasksFilter)
366
+
367
+ let tasks =
368
+ projects
369
+ |> Seq.collect ( fun ( p : Project ) ->
370
+ seq {
371
+ let projectFile = node.path.basename p.Project
372
+
373
+ let buildTaskForProject =
374
+ msbuildTasks
375
+ |> Seq.tryFind ( fun t ->
376
+ t.group = Some vscode.TaskGroup.Build
377
+ && t.name = projectFile)
378
+ // emit configurations for any launchsettings for this project
379
+ match readSettingsForProject p with
380
+ | Some launchSettings ->
381
+ yield ! configsForProject ( p, launchSettings, buildTaskForProject)
382
+ | None -> ()
383
+ // emit a default configuration for this project if it is an executable
384
+ match defaultConfigForProject ( p, buildTaskForProject) with
385
+ | Some p -> yield p
386
+ | None -> ()
387
+ })
388
+
389
+ return ResizeArray tasks
390
+ }
391
+
392
+ generate ()
378
393
|> Promise.map Some
379
394
|> Promise.toThenable
380
395
|> U2.Case2
0 commit comments