adobe/brackets — pull request #4276 by JakeStoeffler (2013-06-19 05:02:59+00:00)
Title: Switch language / syntax mode of current document

As described in [card 336](https://trello.com/card/99-user-selected-language-syntax-mode-per-file-2/4f90a6d98f77505d7940ce88/336), this allows the user to override the language / syntax mode for the current document. Currently this works only on a per-file basis, and the setting is not persisted. (If we want it persisted, let me know. Shouldn't be too difficult to do.)

I've seen a number of people requesting that certain file extensions be associated with certain syntax modes, and I myself started to get annoyed by having to modify `languages.json` in order to get syntax highlighting in a `.erb` file. This pull request should remedy that by providing a simple enough way to override the language mode.

To switch the language for the current document, click the language name in the status bar and select a language from the dropdown in the dialog. There's a reset button that will reset the language to the default for that particular file extension.

Note that this also works for documents in inline editors. If a document is open in a full editor and in an inline editor, both will be changed to the selected language.

This is not to be confused with the existing "Switch Language" dialog that allows you to change the language Brackets runs in for localization testing purposes. I wasn't quite sure what to call this other than the "Switch Language" dialog. I was thinking "Switch Language Mode" or "Switch Syntax Mode" might work, but I wasn't sure because technically modes and languages are two different things. I'm open to suggestions if anyone has an idea for how to name things better to avoid confusion.

Note that small additions to the APIs of Document and LanguageManager were required to support this new functionality.