ionide-vscode-fsharp icon indicating copy to clipboard operation
ionide-vscode-fsharp copied to clipboard

Type Providers in scripts don't work with SOURCE_DIRECTORY

Open isaacabraham opened this issue 3 years ago • 3 comments

In a script, if you use Paket to generate load scripts and then try to reference a literal path for a type provider, using SOURCE_DIRECTORY breaks intellisense.

#load ".paket/load/netcoreapp3.1/main.group.fsx"

open FSharp.Data
[<Literal>]
let DealSample = __SOURCE_DIRECTORY__ + "/sample.json"

type Deals = JsonProvider<DealSample> // Deals = Object

If you remove the __SOURCE_DIRECTORY__ bit and just use sample.json, it all works with intellisense. However, at runtime it fails because FSI thinks that the current path is .paket/load/netcoreapp3.1.

Using __SOURCE_DIRECTORY__ used to work, so this feels like a breaking change.

isaacabraham avatar Aug 17 '20 12:08 isaacabraham

Hey @isaacabraham :wave:,

Thanks for backing our project. If possible, We will handle your issue with priority support. To make sure we don't forget how special you are, we added a backer label to your issue.

Thanks again for backing us :tada:!

@baronfel any ideas? Does this sound like something with resolving correct FSharpProjectOptions for script files, or something like that?

Krzysztof-Cieslak avatar Sep 01 '20 12:09 Krzysztof-Cieslak

Is this caused by https://github.com/dotnet/fsharp/issues/11610 ?

bigjonroberts avatar Oct 18 '21 22:10 bigjonroberts