Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Fable provide a version of FSharp.Compiler.Service? #3264

Open
njlr opened this issue Nov 10, 2022 · 6 comments
Open

Does Fable provide a version of FSharp.Compiler.Service? #3264

njlr opened this issue Nov 10, 2022 · 6 comments

Comments

@njlr
Copy link
Contributor

njlr commented Nov 10, 2022

Does Fable provide a version of FSharp.Compiler.Service?

If so, what version is it?

And are any notable features not supported?

@alfonsogarciacaro
Copy link
Member

The FCS embedded within dotnet fable tool is almost the same as the "official" with a few minor tweaks to help watch compilations, so they shouldn't be unsupported features (as long as we keep FCS in sync).

Unfortunately, it's tricky to provide a version because @ncave just syncs periodically with dotnet/fsharp/main, sometimes this means Fable provides feature before a new FCS package has been released. But it's true at least we should provide a commit hash 😅

@alfonsogarciacaro
Copy link
Member

Sorry, closed by mistake. Please feel free to make further questions or suggestions.

@kant2002
Copy link
Contributor

I have similar question of slightly different nature. Why there 2 verison of FSC in Fable repo.

@ncave
Copy link
Collaborator

ncave commented Mar 14, 2023

@kant2002

  • lib/fcs is a light FCS façade, consumed by Fable .NET as binary assembly dependency.
  • src/fcs-fable is a trimmed down FCS version that can actually be compiled by Fable to JavaScript.
    It's used in the Fable REPL and for the JS-only stand-alone version of the Fable compiler that can work even without .NET installed (but 3x slower than the managed .NET version of Fable, of course).

Both of these forks are frequently rebased to dotnet/fsharp latest, so should be up to date.
Those updates are not aligned to specific FCS versions, they generally track the latest F# main.

@kant2002
Copy link
Contributor

Is there a way how, for example light FSC facade` can be upstreamed or being depends on vanilla FSC from some version nfrom F# main. Reason why I'm asking is that I have experiment on creation of F# dialect based on Ukrainian keywords. Frankly it's easy and I do that in my own fork. NP. I did try to customize Fable Repl to use my F# fork. That was successful, but now I have

  • my own fork
  • my own fork merged with ncave/fsharp
  • apply my custom keywords to fsc-fable/src/Compiler
    which is quite fragile.

Reason why I speculate that maybe ncave/fsharp can be not used is initially I miss instructions in lib/fsc folder and try to replace content of lib/fsc using my own fork once I change FSharp.Compiler.SourceCodeServices to FSharp.Compiler.CodeAalysis and InteractiveChecker to FSharpChecker I was missing only some small bit which I did not figure out. So for my uninitiated view maybe that's possible?

Would this kind of attempt to unify at least one location desirable?

@ncave
Copy link
Collaborator

ncave commented Mar 14, 2023

@kant2002 It's unlikely that either of those F# forks that Fable uses can be pushed upstream (although I did try, unsuccessfully, way back in the past), as they mainly provide functionality to Fable.

That said, those forks can be fairly easily rebased on top of (or below) your custom FCS version (if your FCS is recent enough, as there is a lot of churn in dotnet/fsharp).

You don't have to modify src/fcs-fable directly, you can just copy its contents from your (rebased) fork. See npm run build copy-fcs-repo, which copies source from Fable-compatible F# fork to Fable src/fcs-fable. Make sure to build your FCS fork first, see here.

P.S. Replacing the F# keywords sure looks fun, was this the only change needed in dotnet/fsharp?
It also needs support from the language service for syntax coloring etc, but that should be easy too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants