Skip to content

Save As Type dialog is not sorted alphabetically #114264

Closed

Description

  • VSCode Version: 1.52.1 (user setup)
  • OS Version: Windows_NTx64 10.0.19042

Steps to Reproduce:

  1. Install some custom languages, examples that it definitely works for are "Caddlefile Syntax", "Graphviz language", "Hjson", "Better TOML", "Svelte for VS Code".
  2. Create a new blank file.
  3. File --> Save as and expect to find it in the alphabetically sorted list (e.g. Toml from Better TOML between Swift and TypeScript) , instead find it at the bottom.

It appears to be in the order 'inbuilt languages sorted alphabetically' followed by 'other languages sorted somewhat randomly'.

image

Does this issue occur when all extensions are disabled?: No

Activity

  1. added
    dialogs
    feature-request
    on Jan 13, 2021
  2. bpasero commented on Jan 13, 2021

    @bpasero
    Contributor

    They are sorted on macOS, so it maybe Windows doing something weird. But we also dont sort the list explicitly:

    const registeredLanguageFilters: IFilter[] = coalesce(this.modeService.getRegisteredLanguageNames().map(languageName => {
    const extensions = this.modeService.getExtensions(languageName);
    if (!extensions || !extensions.length) {
    return null;
    }
    const filter: IFilter = { name: languageName, extensions: distinct(extensions).slice(0, 10).map(e => trim(e, '.')) };
    if (ext && extensions.indexOf(ext) >= 0 && !matchingFilter) {
    matchingFilter = filter;
    return null; // first matching filter will be added to the top
    }
    return filter;
    }));

  3. vscode-triage-bot commented on Jan 13, 2021

    @vscode-triage-bot

    This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

    Happy Coding!

  4. added
    help wanted
    on Jan 13, 2021
  5. bpasero commented on Jan 13, 2021

    @bpasero
    Contributor

    Up for grab, I think we should sort the languages by name. We still have to make sure that:

    • "All Files" appears first
    • the current language appears second and selected
    • "No Extension" is last
  6. added
    good first issue
    on Jan 13, 2021
  7. rydwhelchel commented on Jan 13, 2021

    @rydwhelchel

    If you sort "registeredLanguageFilters" that should solve the problem no?
    "All files" appearing first, current language appearing second and "No Extension" appearing last is handled by these lines:

    options.filters = coalesce([
    { name: nls.localize('allFiles', "All Files"), extensions: ['*'] },
    matchingFilter,
    ...registeredLanguageFilters,
    { name: nls.localize('noExt', "No Extension"), extensions: [''] }
    ]);

    Still getting the hang of all this, so please correct me if I am wrong.

  8. bpasero commented on Jan 14, 2021

    @bpasero
    Contributor

    Can we have this discussion in a Pull Request?

  9. 7 remaining items

  10. vscode-triage-bot commented on Jan 19, 2021

    @vscode-triage-bot

    This bug has been fixed in to the latest release of VS Code Insiders!

    Alexander Craggs (@popey456963), you can help us out by commenting /verified if things are now working as expected.

    If things still don't seem right, please ensure you're on version 32b28f6 of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.

    Happy Coding!

  11. added
    bug
    and removed
    author-verification-requested
    feature-request
    verification-needed
    on Jan 23, 2021
  12. lramos15 commented on Jan 28, 2021

    @lramos15
    Member

    Two things I notice.

    1. Save as with untitled files defaults to .bat not All Files.
    2. Calling Save as on a file with a pre-existing extension leads to an out of order list. I.e. here's a picture of .CSS
      image
  13. bpasero commented on Jan 29, 2021

    @bpasero
    Contributor

    It is intentional that the language mode picked for a file is the second most entry in the list, we have explicit code to change the order there.

    As for untitled: did you have the language mode configured to ".bat"? I suggest we follow up in a new issue here as it is independent from the sorting fix.

    Verification:

    • create an untitled file
    • save it
    • in the picker verify that the languages are sorted by name, specifically check for languages contributed by extensions such as JSONC
  14. locked and limited conversation to collaborators on Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugdialogsgood first issuehelp wantedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions