diff --git a/src/Visp.Compiler/FsharpGenerator.fs b/src/Visp.Compiler/FsharpGenerator.fs index ec14652..d504f8d 100644 --- a/src/Visp.Compiler/FsharpGenerator.fs +++ b/src/Visp.Compiler/FsharpGenerator.fs @@ -104,6 +104,7 @@ let private generateNuGetConfig () = """ + t.Trim() + Environment.NewLine | None -> @@ -117,6 +118,7 @@ let private generateNuGetConfig () = """ + t.Trim() + Environment.NewLine let private runtimeProjectOrPackageReference (typ: RuntimeLibraryReference) = @@ -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) @@ -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" diff --git a/src/Visp.Compiler/Syntax/SynWriter.fs b/src/Visp.Compiler/Syntax/SynWriter.fs index d477342..d9e3d0a 100644 --- a/src/Visp.Compiler/Syntax/SynWriter.fs +++ b/src/Visp.Compiler/Syntax/SynWriter.fs @@ -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 _ -> () diff --git a/src/Visp.Compiler/Syntax/Syntax.fs b/src/Visp.Compiler/Syntax/Syntax.fs index 46053f9..8c9a10e 100644 --- a/src/Visp.Compiler/Syntax/Syntax.fs +++ b/src/Visp.Compiler/Syntax/Syntax.fs @@ -431,7 +431,8 @@ type ParsedHashDirectiveArgument = | String(range = m) -> m [] -type ParsedHashDirective = ParsedHashDirective of ident: string * args: ParsedHashDirectiveArgument list * range: range +type ParsedHashDirective = + | ParsedHashDirective of ident: string * args: ParsedHashDirectiveArgument list * range: range [] type SynModuleDecl = diff --git a/tests/Visp.ExecutionTests/TestUtils.fs b/tests/Visp.ExecutionTests/TestUtils.fs index c17e9ec..d67171c 100644 --- a/tests/Visp.ExecutionTests/TestUtils.fs +++ b/tests/Visp.ExecutionTests/TestUtils.fs @@ -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 @@ -55,6 +58,7 @@ let CreateAndRunProject filePath = async { let mutable succeed = false + try let! result = dotnet.ExecuteAsync().Task |> Async.AwaitTask