Repository navigation
Description
Please Note: in order to satisfy community curiosity about this exciting set of new features, we are providing this snapshot of the current state of our planning. There are more details for us to figure out yet. You should expect to see us working on this in a few weeks.
Srivatsn worked over Christmas and did this:
This is F# colorized and with a lightbulb fixer implemented at the Roslyn workspace layer in Visual Studio. It uses Roslyn to handle the editing and the FSharp Language Service to parse the code. As we all know this model works and is well understood, TypeScript uses it for their editor experience. Currently not all of the APIs necessary are public, some are a bit ugly and need redesign, for now we should get an internals visible added to roslyn and allow the roslyn team to evolve a decent public Api for this based on our usage scenarios.
He maintains a branch here: https://github.com/srivatsn/visualfsharp/tree/roslynls By now it is based on quite an old branch fsharp compiler branch 303 commits behind (October 30th 2015)
I believe we all agree that scrapping our existing IDE experience and building on top of this mechanism is the best chance for Visual F# to try to keep up with the huge pace of IDE enhancements that Visual C# and VB are currently achieving. Also the IDE and fixer model will allow us to vastly improve the Visual F# error experience, because often the error isn’t at the line of code the compiler says, so we can create fixers that offer 4 or 5 solutions with preview to solve an error. The only real thing for discussion is how and when to take this forward. Building the editor gives us a solid foundation for creating an IDE experience that will work cross platform
We propose to:
- We add Sri’s prototype into the current master branch which targets DEV15
- We add a switch to the Visual F# IDE settings that enables this language service and disables the existing Visual F# language service, that will allow Visual F# early adopters and OSS devotees to try out the new IDE experience without losing all of their existing functionality
- We build the tooling on the newly integrated F# CompilerService APIs rather than the old FSharp.Compiler.LanguageService APIs.
- Priority is get to parity with existing IDE / language service
- To get to editor parity is probably not a lot of effort, the existing Visual F# IDE relies a lot on default editor behavior
Parity consists of:
- Colourization
- Intellisense
- Build integration
- Debugger integration
- Error reporting to error window
- Execute in FSI
- Brace matching
- Smart indent is currently wrong for the Roslyn prototype
- Encourage OSS contributions
Powertools
The existing Visual F# Power Tools may not work correctly in this new language service. We will encourage the powertools contributors to migrate their implementation to this new editor. Ideally they could contribute the implementation of many of the higher order features
Roslyn Features
Identify easily separable IDE features that already exist in Roslyn, and open up for grabs issues on fsharp repo to implement them, with pointers to existing Roslyn implementations. The rework will often be required because our AST is completely different from the Roslyn one.
- A ton of new tests will need to be created to ensure that experience is correct
- _Consider …. Implementing Editor TestApp support for Visual F# _
- This needs to be sharable at least in binary form with OSS community
- Once we reach parity, remove the switch and the Legacy Visual F# editor
Note:
- The initial work is to make language service switchable, this will allow Dev 15 previewers to continue to use current IDE code including the Visual F# Powertools, while also giving the ability to use the new one.
- The Visual F# PowerTools features will likely require porting to the new Roslynized language service (it is not yet known if they can coexist). Ideally they would be submitted as feature PR's but doing them as in add-in is a possibility too and so successfully working with the community to figure out the best way to package and work on these features is key to this being successful.
- The F# compiler service APIs have been integrated it into the Visual F# build which gives us a solid API to get information about the code.
- This approach may lead us towards a vscode/omnisharp integration strategy too, though projects such as FsAutoComplete also provide multi-editor integration
- Initially this will require us using Roslyn Internal APIs. The Roslyn team will be using our experience implementing this to figure out what needs to be public, and what the Public API shapes should look like.
I hope this gives you a taste of what we are thinking, it is not firmly committed yet, although we are all very excited about it and are very hopeful this will be the approach we take. Please don't read too much into any particular phrasing I have chosen. This is certainly a malleable project, and will evolve through our joint work.
Thanks
Kevin

