FSharp Template interfering with Add New Class in C# app #251

Closed
mwhitis opened this Issue Apr 8, 2015 · 19 comments

Projects

None yet

4 participants

@mwhitis
mwhitis commented Apr 8, 2015

I've got SideWaffle 1.16 from 3/10/15 installed on VS 2013 SP4.

After the installation, the "Add New Class" functionality is broken via the right-click menu item and the shortcut (shift+alt+c) in a C# app. Instead of opening the "Add New Item" window, with Class selected, as expected, I get the Add New Item Window, with FSharp selected.

image

The only thing under the FSharp menu is the SideWaffle Template.

image

If I disable SideWaffle, the functionality goes back to being as expected.

@RandomlyKnighted
Member

@mwhitis I've been noticing this too. I'm not aware of any changes that should have affected this, but I'll look into it.

@sayedihashimi any suggestions on what might have made this change?

@RandomlyKnighted RandomlyKnighted self-assigned this Apr 8, 2015
@kentcooper
Member

Strange thing is that F# template shouldn't even be included. It's suppose to exclude templates that start with an underscore.

@sayedihashimi
Member

Can you try it with the latest version from sidewaffle.com? I just downloaded and cannot repro it. Maybe we published a bad build out there. That shouldn't happen anymore since we have now automated the publish process.

@kentcooper
Member

I can reproduce it. It only happens for me on Web Projects though.

@sayedihashimi
Member

I just deleted the item template. It was just a sample anyway.

@sayedihashimi
Member

Once the release build https://ci.appveyor.com/project/sayedihashimi/side-waffle/build/1.0.184 completes it should be published, will close after I verify it.

@kentcooper
Member

I did some digging on TemplateBuilder and it doesn't actually exclude templates that start with underscore. It excludes templates that start with _Sample. I tried it on my local and Add Class is still broken. It just picks the Visual Basic template now instead of the F# one.

@sayedihashimi
Member

@kentcooper oh ok, my bad.

@kentcooper
Member

@sayedihashimi okay so I messed around with this for the past couple hours and as far as I can tell it has to do with the order the languages are displayed in. In a web project with SideWaffle installed for whatever reason the non native language is displayed first. And it seems that add>class is trying to pick a template called Class from the first language in the list and the class template isn't there.

@RandomlyKnighted RandomlyKnighted removed their assignment Apr 9, 2015
@sayedihashimi
Member

Yeah Web projects have a custom implementation for Add Class. It seems like there may be an issue with that. I've never heard it reported before so I think it's not a common scenario.

Here is a build with that sample template included https://dl.dropboxusercontent.com/u/40134810/SideWaffle/issue-251/TemplatePack-582e9f55.vsix.

@kentcooper
Member

Well I have a potential work around. If you use the AppliesTo element in the template definition to actually filter the languages so that the VB templates aren't showing up on the C# project and vice versa than it seems to resolve the problem. Problem is that's a lot of templates that need updating.

@sayedihashimi
Member

I didn't realize AppliesTo would make VB templates show up for C#. I thought AppliesTo was about the project type, so that is strange.

@kentcooper
Member

Well most of the AppliesTo elements on the Web and Misc types are set to <AppliesTo>ABC | (!ABC)</AppliesTo> Which causes them to show up in the New Item Dialog for every project type. If we change that to <AppliesTo>CSharp</AppliesTo> in the CSharp.vstemplate and <AppliesTo>VisualBasic</AppliesTo> in the VB.vstemplate files that would cause them not to show up in the dialog except for the specific projects.

@sayedihashimi
Member

@kentcooper ok I think I see what you are saying.

Here is what I think we should do.

  • Update csharp templates applies to to <AppliesTo>!VisualBasic</AppliesTo>
  • Update vb templates applies to to <AppliesTo>!csharp</AppliesTo>

That way the templates still show up for cordova and asp.net 5.

@sayedihashimi
Member

The script I used to update the element is at https://gist.github.com/sayedihashimi/fd04142e167fffef514b maybe we could use that to achieve the items above?

@sayedihashimi sayedihashimi closed this in #253 Apr 9, 2015
@mwhitis
mwhitis commented Apr 9, 2015

@kentcooper , @sayedihashimi

Thanks for the quick turnaround on this!

@sayedihashimi
Member

@kentcooper I noticed you used <AppliesTo>!VB</AppliesTo> instead of <AppliesTo>!VisualBasic</AppliesTo> was that on purpose, does it work?

@kentcooper
Member

@sayedihashimi yes it was on purpose. I messed it up when it posted it before. Oh and yes it does work I just tested again just to make sure.

@sayedihashimi
Member

@kentcooper ok just checking that everything is good thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment