fsprojects / FsReveal

FsReveal parses markdown and F# script file and generates reveal.js slides.
http://fsprojects.github.io/FsReveal
258 stars 100 forks source link

Use optional parameters and allow speechifying FSI evaluator (2.) #53

Closed tpetricek closed 9 years ago

tpetricek commented 9 years ago

This is a corrected version of #51.

The issue was that test runner couldn't find FSharp.Compiler.Interactive.Settings.dll (which FCS currently requires) and that it was not able to load FSharp.Core.dll (looks like the file was locked, or something). The first is fixed by adding reference with CopyLocal=true and the other is fixed by changing CopyLocal to false for FSharp.Core.dll (this is a bit odd, but I had the same issue in F# Formatting).

Tests now run fine on my machine!

forki commented 9 years ago

much better. thanks

forki commented 9 years ago

Is there a chance to get your idea into the docs? Maybe like the included slides in http://fsprojects.github.io/FsReveal/formatting.html?

tpetricek commented 9 years ago

Yep, I'll do that!

The DSL I wrote for my talk is quite basic and incomplete, but it might be interesting for others playing with FsReveal. Do you have any thoughts on where & how we could put it? I guess I can use simpler example in the docs and then link to the source code in my repo: https://github.com/tpetricek/Talks/blob/master/2015/literate-programming/tomas/svg.fsx

forki commented 9 years ago

Slides files in https://github.com/fsprojects/FsReveal/tree/develop/docs/slides are automatically build and pushed to gh-pages

then you can link from https://github.com/fsprojects/FsReveal/blob/develop/docs/content/formatting.md to the presentations.

forki commented 9 years ago

I still have issue locally.

image

fixed it for me. Okay?

tpetricek commented 9 years ago

This would change the behavior so that code is not evaluated unless you specify the evaluator explicitly. Is that what we want?

The previous behavior was to automatically create an evaluator for FSX files but not do that for MD files. I guess doing the same thing for both is a good idea, but we can go either way.

What issues are you getting locally?

forki commented 9 years ago
    System.Exception : Error creating evaluation session: StopProcessing "{Exception = AssemblyNotResolved;
     Phase = Interactive;}"
       bei Microsoft.FSharp.Compiler.Interactive.Shell.-ctor@2448-116.Invoke(String message) in C:\GitHub\fsharp\FSharp.Compiler.Service\src\fsharp\fsi\fsi.fs:Zeile 2448.
       bei Microsoft.FSharp.Core.PrintfImpl.go@523-3[b,c,d](String fmt, Int32 len, FSharpFunc`2 outputChar, FSharpFunc`2 outa, b os, FSharpFunc`2 finalize, FSharpList`1 args, Int32 i)
       bei Microsoft.FSharp.Core.PrintfImpl.run@521[b,c,d](FSharpFunc`2 initialize, String fmt, Int32 len, FSharpList`1 args)
       bei Microsoft.FSharp.Core.PrintfImpl.capture@540[b,c,d](FSharpFunc`2 initialize, String fmt, Int32 len, FSharpList`1 args, Type ty, Int32 i)
       bei <StartupCode$FSharp-Core>.$Reflect.Invoke@720-4.Invoke(T1 inp)
       bei Microsoft.FSharp.Compiler.Interactive.Shell.FsiEvaluationSession..ctor(FsiEvaluationSessionHostConfig fsiConfig, String[] argv, TextReader inReader, TextWriter outWriter, TextWriter errorWriter, Boolean fsiCollectible) in C:\GitHub\fsharp\FSharp.Compiler.Service\src\fsharp\fsi\fsi.fs:Zeile 2448.
       bei Microsoft.FSharp.Compiler.Interactive.Shell.FsiEvaluationSession.Create(FsiEvaluationSessionHostConfig fsiConfig, String[] argv, TextReader inReader, TextWriter outWriter, TextWriter errorWriter, FSharpOption`1 collectible) in C:\GitHub\fsharp\FSharp.Compiler.Service\src\fsharp\fsi\fsi.fs:Zeile 2702.
       bei FSharp.Literate.FsiEvaluator..ctor(FSharpOption`1 options) in c:\Tomas\Public\FSharp.Formatting\src\FSharp.Literate\Evaluator.fs:Zeile 117.
       bei FsReveal.FsReveal.getPresentationFromMarkdownLines(FSharpOption`1 mdFile, FSharpOption`1 fsiEvaluator, String[] lines) in D:\code\FsRevealDevelop\src\FsReveal\FsReveal.fs:Zeile 45.
       bei <StartupCode$FsReveal>.$FsReveal.GenerateOutputFromMarkdownFile@86.Invoke(Unit unitVar0) in D:\code\FsRevealDevelop\src\FsReveal\FsReveal.fs:Zeile 87.
       bei FsReveal.FsReveal.checkIfFileExistsAndRun(String file, FSharpFunc`2 f) in D:\code\FsRevealDevelop\src\FsReveal\FsReveal.fs:Zeile 50.
       bei FsReveal.FsReveal.GenerateOutputFromMarkdownFile(String mdFile, String outDir, FSharpOption`1 outFile, FSharpOption`1 fsiEvaluator) in D:\code\FsRevealDevelop\src\FsReveal\FsReveal.fs:Zeile 86.
       bei FsReveal.FsRevealIntroTest.can create intro twice() in D:\code\FsRevealDevelop\tests\FsReveal.Tests\FsRevealIntroTest.fs:Zeile 16.

11 broken tests

forki commented 9 years ago

this is using nCrunch btw

tpetricek commented 9 years ago

This is failing because the F# Compiler Service (called by FsReveal to evaluate snippets) cannot find some of the referenced assemblies - same error I had. Do you get the failure when running tests from the console? (That worked for me. I also tried TestDriven.Net's "Run tests in debugger" which works too).

We could just not run the evaluator in the tests, but that might not be what we want... (it took me long time to configure tests so that they work in F# Formatting - but I have no idea how I did it)

forki commented 9 years ago

yep console works, but ncruch is copying everything to their own space

tpetricek commented 9 years ago

Does it copy (1) FSharp.Compiler.Interactive.Settings.dll and (2) FSharp.Core.dll?

For TestDriven.NET, I had to change things so that it copies (1) but not (2). It would be kind of unfortunate if test runners required mutually exclusive combination of DLLs.

forki commented 9 years ago

how about using FSharp.Core nuget package?

tpetricek commented 9 years ago

The issue I had - as far as I can tell - was that Visual Studio was somehow locking FSharp.Core.dll during the build (I guess??) and so the compiler service was not able to load it.

Does NCrunch work if you change the setting for FSharp.Core.dll so that it is copied to the output folder? (If so, then I'll see what is causing the locking on my machine...)