tomasr / viasfora

A Visual Studio Extension containing miscellaneous improvements to the editor.
Other
556 stars 90 forks source link

Rainbow Braces for generics #177

Open ghigad opened 8 years ago

ghigad commented 8 years ago

It would be great if Rainbow Braces would also process generics.

I use C# and I sometimes have some very complex generic expressions because of how a framework I use works. It would make my life easier if Rainbow Braces also processed generic brackets.

Here is an example where Rainbow Braces would be very useful.

            resourcesToExportQuery = new PXSelectJoin<LocalizationResource,
                LeftJoin<LocalizationResourceByScreen,
                    On<LocalizationResourceByScreen.idValue,
                        Equal<LocalizationResource.idValue>,
                        And<LocalizationResourceByScreen.idRes,
                            Equal<LocalizationResource.id>>>,
                    LeftJoin<LocalizationTranslation,
                        On<LocalizationTranslation.idValue,
                            Equal<LocalizationResource.idValue>,
                            And<LocalizationTranslation.idRes,
                                Equal<LocalizationResource.id>,
                                And<Where<LocalizationTranslation.locale, IsNull,
                                    Or<LocalizationTranslation.locale,
                                        Equal<Required<LocalizationTranslation.locale>>>>>>>,
                        LeftJoin<SiteMap,
                            On<SiteMap.screenID,
                                Equal<LocalizationResourceByScreen.screenID>>>>>,
                Where<LocalizationResource.idValue,
                    Equal<Required<LocalizationResource.idValue>>>,
                OrderBy<Asc<LocalizationResource.resKey,
                    Asc<LocalizationResourceByScreen.screenID,
                        Asc<LocalizationTranslation.locale>>>>>(this);
Mikaka27 commented 7 years ago

I second that for generics and also c++ template code.

tomasr commented 7 years ago

It is something I've been wanting to add for a long time, but I haven't figured out how to get it working, as Viasfora relies strictly on lexical analysis and that's not really enough to figure this out.....

Mikaka27 commented 7 years ago

I'm not familiar with roslyn api's at all but they could help a little right? (Atleast for .Net languages)

tomasr commented 7 years ago

Roslyn would help in the sense that it would allow Viasfora to examine the syntactic model and not just the lexical model. However, there are several complex issues:

I may revisit the Roslyn model again in the future, but it's not something I'm keen on doing right now :(

Mikaka27 commented 7 years ago

Ok I'm not bothering you anymore about this then. Thanks for clarification. I've added a question about this in the extension review (on marketplace), please ignore it then.

tomasr commented 7 years ago

Oh, it's no bother, I love getting feedback and suggestions :) I will keep this issue open for now, and keep checking if I can find a way to implement it.

fourpastmidnight commented 7 years ago

As much as this would help with C#, it would also help with TypeScript! +1!

tomasr commented 7 years ago

@fourpastmidnight It would help with all sort of languages, but I admit I still have no good way to get this done. For C#, I've though about a way to extend this with Roslyn. but it would very likely need to be a separate extension, somehow, and not sure how to get both things working in tandem :smile: