Skip to content

Only capitalise the Module name instead of changing its case completely #111

@MangelMaxime

Description

@MangelMaxime

Describe the bug

Right now when loading a generator/loader Fornax transform the name of the file using textInfo.ToTitleCase meaning that if the user write postLoader.fsx it will be transformed into Postloader for the open instruction.

From what I see, when using #load "postLoader.fsx" the name of the module generated by the F# compiler is PostLoader meaning that it only capitalise the name of the file.

Can we change

let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    let textInfo = (CultureInfo("en-US", false)).TextInfo
    textInfo.ToTitleCase filename

to

let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    let textInfo = (CultureInfo("en-US", false)).TextInfo
    string (textInfo.ToUpper filename[0]) + filename[1..]

// or this one as I am not sure if the CultureInfo is required
let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    (string filename[0]).ToUpperInvariant() + filename[1..]

Doing this change would allow the user have better naming for its files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions