Commit a5f5f164 authored by Joel Einbinder's avatar Joel Einbinder Committed by Commit Bot

DevTools: Have the console SuggestBox prefer top when eager eval is on

This should make the suggest box obscure eager eval less often.

Change-Id: I60573ed142947daa005f648c13d1c3a32f8d492b
Reviewed-on: https://chromium-review.googlesource.com/1048025
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558097}
parent 646faed8
......@@ -40,7 +40,9 @@ Console.ConsolePrompt = class extends UI.Widget {
this._editor.configureAutocomplete({
substituteRangeCallback: this._substituteRange.bind(this),
suggestionsCallback: this._wordsWithQuery.bind(this),
tooltipCallback: (lineNumber, columnNumber) => this._tooltipCallback(lineNumber, columnNumber)
tooltipCallback: (lineNumber, columnNumber) => this._tooltipCallback(lineNumber, columnNumber),
anchorBehavior: this._isBelowPromptEnabled ? UI.GlassPane.AnchorBehavior.PreferTop :
UI.GlassPane.AnchorBehavior.PreferBottom
});
this._editor.widget().element.addEventListener('keydown', this._editorKeyDown.bind(this), true);
this._editor.widget().show(this.element);
......
......@@ -261,8 +261,11 @@ TextEditor.TextEditorAutocompleteController = class {
this._onSuggestionsShownForTest([]);
return;
}
if (!this._suggestBox)
if (!this._suggestBox) {
this._suggestBox = new UI.SuggestBox(this, 20);
if (this._config.anchorBehavior)
this._suggestBox.setAnchorBehavior(this._config.anchorBehavior);
}
const oldQueryRange = this._queryRange;
this._queryRange = queryRange;
......
......@@ -93,6 +93,13 @@ UI.SuggestBox = class {
this._glassPane.setContentAnchorBox(anchorBox);
}
/**
* @param {!UI.GlassPane.AnchorBehavior} behavior
*/
setAnchorBehavior(behavior) {
this._glassPane.setAnchorBehavior(behavior);
}
/**
* @param {!UI.SuggestBox.Suggestions} items
*/
......
......@@ -118,7 +118,8 @@ UI.TextEditor.Options;
* substituteRangeCallback: ((function(number, number):?TextUtils.TextRange)|undefined),
* tooltipCallback: ((function(number, number):?Element)|undefined),
* suggestionsCallback: ((function(!TextUtils.TextRange, !TextUtils.TextRange, boolean=):?Promise.<!UI.SuggestBox.Suggestions>)|undefined),
* isWordChar: ((function(string):boolean)|undefined)
* isWordChar: ((function(string):boolean)|undefined),
* anchorBehavior: (UI.GlassPane.AnchorBehavior|undefined)
* }}
*/
UI.AutocompleteConfig;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment