Skip to content

[CLOSED] Language switcher: connect to prefs & clean up some code #7545

@core-ai-bot

Description

@core-ai-bot

Issue by peterflynn
Thursday Jul 17, 2014 at 21:39 GMT
Originally opened as adobe/brackets#8444


Follow-on to PR #6409...

It may be easiest to review each commit individually, since they're fairly distinct:

Second commit - new feature:

  • Add "Set as Default" menu item to status bar language switcher -- adds a permanent file extension mapping to preferences, based on the current file's path-specific language override (if any) and its file extension.

First commit - cleanups:

  • Make LanguageManager the official public API that is used to set per-file overrides, rather than proxying through Document objects - remove Document.setLanguageOverride()
  • Clear path overrides when switching projects, so it's more obvious to users it's not something that gets persisted across sessions
  • Simplify how JS Code Hints listen for language updates: remove dependency on "currentDocumentLanguageChanged" event; remove unneeded extra 'if' tests

Third commit:

  • Improve "Set as Default" menu item -- gray it out when the current file has no path-specific override (i.e., when the current language already is the default for the current filetype)
  • Extend DropdownButton / DropdownEventHandler to support disabled items.
  • In the process, clean up dropdown keyboard navigation substantially -- fixing [CLOSED] UI Fixes #8433.

For clarity, I'd ideally like the "Set as Default" menu item to be grayed out when there is no path-specific override on the current file (i.e., when the current language already is the default for the current filetype)... but disabled items aren't a think in DropdownButton yet and I will need to do some cleanup there to get it working -- so I wanted to post this initial for review first. (this is now implemented)


peterflynn included the following code: https://github.com/adobe/brackets/pull/8444/commits

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions