Git Product home page Git Product logo

Comments (15)

deviousasti avatar deviousasti commented on May 24, 2024

I've been meaning to put that in for some time, although it's not very useful without concrete examples for before and after.
The options are here:
https://github.com/fsprojects/fantomas/blob/master/docs/Documentation.md

Do you have any good suggestions?

from fantomas-for-vs.

Evangelink avatar Evangelink commented on May 24, 2024

Ideally, having the description and a dynamic example which changes based on the value of the setting as it is done for ReSharper or C# code styles.

image

image

I would be happy to help here, this way I could learn the options and see if I want some tweaks to the default configuration :)

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

Any sort of help is appreciated!
These are the default options to be used if there's no .editorconfig file.

This is where the descriptions are specified.
https://github.com/deviousasti/fsharp-formatting-for-vs/blob/bdb75fa49d01a3eb5b6f6a84ad5dcb71a634ca16/src/FantomasOptionsPage.cs#L204

from fantomas-for-vs.

Evangelink avatar Evangelink commented on May 24, 2024

Let me dive back into VS option pages (I haven't used them in a while).

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

If you're free this weekend, we can work together on this. VS live share session?

from fantomas-for-vs.

Evangelink avatar Evangelink commented on May 24, 2024

Sorry @deviousasti I missed this notif, I might have some availability next week-end or at evening (CET timezone).

from fantomas-for-vs.

Evangelink avatar Evangelink commented on May 24, 2024

Regarding the Description, most of the entries are missing the [Description(XXX)] attribute which explains why there is no example.

I am still trying to find how to have the dynamic code example, looking at roslyn and some other repositories we might have to use a WPF page instead of WinForms.

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

Oh, sorry, I forgot to explain.
We're using this attribute to specify that VS needs to use this as an options page:

https://github.com/deviousasti/fsharp-formatting-for-vs/blob/bdb75fa49d01a3eb5b6f6a84ad5dcb71a634ca16/src/FantomasVsPackage.cs#L27
Which shows up the options in a property editor.

Adding a description attribute is one step forward, but it isn't sufficient for the Roslyn like experience.
We're going to have to recreate the configuration UI (checkboxes, dropdown, etc) in a WPF UserControl, and then add a set of examples for the options.

I've been working with WPF for 10 years now, so not a big deal.
If we add a custom attribute for the corresponding .editorconfig option, we can have a nice UI to generate an .editorconfig file as well.

from fantomas-for-vs.

Evangelink avatar Evangelink commented on May 24, 2024

Yeah the only problem for me so far is just to be able to include a TextEditor like component which will reuse all the formattings and colors from the F# configuration in the IDE. Maybe I am going a little too far and we could simply start with just a simple text (no colors + no IDE specific background color).

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

Yeah, that's probably a bit extreme for now. I have seen other extensions use AvalonEdit for displaying code, but that's a lot of stuff for this one feature.

If the examples are simple enough, coloring needn't be an issue.
Although... we're dependent on FCS and have to parse the examples anyway, so we could probably assign a colour per token, and it would be reasonable.

from fantomas-for-vs.

nojaf avatar nojaf commented on May 24, 2024

Hey Asti, I'm afraid I can't really add anything useful here.

Rider uses a custom editorconfig parsing thing, they added attributes for each setting as well: https://github.com/JetBrains/fsharp-support/blob/93ab17493a34a0bc0fd4c70b11adde02f81455c4/ReSharper.FSharp/src/FSharp.Psi/src/CodeFormatter/FSharpFormatSettingsKey.cs

Ionide does not have any UI for the settings.

Fantomas Online has a copy settings button when you change the defaults from the menu.
Example
That copies the .editorconfig settings to the clipboard.
But again no description.

from fantomas-for-vs.

Evangelink avatar Evangelink commented on May 24, 2024

@deviousasti How would you like to proceed, I start some PR and we contribute together?

Also I am wondering if you want to hardcode the various properties or if you want to actually read some configuration file and dynamically generate the settings page?

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

Well, no we can have some custom attribute on each property and use reflection to generate our UI.

Yeah the only problem for me so far is just to be able to include a TextEditor like component

I made this so we can have our cake and eat it too.

https://github.com/deviousasti/fsharp-highlighting

from fantomas-for-vs.

deviousasti avatar deviousasti commented on May 24, 2024

As for your branch, would I have commit access?

from fantomas-for-vs.

Evangelink avatar Evangelink commented on May 24, 2024

Sure!

That's a really nice idea you had to create a separate project for the highlighting, this will make it easier to share this across the F# tools.

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.