Tarmil / FSharp.Data.LiteralProviders

F# Type providers generating literals from the compile-time environment
MIT License
135 stars 6 forks source link

Fable support #24

Open JaggerJo opened 2 years ago

JaggerJo commented 2 years ago

First, super cool - think this is the only type provider I'd use in a production app.

The following code compiles fine in .net 6 but fails when compiled with fable.

module LanguageInfo = 
    let [<Literal>] json_blob = FSharp.Data.LiteralProviders.TextFile.``Language_ISO_list.json``.Text
error FSHARP: This is not a valid constant expression or custom attribute value (code 267)
error FSHARP: This is not a valid constant expression (code 837)
error FSHARP: The type 'TextFile' does not define the field, constructor or member 'Language_ISO_list.json'. (code 39)
error FSHARP: The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result. (code 588)
Tarmil commented 2 years ago

I'm guessing maybe the Fable compiler runs from a different folder, which is why it can't find the file. Can you figure out where it is based on the completions available on TextFile. ?

JaggerJo commented 2 years ago

Fable is only invoked when compiling, IDE tooling (and completions) come from .NET