Skip to content
This repository was 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
@@ -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");
20 changes: 9 additions & 11 deletions src/extensions/default/QuickOpenCSS/main.js
Original file line number Diff line number Diff line change
@@ -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) {
return true;
}
return (query[0] === "@");
}

/**
* Select the selected item in the current document
* Scroll to 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
* @param {string} query
* @param {boolean} explicit False if this is only highlighted due to being at top of list after search()
*/
function itemFocus(selectedItem) {
if (!selectedItem) {
function itemFocus(selectedItem, query, explicit) {
if (!selectedItem || (query.length < 2 && !explicit)) {
return;
}
var selectorInfo = selectedItem.selectorInfo;
@@ -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);
}


20 changes: 9 additions & 11 deletions src/extensions/default/QuickOpenHTML/main.js
Original file line number Diff line number Diff line change
@@ -118,21 +118,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) {
return true;
}
return (query[0] === "@");
}


/**
* Select the selected item in the current document
* Scroll to 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
* @param {string} query
* @param {boolean} explicit False if this is only highlighted due to being at top of list after search()
*/
function itemFocus(selectedItem) {
if (!selectedItem) {
function itemFocus(selectedItem, query, explicit) {
if (!selectedItem || (query.length < 2 && !explicit)) {
return;
}
var fileLocation = selectedItem.fileLocation;
@@ -142,8 +140,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);
}


20 changes: 9 additions & 11 deletions src/extensions/default/QuickOpenJavaScript/main.js
Original file line number Diff line number Diff line change
@@ -112,20 +112,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) {
return true;
}
return (query[0] === "@");
}

/**
* Select the selected item in the current document
* Scroll to 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
* @param {string} query
* @param {boolean} explicit False if this is only highlighted due to being at top of list after search()
*/
function itemFocus(selectedItem) {
if (!selectedItem) {
function itemFocus(selectedItem, query, explicit) {
if (!selectedItem || (query.length < 2 && !explicit)) {
return;
}
var fileLocation = selectedItem.fileLocation;
@@ -135,8 +133,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);
}


Loading