Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
vipentti committed Dec 4, 2023
1 parent 9a10225 commit 9263555
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/Visp.Compiler/FsharpGenerator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ let private generateNuGetConfig () =
</fallbackPackageFolders>
</configuration>
"""

t.Trim() + Environment.NewLine

| None ->
Expand All @@ -117,6 +118,7 @@ let private generateNuGetConfig () =
</packageSources>
</configuration>
"""

t.Trim() + Environment.NewLine

let private runtimeProjectOrPackageReference (typ: RuntimeLibraryReference) =
Expand Down Expand Up @@ -244,7 +246,11 @@ type FsharpGenerator(fs: IFileSystem, dir: string) =
member this.NameOfWithoutExtension(name: string) =
this.fs.Path.GetFileNameWithoutExtension name

member this.WriteVispFiles (typ: RuntimeLibraryReference) (files: VispFile list) (flags: string option) =
member this.WriteVispFiles
(typ: RuntimeLibraryReference)
(files: VispFile list)
(flags: string option)
=
let dir = this.fs.Directory.CreateDirectory this.dir
let existingFiles = dir.GetFiles("*.fs", SearchOption.TopDirectoryOnly)

Expand All @@ -269,7 +275,8 @@ type FsharpGenerator(fs: IFileSystem, dir: string) =
let fileNames = results |> List.map fst
let requires = results |> List.map snd |> Set.unionMany

let projTemplate = generateFsProjectFile fileNames requires typ (Option.defaultValue "" flags)
let projTemplate =
generateFsProjectFile fileNames requires typ (Option.defaultValue "" flags)

let projPath = this.PathOf "project.fsproj"

Expand Down
7 changes: 5 additions & 2 deletions src/Visp.Compiler/Syntax/SynWriter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,18 +1187,21 @@ module Write =
match decls with
| decl :: rest ->
match decl with
| SynModuleDecl.HashDirective (ParsedHashDirective (ident, args, r), _) ->
| SynModuleDecl.HashDirective(ParsedHashDirective(ident, args, r), _) ->
indent w
lineof w r
indent w
fmtprintf w "#%s" ident

for arg in args do
space w

match arg with
| ParsedHashDirectiveArgument.String (it, _, _) ->
| ParsedHashDirectiveArgument.String(it, _, _) ->
char w '"'
string w it
char w '"'

()
| SynModuleDecl.ModuleAbbrev _ -> ()
| SynModuleDecl.Require _ -> ()
Expand Down
3 changes: 2 additions & 1 deletion src/Visp.Compiler/Syntax/Syntax.fs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ type ParsedHashDirectiveArgument =
| String(range = m) -> m

[<NoEquality; NoComparison>]
type ParsedHashDirective = ParsedHashDirective of ident: string * args: ParsedHashDirectiveArgument list * range: range
type ParsedHashDirective =
| ParsedHashDirective of ident: string * args: ParsedHashDirectiveArgument list * range: range

[<NoEquality; NoComparison; RequireQualifiedAccess>]
type SynModuleDecl =
Expand Down
6 changes: 5 additions & 1 deletion tests/Visp.ExecutionTests/TestUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ let CreateAndRunProject filePath =
let sb = new StringBuilder()

// https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-options#compiler-options-listed-alphabetically
generator.WriteVispFiles RuntimeLibraryReference.Package files (Some "--debug- --nooptimizationdata --optimize-")
generator.WriteVispFiles
RuntimeLibraryReference.Package
files
(Some "--debug- --nooptimizationdata --optimize-")

let dotnet =
Cli
Expand All @@ -55,6 +58,7 @@ let CreateAndRunProject filePath =

async {
let mutable succeed = false

try
let! result = dotnet.ExecuteAsync().Task |> Async.AwaitTask

Expand Down

0 comments on commit 9263555

Please sign in to comment.