Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Allow Quick Open plugins to specify both fileTypes and languageIds #3322

Merged
merged 1 commit into from
Apr 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/search/QuickOpen.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ define(function (require, exports, module) {
* cancels Quick Open (via Esc), those changes are automatically reverted.
*/
function addQuickOpenPlugin(pluginDef) {
if (pluginDef.fileTypes) {
// Backwards compatibility (for now) for old fileTypes field, if newer languageIds not specified
if (pluginDef.fileTypes && !pluginDef.languageIds) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed...

console.warn("Using fileTypes for QuickOpen plugins is deprecated. Use languageIds instead.");
pluginDef.languageIds = pluginDef.fileTypes.map(function (extension) {
return LanguageManager.getLanguageForPath("file." + extension).getId();
Expand Down Expand Up @@ -543,8 +544,8 @@ define(function (require, exports, module) {
var i;
for (i = 0; i < plugins.length; i++) {
var plugin = plugins[i];
var LanguageIdMatch = plugin.languageIds.indexOf(languageId) !== -1 || plugin.languageIds.length === 0;
if (LanguageIdMatch && plugin.match && plugin.match(query)) {
var languageIdMatch = plugin.languageIds.indexOf(languageId) !== -1 || plugin.languageIds.length === 0;
if (languageIdMatch && plugin.match && plugin.match(query)) {
currentPlugin = plugin;

// Look up the StringMatcher for this plugin.
Expand Down