Skip to content

Type Providers in scripts don't work with SOURCE_DIRECTORY #1409

Open
@isaacabraham

Description

@isaacabraham

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugscriptsProblems with .fsx files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions