AddAnyFile
AddAnyFile copied to clipboard
Files created through "Add New File" do not respect tab preferences
Installed product versions
- Visual Studio: 2019 Enterprise
- This extension: 3.5.138
Description
I have Visual Studio configured to "Keep tabs" for C#, however the extension always creates files with spaces instead (as opposed to the native "Add new item" tool).
It also ignores indent size if spaces are used, for example, with 2 spaces indentation the extension will still create files with 4 spaces.
It'd be preferable that it respected tab settings.
This issue is partly equal to #24 but that doesn't mention that the extension will also ignore "Indent size" for spaces.
Steps to recreate
- Open Visual Studio, with a solution/project loaded.
- Configure the use of tabs over spaces in the settings through "Tools > Options... > Text Editor > C# > Tabs > Tab > Keep tabs".
- Create a .cs file with the extension.
- Verify that it used spaces instead of tabs.
- Reconfigure the tab settings to "Insert spaces" and set the "Indent size" to 2.
- Repeat step 3.
- Verify that it used 4 spaces instead of 2 spaces.
Current behavior
C# files created through the extension always use 4 spaces indentation, regardless of tab settings.
Expected behavior
C# files created through the extension should follow tab settings, using tab indentation if "Keep tabs" is used and/or using exactly the N amount of spaces configured with "Indent size" otherwise.
As a workaround, you can edit the used template files.
After installing the extension, they are located here: LocalDisk:\Users\UserName\AppData\Local\Microsoft\VisualStudio\16.0\Extensions\RandomFolderNameForAddNewFileExtension\Templates
As a workaround, you can edit the used template files.
After installing the extension, they are located here: LocalDisk:\Users\UserName\AppData\Local\Microsoft\VisualStudio\16.0\Extensions\RandomFolderNameForAddNewFileExtension\Templates
Ah, that's good enough for me, thanks.