Comments (21)
I understand the importance of MonoDevelop and Xamarin Studio support.
At the moment I use a private build of F# compiler 3.0 assembly and do pattern matching directly on F# ASTs. Could you explain how it would work if we use reflective soft binding? I imagine it's a huge change and it's a pain to get it working.
from fantomas.
Depending on what features of the compiler you are using, the majority of the work might already be done. The bulk of the work would be converting fantomas to produce its output in a form thats applicable to the MonoDevelop IDE interfaces, you would probably find this with VS too. A common code base usable by both would emerge.
from fantomas.
Once you start adding features like this you should bundle the compiler DLL. You don't have to call it FSharp.Compiler.dll - better to call it FSharp.Compiler.Editing.dll or the like (and it should certainly have a different strong name key).
from fantomas.
I prefer to bundle the compiler DLL. It's easier to work with and easier to make changes.
@dsyme: any suggestion on how to keep them in sync with F# open source compiler repository? I think lexers and parsers are less likely to change, but the compiler itself is improved from time to time.
from fantomas.
@dsyme Are also alluding to building with the bundled compiler too? Otherwise a discrepancy could creep in between build output and editor formatting.
from fantomas.
Well, I don't think you should ship a GAC'd binary-replacement of FSharp.Compiler.dll. That's a Visual Studio/Mono/... component and you should not try to replace those at this stage.
It is also pretty much impossible to ship an isolated compiler you use for building from XS, because XS uses "msbuild"/"xbuild", which locate the compiler vis FSharp.Build.dll, in the location pointed to by Microsoft.FSharp.targets. So I believe that means you can't usefully ship an fsc.exe.
You might eventually fold things back into the core FSharp.Compiler.dll, but you can't rely on those updates being in the F# compiler installed on the target system.
So I think you just have to live with what's on the machine for building F# code.
This means your only option is to bundle an FSharp.Compiler.Editing.dll with functionality suitable for formatting, type-checking, refactoring etc. over some particular version(s) of F# (currently F# 3.0). For each feature you get to use either functionality in the FSharp.Compiler.dll on the machine (via soft-binding) or functionality in FSharp.Compiler.Editing.dll (via hard-binding). Currently I'd suggest formatting comes from FCE.dll and the other functionality comes from FC.dll. That keeps the risk risk of discrepancy in type-checking low.
If your work is a branch or fork of http://github.com/fsharp/fsharp then you will be able to update this to F# 3.1 when it comes out.
from fantomas.
I have a feeling that adding more load on the soft binding (better tokenisation support) will cause it to creak at the seams. A hard binding for all editor support including intellisense and autocompletion would be my preference, relying on the soft binding for compilation only. This would mean stripping out the current implementation(In the F# binding) for a more dedicated full editor support for Xamarin Studio.
from fantomas.
@dungpa We've talked about FSharp.Compiler.Editing.dll
and its still on my list :)
What about adding this to the F# binding in MonoDevelop/XS are you ok with me referencing the Nuget package and including it? (Thats if the API is usable as is from MonoDevelop)
from fantomas.
Yes, please do so.
I imagine there are major changes before you can integrate formatting commands to F# binding seemlessly.
from fantomas.
@7sharp9 @rneatherway I published Fantomas 1.0.0 on NuGet, which depends on FSharp.Compiler.Editor. Let me know what I can help to integrate this to FSharpBinding. Thanks.
from fantomas.
It would be great to have it integrated! We are just working on cutting the
binding over to FSharp.Compiler.Editor as well, so once that is done we can
look at this.
On Tue, Jul 16, 2013 at 8:22 AM, Anh-Dung Phan [email protected]:
@7sharp9 https://github.com/7sharp9 @rneatherwayhttps://github.com/rneatherwayI publish Fantomas 1.0.0 on NuGet, which depends on FSharp.Compiler.Editor.
Let me know what I can help to integrate this to FSharpBinding. Thanks.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-21025390
.
from fantomas.
At the moment I don't even have the time to think about it, first step would be to build an F# GUI that can drop into Xamarin studio to hold the required settings:
After that it a matter of either:
a) Choosing to integrate formatting similar to C# with code policies, this would mean a copy paste would reformat the pasted code etc.
b) A simple context command: Format selection, Format Document.
Dave.
from fantomas.
@ovatsus When the hard binding is in place inside FSharpBinding, would you like to take a look at integrating Fantomas? If you're too busy, I can start working on that in January.
from fantomas.
It's already on my todo list. I'll also update the NuGet package to the latest master in the process. Is the version on the VS gallery already up to date? BTW, we should really sync up both version numbers, otherwise it's confusing
from fantomas.
Yes, the version on the VS gallery is up to date (except your two recent bug fixes).
Two version numbers are indeed confusing. We should increase the version in VS gallery to catch up with the one in NuGet package.
from fantomas.
@dungpa My hardbinding had been merged to master now.
from fantomas.
Can you publish a new version on the gallery with my two bugfixes as 1.0.3? I'll publish the equivalent NuGet package. Also, make sure you build it against FSharp.Compiler.Editor 1.0.7, which is the one being in use in fsharpbinding
from fantomas.
@ovatsus Done.
@7sharp9 I thought it was an ongoing process since fsharp-refactor pull request hasn't been merged yet.
from fantomas.
The hardbinding part is merged in, refactoring is a separate thing.
from fantomas.
@ovatsus One of the first steps is adding bit of GUI to display F# formatting options, I mentioned that above.
from fantomas.
Not the fastest way to get in but the feature got merged into FSharpBinding yesterday fsprojects/zarchive-fsharpbinding#604.
from fantomas.
Related Issues (20)
- Equals sign should only be on same line if last tuple is multiline HOT 2
- Return type should go on next line
- Invalid F# code after formatting HOT 1
- Formatting removes necessary additional closing brackets for multiline interpolated strings HOT 1
- Fantomas reports an error when formatting interpolated string with tripple quotes HOT 7
- Idempotency problem when _.Property shorthand
- Regression: Stroustrup bracket style in anonymous record type parameter is not respected
- HashDirective before closing `]`
- Long parameter attribute gives weird line break before type annotation
- Fantomas corrupts an explicit constructor with `then` clause HOT 2
- FormatASTAsync loses single quotes for characters HOT 4
- Regression: An empty line or comment at the end of a list breaks Stroustrup formatting HOT 2
- `SpaceBeforeUppercaseInvocation` corrupts underscore lambda invocation HOT 1
- Non needed parentheses are added around lambda call from tuple/members HOT 3
- [Feature request] Make newline experience consistent across match branches HOT 1
- Make Fantomas AOT compatible HOT 12
- cannot determine if Expr AppSingleParenArg Fantomas.Core.SyntaxOak+ExprAppSingleParenArgNode is uppercase or lowercase HOT 1
- cannot determine if Expr AppSingleParenArg Fantomas.Core.SyntaxOak+ExprAppSingleParenArgNode is uppercase or lowercase HOT 2
- [Feature request] Keep `interface end` on a single line HOT 1
- Regression since 6.3.5: Shorthand lambda pushes args far out right with name-sensitive alignment; discrepancy with normal lambda HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fantomas.