Activity
cloudRoutine commentedon Jan 29, 2016
@KevinRansom did you catch this discussion a couple of weeks ago?
At first glance this new direction seems at odds with what we're moving towards with VFPT, but maybe you see a way for them to work synergistically?
@vasily-kirichenko @dungpa what do you guys think?
forki commentedon Jan 29, 2016
Since you were talking about VSCode integration. Please also talk to @Krzysztof-Cieslak who already brought excellent vscode support (from day 0!) and also atom support.
dsyme commentedon Jan 29, 2016
@cloudRoutine It would make sense for VFPT.Core to be brought in as a component here (and potentially be used to run compiler logic out of process).
Either way I'd expect that nearly all of the VFPT implementation could play a role in this toolchain: VFPT has seen a huge amount of use and the implementation does hundreds of important extra little logical things in interpreting the information coming from FCS. It's inevitable that it needs to be brought in as part of the story here.
@forki I think VSCode is a far off thing for this - a long term stretch goal - I'm not sure Roslyn Workspaces being used to host any editor inside VSCode as yet
[-]How to take forward the Srivatsn's Prototype of an F# editor based on Roslyn[/-][+]How to take forward the Srivatsn's Prototype of a Visual F# editor based on Roslyn[/+][-]How to take forward the Srivatsn's Prototype of a Visual F# editor based on Roslyn[/-][+]How to take forward the prototype of a Visual F# editor based on Roslyn[/+]cloudRoutine commentedon Jan 29, 2016
@dsyme I was hoping that'd be a possibility over
as it'd be unfortunate to lock the other editor and IDE options out further developments in F# tooling support. Otherwise it becomes a lot of redundant reimplementation of what are fundamentally the same tasks and the editors that don't have as dedicated maintainers fall by the wayside. Reducing the workload for maintainers of individual plugins, in my mind at least, is the most beneficial for the F# ecosystem. Then if someone wants to add F# to say Brackets or Kate there's a low threshold to gain a lot of functionality.
Krzysztof-Cieslak commentedon Jan 29, 2016
This point is bit worrying, but let's just assume it was some kind of bad phrasing.
I would just like to know what will be implications for FSharpCompilerServices project with this change:
I would also be interested what will be place of VFPT.Core (BTW, we should kick V out of this name) in all this - in issue linked by @cloudRoutine we've discussed possibility of using this core set of functionalities built on top of FCS across all editors (or rather F# extensions systems - so VFPT, Xamarin, FSAC). If I could suggest anything, building Roslyn API for VS on top of VFPT.Core could be really interesting, and potentially most benefit for whole community. So we would have following set up:
Credit to @cloudRoutine for fantastic graph ;)
dsyme commentedon Jan 29, 2016
@cloudRoutine All F# editor tooling will continue to see major improvements driven by the various contributors: F# is a multi-editor language and nothing changes in that. FCS, the Visual F# Power Tools "Core" components and FsAutoComplete are critical components in enabling good multi-editor support. They are totally part of the future. To varying degrees they will play a role here too.
Equally, the VIsual F# Tools will greatly benefit from a visual revamp based on Roslyn. It will be amazing to get that done - I can totally see the logic in this and am excited by it.
You are totally right to point out that the Visual F# Power Tools "Core" components are already there and ready to use to help enable much of this (however this applies less the "parity" features, which aren't covered by VFPT). I'm sure @otawfik-ms and @KevinRansom will be taking a close look at the VFPT Core libraries in order to get maximal engineering efficiency here - no one is interested in duplicating work.
This is about putting the core Visual F# Tools IDE work on a modernizing trajectory. It is especially modernizing from the perspective of the Visual F# Tools Team, who sit next alongside and in partnership with the overall Roslyn team, and who have seen the TypeScript team successfully adopt the Roslyn IDE APIs to good effect.
dsyme commentedon Jan 29, 2016
No. FCS as a component continues to be published as a nuget package from fsharp/FCS. @KevinRansom is referring to the enabling subset of the FCS APIs brought in by PR #853 - see that for details. That subset is needed no matter what work gets done in the Visual F# IDE Tools.
No, though it may drive additional improvements to FCS, much as VFPT and other clients has.
Also, note that the Roslyn APIs in question here are about implementing the "workspaces" or "IDE" APIs. As @KevinRansom mentions, TypeScript's VS tooling uses these. This hasn't made TypeScript as a language dependent on Roslyn (which is I think what you're concerned about, reading between the lines of your questions) except for the TypeScript VS tooling - which was easier to implement via this route.
dsyme commentedon Jan 29, 2016
@KevinRansom One question - "build integration" and "debugger integration" are partly or mostly handled by the F# Project System, which as I understand it is not being replaced by this work?
AFAIK the interactions of these features with the language service is as follows:
dsyme commentedon Jan 29, 2016
@KevinRansom One "parity" feature not mentioned is the navigation bar (off by default but turned on by the Visual F# Power Tools)
KevinRansom commentedon Jan 30, 2016
Everyone ...
We intend to use this approach to be able to leverage the work of the Roslyn IDE team as well as modernizing our IDE experience. We absolutely love the work of the powertools team and have a high degree of respect for the way they have driven forward the user-experience for F# developers. We are glad for their efforts and hope to be able to help them continue on the new IDE surface area. It is a certainty that the powertools could benefit from leveraging the Roslyn APIs a whole bunch of Visual Studio specific interface goo will evaporate from their codebase. However, the Roslyn APIs are not yet fully public in all of the useful areas ... they are open sourced, but they do not all have public visibility yet, we expect this effort to shine a light on a lot of APIs that will need to be made public. And I expect the Roslyn team to respond quickly to ensure that they are.
It has long been the plan of record that Roslyn cross platform tooling for VSCode will be accomplished by integrating the Roslyn Workspaces layer using OmniSharp; for us the nice thing about this approach is that we will automatically benefit from that work by interfacing this way. I am very excited to know that we may not have to even design some new editor features, knowing that a similar design already exists in Roslyn, we as a community may be in a position to adapt what they have and specialize it for F#.
The ability to have Roslyn style code fixers and Analyzers for F# code is an outstanding functional gain for our F# tooling. The amazing work by Krzysztof and also the Xamarin guys to build on the existing powertools Apis still exist and are still relevant and are still amazing. We desperately hope that the powertools will continue to be enhanced and will provide advanced F# Editor functionality appropriate to both our tools and also these other editors.
The way I think about these features is an attempt by us to make our tooling modern by capturing some of the Roslyn IDE excitement
@dsyme we can certainly consider adding the navigation bar to the @ parity list. Or it can be a community feature, either works.
I hope you find that this approach to our editors is exciting and something you will feel happy helping us to realize ... it is a certainty that we, the Managed Languages team, are very excited on about the opportunity to get started on this.
Kevin
isaacabraham commentedon Jan 30, 2016
+0.99 - certainly having seen the way that Typescript is supported in VS now with basically a superior OOTB experience to F# in such a short space of time sounds to me that the community can do great things with this approach. I've only done a tiny bit of work on VFPT so I can't claim to be an authority but as long as we keep the process lightweight and try to get reuse where possible across the existing VFPT toolchain etc. etc. then I'm all for this.
cloudRoutine commentedon Jan 30, 2016
@KevinRansom is there a rough idea when this VFT revamp is going to start?
3 remaining items
NumberByColors commentedon Feb 3, 2016
@enricosada No, this would just be the editor, not the project system.
eriawan commentedon Feb 4, 2016
@NumberByColors
Any plans to support Visual Studio CPS? I believe it's somehow linked with how F# overall experience from creating new project, coding and interacting with the IDE (including using Code Lens), to producing the final build (including file organizations, build order) and interacting with MSBuild.
Also I believe from this Andrew Arnott's blog the migrations are clear: moving forward to CPS.
PS: If you want, I'll open new issue instead for this Visual Studio CPS topic.
enricosada commentedon Feb 4, 2016
@eriawan see #496
I think CPS can be used with xproj and project.json (see #806 ). You can already do xproj but it's bugged because vs support for xproj is in flux because the migration from dnx to dotnet/cli. visualfsharp side there are some todo, like we need to read references list and pass that to language service ( from cps references or dotnet/cli project model, dont know ). But i opened an f# xproj and lot of stuff worked right.
NumberByColors commentedon Feb 4, 2016
@eriawan @enricosada At some point it would be great to revamp the project system, but as far as I know that's orthogonal to the editor revamp.
dsyme commentedon Jul 19, 2016
@oamsath OK, reopened :)
eriawan commentedon Jul 20, 2016
@NumberByColors @enricosada
Now that the decision about the demise of JSON project model I believe it's done (the VS and .NET Core team) that the model is going back to MSBuild project model, including the planned support for CPS.
Is there possibility that maybe xproj is being used for MSBuild Xplat? Do you guys know what will be the future roadmap of F# project model for Visual Studio tooling outside VS Code?
cartermp commentedon Jul 20, 2016
@eriawan Eventually the F# project model for Visual Studio will sit atop CPS. No timeline at the moment, though.
enricosada commentedon Jul 20, 2016
@eriawan just to distinguish the file project (fsproj/project.json) from project system (cps/current vf# code).
the xproj already works today ( no intellisense, only build/publish). But it's the vs project of project.json so it's going to die too (it's a msbuild target)
Xplat, I think, as project file is the fsproj run by netcore msbuild. Maybe I a bit modified to use ( the imported fsharp compiler target, not your fsproj ) a netcore task
The project system (vs ide) I hope the cps, but maybe the current one can run msbuild as it currently does
eriawan commentedon Jul 20, 2016
@cartermp
thanks for the info. Could we initiate a task or issue to track F# tooling and project model support for CPS? I'd love to track and contribute to it 😄
@enricosada
Yes, the current one .NET Core build can run MSBuild.
But I'm not sure for CPS on xproj-MSBuild, I haven't been able to build it successfully using the latest MSBuild from MSBuild latest build. I haven't visited to test it again, though.
Afaik, last time I checked the MSBuild repo at MSBuild github a month ago, there are no definite plan for CPS on X-plat. CMIIW...
cloudRoutine commentedon Jul 20, 2016
@eriawan it really depends on the underlying dependencies of CPS Core. It seems like they intend for it to be usable outside of VS (on windows at the least)
If the dependencies are all within the scope of the .net standard library it should be feasible to implement an xplat project engine for F# using CPS.Core.
dsyme commentedon Nov 26, 2016
Closing this discussion, we are well down this path