Repository navigation
Description
From time to time the various people involved in FSharp.Compiler.Service (FCS = http://github.com/fsharp/FSharp.Compiler.Service), Visual F# Tools (VFT = http://github.com/Microsoft/visualfsharp) and Visual F# Power Tools have been discussing what to do about moving VFT onto FCS. Currently the Visual F# Tools are a bit of an outlier in the F# universe since they are the only tooling not built on FCS. Eventual convergence here would be great.
Compared to the internal compiler service implementation in VFT, FCS contains a number things relevant to this discussion:
- bug fixes and some features relevant to symbol reporting
- the ability to check against library projects before the library project is compiled to a DLL on disk
- a virtualized file system to allow checking against buffer contents rather than on-disk files
- some changes to allow FCS to compile as a Silverlight component (these are likely to be discarded)
- a revamped SourceCodeServices API (see vs\service.fsi) including better resilience in some cases
- a revamped symbols API
- a revamped expression tree API to walk the resolved form of TAST expressions
- a hosted F# interactive component (there are a large number of changes in fsi.fs)
- additions to allow the correspondence between symbols in signature and implementation files to be established more accurately
- various modules like PrettyNaming are made public
- a couple of micro features pulled over from the http://github.com/fsharp/fsharp repo such as the
--gccerrorsflag
These features are nearly all used by the Visual F# Power Tools.
You can see the overall diff between FCS and VFT by comparing the src/fsharp and src/absil directories of Microsoft/visualfsharp (OOB) and fsharp/FSharp.Compiler.Service (master). FCS is a series of additions + deletions over fsharp/fsharp which in turn is a series of additions+deletions over VFT (see below for information about the "deletions")
Bringing all these changes back wholesale and immediately into VFT is not likely to be to the taste of Microsoft considering the status of VFT as a long-term enterprise supported toolkit. (That said, every other tool that ships F# editing capabilities effectively sits on all of this, so it's not entirely clear that Microsoft shouldn't as well, but that's ultimately up to the VFT owners at Microsoft. I expect they would want to take an incremental approach to this)
Achieving convergence can mean a number of things, here's the rough list of what's possible (though not all may be desirable):
- Ensure that we can integrate new compiler and language functionality from VFT --> FCS repos
- Ensure that the compiler implementations don't diverge by maximally aligning FCS and VFT through selective textual alignment
- (a) Build a version of FCS in VFT and use it to implement VFT OR
(b) Use the nuget packages of FCS to implement VFT - Bring back bug fixes in FSharp.Compiler.Service into Visual F# Tools
- Use FCS to implement new functionality in VFT
- Take functionality from Visual F# Power Tools and put it in VFT
- Publish a stable, known version of FCS as a public-facing component in Visual Studio, for the benefit of extra tooling like Visual F# Power Tools, and to halve the memory pressure on Visual F#
We have been able to do (1) for a while now.
Today I've submitted a set of somewhat tactical PRs to VFT to do much of (2). These are just preparatory work to reduce the overall diff between FCS and VFT. It's this work that's allowed me to write the catalogue of exactly what's in FCS above.
With this basis established, we can now consider what to from here. For example, there is a choice between 3a and 3b - do we build a private FSharp.Compiler.Service.dll in VFT and modify the Visual F# Tools to use the updated copy of the compiler service API? Or do we use the existing FCS nuget packages?
Because of the nature of VFT, it seems best to go down path 3a initially: Microsoft build a private copy of the FSharp.Compiler.Service.dll. Indeed, currently Microsoft VFT already does this: there two components which are similar to FSharp.Compiler.Service.dll: FSharp.Compiler.dll and FSharp.LanguageService.Compiler.dll. There is also a second small adhoc compiler API into FSharp.Compiler.dll used by the test infrastructure.
Aside: Why does Microsoft use two compiler DLLs? This is to do with memory footprint in Visual Studio:
FSharp.LanguageService.Compiler.dlldoesn't include some components like the IL binary writer and ILX code generator, hence a lower footprint because of a smaller NGEN image. However I was always sceptical about the value of this micro-optimization - saving a few MB of 32-bit address space - and this may no longer apply now VFT is shipped as a separate component to the rest of VS.
Personally I think the ideal outcome for step 3a would be to have VFT building one private compiler service DLL which includes the new FCS API.
Looking into the long term, I think it would be great if a future version of Visual Studio included a specific FCS DLL as a public facing component, or at least for specific use by the Visual F# Power Tools. But that's a long term goal and it's not on the roadmap for this repo yet, just an aspiration.
Aside: Why deletions? Roughly speaking http://github.com/fsharp/fsharp is a fork of http://github.com/Microsoft/visualfsharp which deletes all the vsintegration/... and some of the test suites that we can't easily run, and adds some features and tests relevant to cross-platform and Mono. http://github.com/fsharp/FSharp.Compiler.Service is a fork of fsharp/fsharp which deletes everything except the code under src/absil/... src/fsharp/... needed to build FSharp.Compiler.Service.dll, and adds the build scripts need to test and publish that component as a nuget package)
Activity
forki commentedon Aug 13, 2015
Thanks for the detailed explanation.
dsyme commentedon Aug 13, 2015
@latkin I pushed the combination of the four PRs to branch https://github.com/Microsoft/visualfsharp/tree/fcs. I think it's best to take the PRs one at a time though, so this is just a temporary combination branch in case you want to build and test that.
latkin commentedon Aug 13, 2015
Does the whole of the short-term FCS source alignment comprise those 4 PRs? Or should we expect more along these lines?
dsyme commentedon Aug 14, 2015
Yes, that's it for now. The remaining code differences nearly all represent substantive changes that represent new functionality in FCS that is relatively hard to isolate.
Note that you can also view these PRs as a very thorough code review of FCS - I've been going over it line by line for the past 24 working hours - snipping out the non-functional changes and leaving the substantive changes (bug fixes, new functionality, revamped API, symbol API, expression API, hosted F# Interactive). So the code in the PRs is not fresh code - it's code I've scrutinized carefully and considered the pros/cons of aligning by making a change to FCS or to VFT.
Getting these PRs into Microsoft\visualfsharp will really help keeping these repos in line and put us in good shape to make progress on the goals above when we choose to.
enricosada commentedon Aug 20, 2015
great @dsyme, i'd like to see more of these long term alignments and cleanup 😄 👍
Long term i hope there is an out of process service (like roslyn, out of vs process, easier to debug/profile for performance and usefull for other ides ), and VFT and VFPT (and others ide integrations ) are clients.
dsyme commentedon Apr 14, 2016
closing old discussion, since this phase of FCS alignment work is done