Skip to content

Commit 71bebb2

Browse files
committed
update fantomas and format files
1 parent ba08d56 commit 71bebb2

27 files changed

+309
-292
lines changed

.config/dotnet-tools.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"fable"
1515
]
1616
},
17-
"fantomas-tool": {
18-
"version": "4.7.0",
17+
"fantomas": {
18+
"version": "5.0.0-alpha-007",
1919
"commands": [
2020
"fantomas"
2121
]

build/Program.fs

+4-5
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,10 @@ let initTargets () =
399399
let buildTargetTree () =
400400
let (==>!) x y = x ==> y |> ignore
401401

402-
"YarnInstall" ==>! "RunScript"
403-
"DotNetRestore" ==>! "RunScript"
404-
405-
"Clean" ==> "Format" ==> "RunScript"
406-
==>! "Default"
402+
"YarnInstall" ==>! "Bundle"
403+
"DotNetRestore" ==>! "Bundle"
404+
"RunScript" ==>! "Bundle"
405+
"Clean" ==> "Format" ==> "Bundle" ==>! "Default"
407406

408407
"Clean"
409408
==> "RunScript"

src/Components/CodeLensHelpers.fs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ open System
44
open Fable.Core.JsInterop
55
open Fable.Import.VSCode
66
open Fable.Import.VSCode.Vscode
7-
open global.Node
8-
9-
module node = Node.Api
107

118
module CodeLensHelpers =
129

13-
let showReferences (args: string) (args2: obj) (args3: obj []) =
10+
let showReferences (args: string) (args2: obj) (args3: obj[]) =
1411
let uri = vscode.Uri.parse args
1512
let pos = vscode.Position.Create(!!args2?Line, !!args2?Character)
1613

src/Components/Debugger.fs

+54-39
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ open Fable.Core.JsInterop
55
open Fable.Import
66
open Fable.Import.VSCode
77
open Fable.Import.VSCode.Vscode
8-
open global.Node
8+
99
open Ionide.VSCode.Helpers
1010
open DTO
1111

@@ -91,7 +91,7 @@ module Debugger =
9191

9292
let debuggerRuntime project = Some "coreclr"
9393

94-
let debugProject (project: Project) (args: string []) =
94+
let debugProject (project: Project) (args: string[]) =
9595
promise {
9696
//TODO check if portablepdb, require info from FSAC
9797

@@ -158,13 +158,11 @@ module Debugger =
158158
promise {
159159
match Project.getLoaded () with
160160
| [] -> return None
161-
| project::[] -> return Some project
161+
| project :: [] -> return Some project
162162
| projects ->
163163
let picks =
164164
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 ])
168166
|> ResizeArray
169167

170168
let! proj = window.showQuickPick (unbox<U2<ResizeArray<QuickPickItem>, _>> picks)
@@ -198,7 +196,7 @@ module Debugger =
198196
abstract member Item: string -> 't
199197

200198
[<Emit("Object.keys($0)")>]
201-
abstract member Keys: string []
199+
abstract member Keys: string[]
202200

203201
[<Interface>]
204202
type LaunchSettingsConfiguration =
@@ -268,35 +266,42 @@ module Debugger =
268266
c.request <- "launch"
269267
c?program <- projectExecutable
270268
c?args <- cliArgs
269+
271270
match buildTaskOpt with
272271
| Some bt -> c?preLaunchTask <- $"Build: {bt.name}"
273272
| None -> ()
274273

275-
c?cwd <- ls.workingDirectory
276-
|> Option.defaultValue "${workspaceFolder}"
274+
c?cwd <-
275+
ls.workingDirectory
276+
|> Option.defaultValue "${workspaceFolder}"
277277

278278

279279

280280
match ls.launchBrowser with
281281
| 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?
284285
| _ -> ()
285286

286287
if JS.isDefined ls.environmentVariables then
287288
let vars =
288289
ls.environmentVariables.Keys
289290
|> Array.choose (fun k ->
290291
let value = ls.environmentVariables[k]
292+
291293
if JS.isDefined value then
292294
let replaced = Environment.expand value
293-
Some (k, box replaced)
294-
else None
295-
)
295+
Some(k, box replaced)
296+
else
297+
None)
296298

297299
c?env <- createObj vars
298300

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
300305
c?env?ASPNETCORE_URLS <- ls.applicationUrl.Value
301306

302307
c?console <- "internalConsole"
@@ -326,7 +331,7 @@ module Debugger =
326331
None
327332
else
328333
let c = createEmpty<DebugConfiguration>
329-
c.name <- $"{path.basename p.Project}"
334+
c.name <- $"{node.path.basename p.Project}"
330335
c.``type`` <- "coreclr"
331336
c.request <- "launch"
332337
c?program <- p.Output
@@ -335,6 +340,7 @@ module Debugger =
335340

336341
c?console <- "internalConsole"
337342
c?stopAtEntry <- false
343+
338344
match buildTaskOpt with
339345
| Some bt -> c?preLaunchTask <- $"Build: {bt.name}"
340346
| None -> ()
@@ -352,29 +358,38 @@ module Debugger =
352358

353359
{ new DebugConfigurationProvider with
354360
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 ()
378393
|> Promise.map Some
379394
|> Promise.toThenable
380395
|> U2.Case2

src/Components/Diagnostics.fs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ open Fable.Core
55
open Fable.Import
66
open Fable.Import.VSCode
77
open Fable.Import.VSCode.Vscode
8-
open global.Node
98
open JsInterop
109

1110
open Ionide.VSCode.Helpers

src/Components/FSharpLiterate.fs

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ namespace Ionide.VSCode.FSharp
22

33
open Fable.Import.VSCode
44
open Fable.Import.VSCode.Vscode
5-
open global.Node
65
open Fable.Core.JsInterop
76

87
module node = Node.Api
@@ -228,13 +227,15 @@ module FSharpLiterate =
228227
| Some p -> p.reveal (!! -2, true)
229228
| None ->
230229
let opts =
231-
createObj [ "enableCommandUris" ==> true
232-
"enableFindWidget" ==> true
233-
"retainContextWhenHidden" ==> true ]
230+
createObj
231+
[ "enableCommandUris" ==> true
232+
"enableFindWidget" ==> true
233+
"retainContextWhenHidden" ==> true ]
234234

235235
let viewOpts =
236-
createObj [ "preserveFocus" ==> true
237-
"viewColumn" ==> -2 ]
236+
createObj
237+
[ "preserveFocus" ==> true
238+
"viewColumn" ==> -2 ]
238239

239240
let p =
240241
window.createWebviewPanel ("fsharpLiterate", "F# Literate", !!viewOpts, opts)

src/Components/FakeTargetsOutline.fs

+9-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ open Fable.Core.JsInterop
66
open Fable.Import
77
open Fable.Import.VSCode
88
open Fable.Import.VSCode.Vscode
9-
open global.Node
109
open Ionide.VSCode.Helpers
1110
open System.Collections.Generic
1211

@@ -42,7 +41,7 @@ module FakeTargetsOutline =
4241
| DependencyModel of DependencyType
4342

4443
type Model =
45-
{ AllTargets: Target []
44+
{ AllTargets: Target[]
4645
Label: string
4746
Description: string
4847
Declaration: Declaration option
@@ -117,11 +116,11 @@ module FakeTargetsOutline =
117116
Some
118117
<| getIconPath "auto-reveal-light.svg" "auto-reveal-dark.svg"
119118

120-
let tryFindTarget (allTargets: Target []) (name: string) =
119+
let tryFindTarget (allTargets: Target[]) (name: string) =
121120
allTargets
122121
|> Seq.tryFind (fun t -> t.Name.ToLowerInvariant() = name.ToLowerInvariant())
123122

124-
let rec depAsModel (allTargets: Target []) (t: DependencyType) (d: Dependency) =
123+
let rec depAsModel (allTargets: Target[]) (t: DependencyType) (d: Dependency) =
125124
let mutable children = None
126125

127126
{ AllTargets = allTargets
@@ -147,7 +146,7 @@ module FakeTargetsOutline =
147146
children <- Some n
148147
n }
149148

150-
and targetAsModel (allTargets: Target []) (t: Target) =
149+
and targetAsModel (allTargets: Target[]) (t: Target) =
151150
let mutable children = None
152151

153152
{ AllTargets = allTargets
@@ -380,7 +379,7 @@ module FakeTargetsOutline =
380379
window.onDidChangeActiveTextEditor.Invoke(unbox onDidChangeActiveTextEditor)
381380
|> context.Subscribe
382381

383-
refresh.event.Invoke (fun uri ->
382+
refresh.event.Invoke(fun uri ->
384383
if isEnabledFor uri then
385384
reallyRefresh.fire (None)
386385

@@ -400,8 +399,9 @@ module FakeTargetsOutline =
400399
let line = decl.Line
401400

402401
let args =
403-
createObj [ "lineNumber" ==> line
404-
"at" ==> "center" ]
402+
createObj
403+
[ "lineNumber" ==> line
404+
"at" ==> "center" ]
405405

406406
commands.executeCommand ("revealLine", Some(box args))
407407
|> unbox
@@ -482,8 +482,7 @@ module FakeTargetsOutline =
482482
let procExp =
483483
vscode.ProcessExecution.Create(
484484
dotnet,
485-
ResizeArray [| yield fakeRuntime
486-
yield! args |],
485+
ResizeArray [| yield fakeRuntime; yield! args |],
487486
opts
488487
)
489488

src/Components/Fsi.fs

+14-9
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ open Fable.Core
55
open Fable.Core.JsInterop
66
open Fable.Import.VSCode
77
open Fable.Import.VSCode.Vscode
8-
open global.Node
98

109
open DTO
1110
open Ionide.VSCode.Helpers
1211

1312
module node = Node.Api
1413

1514
module Fsi =
15+
let path = node.path
16+
let fs = node.fs
17+
1618
module SdkScriptsNotify =
1719

1820
open Ionide.VSCode.FSharp
@@ -114,13 +116,15 @@ module Fsi =
114116
| Some p -> p.reveal (!! -2, true)
115117
| None ->
116118
let opts =
117-
createObj [ "enableCommandUris" ==> true
118-
"enableFindWidget" ==> true
119-
"retainContextWhenHidden" ==> true ]
119+
createObj
120+
[ "enableCommandUris" ==> true
121+
"enableFindWidget" ==> true
122+
"retainContextWhenHidden" ==> true ]
120123

121124
let viewOpts =
122-
createObj [ "preserveFocus" ==> true
123-
"viewColumn" ==> -2 ]
125+
createObj
126+
[ "preserveFocus" ==> true
127+
"viewColumn" ==> -2 ]
124128

125129
let p = window.createWebviewPanel ("fsiWatcher", "FSI Watcher", !!viewOpts, opts)
126130
let onClose () = panel <- None
@@ -435,9 +439,10 @@ module Fsi =
435439

436440
let private moveCursorDownOneLine () =
437441
let args =
438-
createObj [ "to" ==> "down"
439-
"by" ==> "line"
440-
"value" ==> 1 ]
442+
createObj
443+
[ "to" ==> "down"
444+
"by" ==> "line"
445+
"value" ==> 1 ]
441446

442447
commands.executeCommand ("cursorMove", Some(box args))
443448
|> ignore

0 commit comments

Comments
 (0)