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

Visual Studio 17.4 Preview 4+ breaks Add New File #135

Open
Stekeblad opened this issue Nov 2, 2022 · 17 comments
Open

Visual Studio 17.4 Preview 4+ breaks Add New File #135

Stekeblad opened this issue Nov 2, 2022 · 17 comments
Labels

Comments

@Stekeblad
Copy link

Describe the bug
The latest previews of Visual Studio 17.4 introduced a add new file dialog similar to the one by this extension and assigned it to the same keybinding (shift+F2). This resulted for me in that Visual Studio's own keybinding takes priority.

I have tried rebinding the keys for the dialog added to Visual Studio and then reinstalling the extension but can't get the Add New File dialog to show anymore.

I have tried looking for a keybinding registered by Add New File but can't find anything so I can't assign it a new either.

To Reproduce

  1. Install a preview version of Visual Studio from before the conflicting dialog was introduced, for example 17.4 Preview 1
  2. Install Add New File from the extensions menu in Visual Studio.
  3. Restart and check that Add New File works as intended
    a. Open a project
    b. Select a location in Solution explorer and press shift+F2
    c. Create a new .cs file
    d. Add New File adds a new file outlining an empty class
  4. Update Visual Studio to the latest 17.4 preview
  5. Open the same project as earlier for a new test
    a. Select a location in Solution explorer and press shift+F2
    b. Create a new .cs file, note that the dialog looks different.
    c. Visual Studio creates a new, completely empty file.

Expected behavior
Even after Visual Studio has added its own similar add new file dialog it should still be possible to use this extension and it's templates.

@Stekeblad Stekeblad added the bug label Nov 2, 2022
@madskristensen
Copy link
Owner

Why do you want to use this extension over the new built in feature?

@Stekeblad
Copy link
Author

I love how this extension quickly creates the right type of file with some basic code (like a empty c# class) by just telling it filename, location and extension.

I have to admit I have not looked into if there any options for the new feature but with the default settings it creates an empty file when doing the same steps as with Add New File.

To not get an empty file it looks like you need to click a button in the pop-up that opens the add new item window with all templates and you have to look for the right template. That is no big difference from the standard Visual Studio way before.

Additionally, if it has not improved since before I started using Add New File, so feels the Add New Item dialog slow and the template I wanted to use rarely was quickly accessible, often being under a different tab or having to scroll down in the template list.

While I think the extensions template selector is a bit limited in what you can do (*controller.cs is special cased in code but other suffixes can't have templates without modifying the extension code) this extension has a another benefit for being easy to create custom templates without having to create a special package or extension for them.

@ryanbuening
Copy link

ryanbuening commented Nov 5, 2022

Same thoughts as @Stekeblad. It is unfortunate that we can't disable the new Add Quick File feature and continue to use this extension in VS Preview. I tried removing the new AddQuickFile shortcut (Shift + F2) in the options, but doing that does not enable this extension prompt to show.

@tuliopaim
Copy link

You can go to Options -> Environment -> Keyboard, remove the shortcut of "AddQuickFile", and assign "Shift+ F2" to "NewEmptyFile"

@JJ-Chen
Copy link

JJ-Chen commented Nov 9, 2022

Thanks @tuliopaim , it works! Save my day!

As visual studio in "What's New?" says: applying templates will be support in Preview 2.
We could look forward to the next version.
image

But so far, this extension still the most efficient way to add a new file.🧐

@marekpetak
Copy link

VS version 17.4.0 (non preview) has this as well. VS will only create an empty file. Nowhere near as good as the extension at them moment!

@chucker
Copy link
Contributor

chucker commented Nov 14, 2022

Why do you want to use this extension over the new built in feature?

One reason I ran into today: in your extension, I can write ../../Roles/MyNewType.cs. It'll navigate upwards, auto-generate the folder Roles, and generate the file.

VS's feature, meanwhile, will tell me (as of 17.5.0 Preview 1.0) that this contains illegal characters.

@ivnext
Copy link

ivnext commented Nov 19, 2022

Why do you want to use this extension over the new built in feature?

It is broken, but your original works brilliantly. This one creates an empty file (no content). I use this numerous times per-day and love it. Until Microsoft fixes this new built-in feature, I am going with the solution by @tuliopaim above. Thanks again for all of your awesome work!

@mcb2001
Copy link

mcb2001 commented Nov 24, 2022

Anyone found a solution for this? I really miss the SHIFT + F2 feature in my workflow - the new empty files are driving me crazy

@vpekarek
Copy link

Check the @tuliopaim solution:

You can go to Options -> Environment -> Keyboard, remove the shortcut of "AddQuickFile", and assign "Shift+ F2" to "NewEmptyFile"

@mcb2001
Copy link

mcb2001 commented Nov 24, 2022

Check the @tuliopaim solution:

You can go to Options -> Environment -> Keyboard, remove the shortcut of "AddQuickFile", and assign "Shift+ F2" to "NewEmptyFile"

Thanks! Seems to work.

@bplus0
Copy link

bplus0 commented Nov 28, 2022

The solution @tuliopaim suggested is still working as of 11/28. Losing this extension derailed my afternoon. So happy I found this thread!

@mg-degroot
Copy link

The solution @tuliopaim suggested is still working as of 11/28. Losing this extension derailed my afternoon. So happy I found this thread!

Here too. First tought that AddAnyFile extension was updated and broken somehow but luckily found this issue with the fix to disable AddQuickFile and restore NewEmptyFile.

@sgf
Copy link

sgf commented Dec 29, 2022

how about add new shortcut likes "Shift+F3" or some others.

@StevenTCramer
Copy link

StevenTCramer commented Jan 13, 2023

Why do you want to use this extension over the new built in feature?

I can not even find docs on AddQuickFile? So how would I even know how to use the feature?

@bplus0
Copy link

bplus0 commented Jan 13, 2023

Why do you want to use this extension over the new built in feature?

I can not even find docs on AddQuickFile? So how would I even know how to use the feature?

I can't comment on the docs. I don't know where they are. But the reason I like the extension more than AddQuickFile is AddNewFile will create a code behind file if you're using razor pages (most of the time) and scaffold c# classes with the namespace and proper file structure.

Visual Studio built in just does a blank file with the proper extension.

edit I got the feature and the extension switched around... 🙄🙄

@StevenTCramer
Copy link

StevenTCramer commented Jan 13, 2023

Why do you want to use this extension over the new built in feature?

I can not even find docs on AddQuickFile? So how would I even know how to use the feature?

I can't comment on the docs. I don't know where they are. But the reason I like the extension more is AddQuickFile will create a code behind file if you're using razor pages (most of the time) and scaffold c# classes with the namespace and proper file structure.

Visual Studio built in just does a blank file with the proper extension.

Yes, the real question, IMO, is why bother adding the AddQuickFile feature at all if not going to do it correctly. This extension is hugely popular and probably the motivation so why not implement it all, and if not why stomp on the hot key?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests