mirror of
https://github.com/adobe/brackets.git
synced 2024-11-20 09:53:00 +01:00
Add 'onHighlight' optional event callback mechanism for better extensibility features in hint providers (#14140)
This commit is contained in:
parent
65c61b0624
commit
cec41f4d77
@ -150,6 +150,10 @@ define(function (require, exports, module) {
|
||||
|
||||
$item.find("a").addClass("highlight");
|
||||
ViewUtils.scrollElementIntoView($view, $item, false);
|
||||
|
||||
if (this.handleHighlight) {
|
||||
this.handleHighlight($item.find("a"));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -544,6 +548,15 @@ define(function (require, exports, module) {
|
||||
this.handleSelect = callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the hint list highlight callback function
|
||||
*
|
||||
* @param {Function} callback
|
||||
*/
|
||||
CodeHintList.prototype.onHighlight = function (callback) {
|
||||
this.handleHighlight = callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the hint list closure callback function
|
||||
*
|
||||
|
@ -507,6 +507,12 @@ define(function (require, exports, module) {
|
||||
|
||||
sessionEditor = editor;
|
||||
hintList = new CodeHintList(sessionEditor, insertHintOnTab, maxCodeHints);
|
||||
hintList.onHighlight(function ($hint) {
|
||||
// If the current hint provider listening for hint item highlight change
|
||||
if (sessionProvider.onHighlight) {
|
||||
sessionProvider.onHighlight($hint);
|
||||
}
|
||||
});
|
||||
hintList.onSelect(function (hint) {
|
||||
var restart = sessionProvider.insertHint(hint),
|
||||
previousEditor = sessionEditor;
|
||||
|
Loading…
Reference in New Issue
Block a user