Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve formatting of field with generics #47

Closed
belav opened this issue Mar 27, 2021 · 3 comments
Closed

Improve formatting of field with generics #47

belav opened this issue Mar 27, 2021 · 3 comments
Labels
area:formatting type:bug Something isn't working
Milestone

Comments

@belav
Copy link
Owner

belav commented Mar 27, 2021

public static Dictionary<Type,
    string[]> PropertiesByType = new Dictionary<Type, string[]>();
// should be
public static Dictionary<Type, string[]> PropertiesByType =
    new Dictionary<Type, string[]>();

There are probably also some edge cases around generics that aren't handled yet, because this feels like a weird way to break if it were too long by itself

public static Dictionary<Type,
    string[]>
@belav belav added type:bug Something isn't working area:formatting labels Mar 27, 2021
@belav belav added this to the Beta milestone Mar 27, 2021
@shocklateboy92
Copy link
Collaborator

shocklateboy92 commented Apr 3, 2021

Welll, it looks like prettier does this:

function withTypeArgs<
    LooooooongArgument1,
    LooooooooongArgument2,
    LooooooongArgument3
  >(
    someLongVarForTheHellOfIt: LooooooongArgument1<
      WithSubArg1<WithSubSubArg1, AndSubArg2>,
      AndSubArg2
    >
  ) {}

Which (I think) we can replicate pretty easily by using PrintArgumentListLikeSyntax().

@belav
Copy link
Owner Author

belav commented Apr 12, 2021

Possibly related

        private static readonly Func<SyntaxTrivia,
            bool> s_isVisualBasicCommentTrivia = (
            syntaxTrivia
        ) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia)

@belav belav modified the milestones: Beta, 0.9.5 May 28, 2021
@belav
Copy link
Owner Author

belav commented May 28, 2021

I broke off the Func<> example to #236
Trying to get the more basic cases formatting well is causing a bunch of existing formatting to change, so this isn't as easy as I originally hoped.

@belav belav closed this as completed in 3f0bb75 May 31, 2021
@belav belav modified the milestones: 0.9.5, 0.9.6 Jun 1, 2021
@belav belav changed the title Field with generics formats weird Improve formatting of field with generics Jun 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:formatting type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants