Git Product home page Git Product logo

Comments (18)

deviousasti avatar deviousasti commented on May 24, 2024 5

image

A dozen commits later, I've released version 0.8, which supports both bleeding edge and stable in a single extension. This can be changed in "Options > F# Formatting > Build Version". It defaults to stable (4.3.0 right now).

I believe this should be sorted for the immediate future.
Perhaps, a future addition can be the warning of an older tool version, or using the specified tool version to format.

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024 2

@OkkeHendriks That's the plan. Although the implementation is slightly complicated because a number of types and libraries are incompatible between 4.3 and 4.4.

The biggest problem is that the nuget package uses an older version of FCS and this is something I need to control.
I also publish F# Linting for VS which uses a newer version of FCS, and it's sure to break it for anyone if I publish it.

Additionally, 4.3.0 uses an additional package called Fantomas.Extras (which was removed in 4.4) - which depends on a number of other packages.
I've pushed a release here (https://github.com/deviousasti/fsharp-formatting-for-vs/releases/tag/v0.7.4).

Please manually install it for now. I'll try to sort out the dual version this weekend.

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024 1

Hi Okke,
I see your conundrum. Yes, the mismatch is an issue.
There are ~1400 test cases, so my assumption is that a newer version which passes the existing tests, is assumed to be "more" correct. And this is all in a single assembly, so it likely won't be possible to have that as a setting in .editorconfig.
But it's difficult to keep the tool versions constantly updated.

How about I add an option to try and use the version present in dotnet tools?
Would that work out?

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024 1

Yes, it does. That window opens when you don't have fantomas installed either globally or locally for the files which you're currently editing.

from fantomas-for-vs.

OkkeHendriks avatar OkkeHendriks commented on May 24, 2024

Yes I think that would definitely help!

When you say 'use the version present in dotnet tools' do you mean that it verifies that the versions match or would it be possible to actually use the dotnet-tool/apply a different version?

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

Verifying that the versions match might not be potentially very useful, because most of the time, they likely won't match up exactly.
It's a bit more nuanced, I think.
Suppose there's a solution with two projects

Solution
├───Project 1
│   └─── dotnet-tools.json
│   └─── File1.fs

├───Project 2
│   └─── dotnet-tools.json
│   └─── File2.fs

When you format File2.fs, you should be formatting it with the version defined under Project 2, correct?

from fantomas-for-vs.

Fedda avatar Fedda commented on May 24, 2024

We have the same problem:
"We found a mismatch in the resulting formatting due to the fact that the tool was pinned on 4.3.0, while the extension was 0.7.3, build against fantomas 4.4.0."
I did manage to build the F# Formatting tool with fantomas 4.3 (the latest stable version) and the problem was gone.
It would be nice if you could create an version of the tool (F# formatting) using the latest stable version.

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

@OkkeHendriks Would this be able to solve your problem as well? (temporarily)

from fantomas-for-vs.

OkkeHendriks avatar OkkeHendriks commented on May 24, 2024

Yeah, I think this will help. With extension 0.7.3 and fantomas-tool 4.4.0-alpha-001 we still see another discrepancy in formatting. Apparently 0.7.3 was not build against that exact version of the tool.

While trying to find the exact version the extension uses I could not find the tag 0.7.3? Anyhow it seems to be build against whatever HEAD of fantomas is at the moment of building via the submodule. I am not too familiar with git submodules but isn't it possible to pin the version there?

Ah, I now see your latest commit (ce86917 ). Do you plan to build stable with the nuget package and bleeding edge using the submodule?

from fantomas-for-vs.

svdijk avatar svdijk commented on May 24, 2024

Thanks for making the v0.7.4 release available for direct download here on GitHub. Could you perhaps do this for future releases as well?

This would be useful, since it will allow easy downloading and installing of a specific version (as far as I know this isn't currently possible from Visual Studio Marketplace). Combined with disabling automatic updates, this will allow manual syncing of fantomas-tool and F# Formatting versions, if need be.

(I'm on the same project team as @OkkeHendriks by the way.)

from fantomas-for-vs.

OkkeHendriks avatar OkkeHendriks commented on May 24, 2024

Thank you very much for your quick work, installing it right now!

I was browsing through the diffs and this caught my eye.
https://github.com/deviousasti/fsharp-formatting-for-vs/blob/3a8d9b8f08d3b08d048572572fd4c70fdb58f22c/src/FantomasHandler.cs#L283
Shouldn't there be a branch between StableCodeFormatter and LatestCodeFormatter there?

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

That's just a convenience method which calls FSharp.Compiler.Range.mkRange, so the behavior shouldn't change. But good spotting, nonetheless.

from fantomas-for-vs.

peterhirn avatar peterhirn commented on May 24, 2024

I'm having this issue now with version 4.6.0-alpha-007

How about I add an option to try and use the version present in dotnet tools?
Would that work out?

This would be the perfect solution for me.

from fantomas-for-vs.

nojaf avatar nojaf commented on May 24, 2024

Hello @peterhirn, we are looking for some help in #21 if you are interested.

from fantomas-for-vs.

xperiandri avatar xperiandri commented on May 24, 2024

image
Does this window open from this extension?

from fantomas-for-vs.

xperiandri avatar xperiandri commented on May 24, 2024

It is a typo in it

from fantomas-for-vs.

xperiandri avatar xperiandri commented on May 24, 2024

So at the end, will you migrate to #21 and not use the global tool?

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

@xperiandri #21 has been implemented. Global tool is only used as a fallback, in case the repository doesn't have fantomas installed. This is what's expected to happen when you format isolated files, like a script file.

from fantomas-for-vs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.