Skip to content

Commit

Permalink
- Fix deprecation warnings in Sprint 23+
Browse files Browse the repository at this point in the history
- Simpler item renderer code
- Add package.json & update README (for new installation steps, new min
  version requirement, etc.)
  • Loading branch information
peterflynn committed Apr 30, 2013
1 parent ac7866f commit 0c7486a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 30 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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.
### Compatibility
Brackets Sprint 16 or newer (or Adobe Edge Code Preview 2 or newer).
25 changes: 5 additions & 20 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
"<strong>$&</strong>"
);
} else {
displayName = name;
}
var displayName = QuickOpen.highlightMatch(item);

// Show shortcut on right of item
// TODO: display multiple shortcuts
Expand All @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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."
}

0 comments on commit 0c7486a

Please # to comment.