From 0c7486ad56211229ef46802d955c3eb7b263c02b Mon Sep 17 00:00:00 2001 From: Peter Flynn Date: Tue, 30 Apr 2013 01:51:44 -0700 Subject: [PATCH] - Fix deprecation warnings in Sprint 23+ - Simpler item renderer code - Add package.json & update README (for new installation steps, new min version requirement, etc.) --- README.md | 20 ++++++++++---------- main.js | 25 +++++-------------------- package.json | 7 +++++++ 3 files changed, 22 insertions(+), 30 deletions(-) create mode 100644 package.json diff --git a/README.md b/README.md index 9ec41bf..b7b700f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ Brackets Commands Guide ======================= -An extension for [Brackets](https://github.com/adobe/brackets/), a new open-source code editor for the web. - -_**Note:** This extension requires Brackets Sprint 14 or newer._ - Use the keyboard to quickly search for commands and run them: 1. Press Cmd+Alt+? (Ctrl+Alt+? on Win) @@ -18,13 +14,17 @@ Note that the list may include some commands you can't find anywhere in the menu How to Install ============== +Brackets Commands Guide is an extension for [Brackets](https://github.com/adobe/brackets/), a new open-source code editor for the web. + To use Brackets Commands Guide: -1. [Download the ZIP](https://github.com/peterflynn/brackets-commands-guide/downloads) and unzip it; or clone this repo on GitHub -2. Place the folder so the structure is: `brackets/src/extensions/user/brackets-commands-guide/main.js` -3. Launch Brackets! +1. Choose _File > Install Extension_ +2. Enter this URL: _https://github.com/peterflynn/brackets-commands-guide_ +3. Click _Install_! + +### License +MIT-licensed -- see `main.js` for details. -License -======= -MIT-licensed -- see `main.js` for details. \ No newline at end of file +### Compatibility +Brackets Sprint 16 or newer (or Adobe Edge Code Preview 2 or newer). \ No newline at end of file diff --git a/main.js b/main.js index 2e06444..4ae34b3 100644 --- a/main.js +++ b/main.js @@ -153,30 +153,14 @@ define(function (require, exports, module) { /** + * Similar to default formatting, but with added text showing keybinding + * * @param {SearchResult} fileEntry * @param {string} query * @return {string} */ function resultFormatter(item, query) { - // Similar to QuickOpen.defaultResultsFormatter(), with added text showing keybinding - query = query.substr(1); // lose the "?" prefix - - var name = item.label; - - // Escape both query and item so the replace works properly below - query = StringUtils.htmlEscape(query); - name = StringUtils.htmlEscape(name); - - var displayName; - if (query.length > 0) { - // make query text bold within the item's label - displayName = name.replace( - new RegExp(StringUtils.regexEscape(query), "gi"), - "$&" - ); - } else { - displayName = name; - } + var displayName = QuickOpen.highlightMatch(item); // Show shortcut on right of item // TODO: display multiple shortcuts @@ -193,7 +177,8 @@ define(function (require, exports, module) { QuickOpen.addQuickOpenPlugin( { name: "Commands", - fileTypes: [], // empty array = all file types + languageIds: [], // empty array = all file types (Sprint 23+) + fileTypes: [], // (< Sprint 23) done: done, search: search, match: match, diff --git a/package.json b/package.json new file mode 100644 index 0000000..4f09100 --- /dev/null +++ b/package.json @@ -0,0 +1,7 @@ +{ + "name": "pflynn.brackets.commands.guide", + "title": "Brackets Commands Quick Search", + "version": "1.0.3", + "engines": { "brackets": ">=0.16" }, + "description": "Search and execute commands by typing part of their name, similar to Quicksilver (or Sublime's Ctrl+Shift+P or Eclipse's Ctrl+3). Press Ctrl+Alt+? (Cmd+Alt+? on Mac) to launch." +} \ No newline at end of file