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

Replace 'smart autocomplete' with a purpose-built QuickSearchField module #7227

Merged
merged 8 commits into from
Apr 7, 2015
1 change: 0 additions & 1 deletion src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ define(function (require, exports, module) {
require("widgets/bootstrap-modal");
require("widgets/bootstrap-twipsy-mod");
require("thirdparty/path-utils/path-utils.min");
require("thirdparty/smart-auto-complete-local/jquery.smart_autocomplete");

// Load CodeMirror add-ons--these attach themselves to the CodeMirror module
require("thirdparty/CodeMirror2/addon/fold/xml-fold");
Expand Down
16 changes: 7 additions & 9 deletions src/extensions/default/QuickOpenCSS/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,18 @@ define(function (require, exports, module) {
* @param {boolean} returns true if this plugin wants to provide results for this query
*/
function match(query) {
// TODO: match any location of @ when QuickOpen._handleItemFocus() is modified to
// dynamic open files
//if (query.indexOf("@") !== -1) {
if (query.indexOf("@") === 0) {
if (query[0] === "@") {
return true;
}
}

/**
* Select the selected item in the current document
* Scroll top the selected item in the current document (unless no query string entered yet,
Copy link
Contributor

Choose a reason for hiding this comment

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

the comment doesn't match the current signature anymore.

* in which case the topmost list item is irrelevant)
* @param {?SearchResult} selectedItem
*/
function itemFocus(selectedItem) {
if (!selectedItem) {
function itemFocus(selectedItem, query, force) {
if (!selectedItem || (query.length < 2 && !force)) {
return;
}
var selectorInfo = selectedItem.selectorInfo;
Expand All @@ -107,8 +105,8 @@ define(function (require, exports, module) {
EditorManager.getCurrentFullEditor().setSelection(from, to, true);
}

function itemSelect(selectedItem) {
itemFocus(selectedItem);
function itemSelect(selectedItem, query) {
itemFocus(selectedItem, query, true);
}


Expand Down
16 changes: 7 additions & 9 deletions src/extensions/default/QuickOpenHTML/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,19 @@ define(function (require, exports, module) {
* @param {boolean} returns true if this plug-in wants to provide results for this query
*/
function match(query) {
// TODO: match any location of @ when QuickOpen._handleItemFocus() is modified to
// dynamic open files
//if (query.indexOf("@") !== -1) {
if (query.indexOf("@") === 0) {
if (query[0] === "@") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason not to write return query[0] === "@"?

return true;
}
}


/**
* Select the selected item in the current document
* Scroll top the selected item in the current document (unless no query string entered yet,
* in which case the topmost list item is irrelevant)
* @param {?SearchResult} selectedItem
*/
function itemFocus(selectedItem) {
if (!selectedItem) {
function itemFocus(selectedItem, query, force) {
if (!selectedItem || (query.length < 2 && !force)) {
return;
}
var fileLocation = selectedItem.fileLocation;
Expand All @@ -141,8 +139,8 @@ define(function (require, exports, module) {
EditorManager.getCurrentFullEditor().setSelection(from, to, true);
}

function itemSelect(selectedItem) {
itemFocus(selectedItem);
function itemSelect(selectedItem, query) {
itemFocus(selectedItem, query, true);
}


Expand Down
16 changes: 7 additions & 9 deletions src/extensions/default/QuickOpenJavaScript/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,18 @@ define(function (require, exports, module) {
*/
function match(query) {
// only match @ at beginning of query for now
// TODO: match any location of @ when QuickOpen._handleItemFocus() is modified to
// dynamic open files
//if (query.indexOf("@") !== -1) {
if (query.indexOf("@") === 0) {
if (query[0] === "@") {
return true;
}
}

/**
* Select the selected item in the current document
* Scroll top the selected item in the current document (unless no query string entered yet,
* in which case the topmost list item is irrelevant)
Copy link
Contributor

Choose a reason for hiding this comment

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

documentation doesn't match the current function signature

* @param {?SearchResult} selectedItem
*/
function itemFocus(selectedItem) {
if (!selectedItem) {
function itemFocus(selectedItem, query, force) {
if (!selectedItem || (query.length < 2 && !force)) {
return;
}
var fileLocation = selectedItem.fileLocation;
Expand All @@ -134,8 +132,8 @@ define(function (require, exports, module) {
EditorManager.getCurrentFullEditor().setSelection(from, to, true);
}

function itemSelect(selectedItem) {
itemFocus(selectedItem);
function itemSelect(selectedItem, query) {
itemFocus(selectedItem, query, true);
}


Expand Down
Loading