Vscode: Save as: incorrect file extension for unsupported file types

Created on 10 Jun 2017  路  7Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.13.0
  • OS Version: Win 10

Steps to Reproduce:

  1. Open a not support file type but still a text file (e.g. a.xyz)
  2. Save as a b.xyz by enter b in the save file field. (File type show as Plain Text)
  3. If the destination does not have a .txt file, it will save as b.xyz. But if the destination have a .txt file, it will save as b.txt
electron upstream

Most helpful comment

I have same issue, and I think my issue with ti would be solved if the default was "all files" instead of plain text. Is it possible to change this setting as a user?
In my case it is a .r file I want to save, and even with extensions for R installed, the default is save as plain text (.txt)

All 7 comments

  • VSCode Version: 1.17.1
  • OS Version: Mac OS Sierra

it happened on VSCode for Mac too

I meet same question when I tried to save *.in.
How can I fix it?

On a related note, I get kinda lost when saving a new empty file because I can't see which other code files are in the directory, unless I manually change the type to 'All files (*.*)'

image

I have same issue, and I think my issue with ti would be solved if the default was "all files" instead of plain text. Is it possible to change this setting as a user?
In my case it is a .r file I want to save, and even with extensions for R installed, the default is save as plain text (.txt)

I cannot believe this is still an issue after two years. Just took a moment to figure out why all my .py files were .py.txt.

Apparently this is disabled _by design_ inside Electron, to safeguard it from adding *.* to the file name, as can be seen in shell/browser/ui/file_dialog_win#L206.

// By default, *.* will be added to the file name if file type is "*.*". In
// Electron, we disable it to make a better experience.
// ...
for (size_t i = 0; i < filterspec.size(); ++i) {
    if (std::wstring(filterspec[i].pszSpec) != L"*.*") {
        // SetFileTypeIndex is regarded as one-based index.
        dialog->SetFileTypeIndex(i + 1);
        dialog->SetDefaultExtension(filterspec[i].pszSpec);
        break;
    }
}

There has to be a way though, because many other programs can do it. I'll try and test if this issue actually happens later, but I'll have to build my own Electron as well I think.

This issue seems to originate from an upstream component and is not something VSCode can fix by making a change to the code. As such, I will go ahead and close it. If you can identify the component that is causing the issue, please report it upstream:

Thanks for understanding.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omidgolparvar picture omidgolparvar  路  3Comments

curtw picture curtw  路  3Comments

biij5698 picture biij5698  路  3Comments

chrisdias picture chrisdias  路  3Comments

villiv picture villiv  路  3Comments