| Index: third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js b/third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js
|
| index 65d93e967c174cf8c197a2792da32eb39c216897..5df281e78ff4629a265a28be6d7e68df07bc9a7a 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js
|
| @@ -4,22 +4,22 @@
|
| /**
|
| * @unrestricted
|
| */
|
| -WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| +Console.ConsolePrompt = class extends UI.Widget {
|
| constructor() {
|
| super();
|
| this._addCompletionsFromHistory = true;
|
| - this._history = new WebInspector.ConsoleHistoryManager();
|
| + this._history = new Console.ConsoleHistoryManager();
|
|
|
| this._initialText = '';
|
| this._editor = null;
|
|
|
| this.element.tabIndex = 0;
|
|
|
| - self.runtime.extension(WebInspector.TextEditorFactory).instance().then(gotFactory.bind(this));
|
| + self.runtime.extension(UI.TextEditorFactory).instance().then(gotFactory.bind(this));
|
|
|
| /**
|
| - * @param {!WebInspector.TextEditorFactory} factory
|
| - * @this {WebInspector.ConsolePrompt}
|
| + * @param {!UI.TextEditorFactory} factory
|
| + * @this {Console.ConsolePrompt}
|
| */
|
| function gotFactory(factory) {
|
| this._editor =
|
| @@ -44,7 +44,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| }
|
|
|
| /**
|
| - * @return {!WebInspector.ConsoleHistoryManager}
|
| + * @return {!Console.ConsoleHistoryManager}
|
| */
|
| history() {
|
| return this._history;
|
| @@ -64,7 +64,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
|
|
| moveCaretToEndOfPrompt() {
|
| if (this._editor)
|
| - this._editor.setSelection(WebInspector.TextRange.createFromLocation(Infinity, Infinity));
|
| + this._editor.setSelection(Common.TextRange.createFromLocation(Infinity, Infinity));
|
| }
|
|
|
| /**
|
| @@ -100,30 +100,30 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| var isPrevious;
|
|
|
| switch (keyboardEvent.keyCode) {
|
| - case WebInspector.KeyboardShortcut.Keys.Up.code:
|
| + case UI.KeyboardShortcut.Keys.Up.code:
|
| if (this._editor.selection().endLine > 0)
|
| break;
|
| newText = this._history.previous(this.text());
|
| isPrevious = true;
|
| break;
|
| - case WebInspector.KeyboardShortcut.Keys.Down.code:
|
| + case UI.KeyboardShortcut.Keys.Down.code:
|
| if (this._editor.selection().endLine < this._editor.fullRange().endLine)
|
| break;
|
| newText = this._history.next();
|
| break;
|
| - case WebInspector.KeyboardShortcut.Keys.P.code: // Ctrl+P = Previous
|
| - if (WebInspector.isMac() && keyboardEvent.ctrlKey && !keyboardEvent.metaKey && !keyboardEvent.altKey &&
|
| + case UI.KeyboardShortcut.Keys.P.code: // Ctrl+P = Previous
|
| + if (Host.isMac() && keyboardEvent.ctrlKey && !keyboardEvent.metaKey && !keyboardEvent.altKey &&
|
| !keyboardEvent.shiftKey) {
|
| newText = this._history.previous(this.text());
|
| isPrevious = true;
|
| }
|
| break;
|
| - case WebInspector.KeyboardShortcut.Keys.N.code: // Ctrl+N = Next
|
| - if (WebInspector.isMac() && keyboardEvent.ctrlKey && !keyboardEvent.metaKey && !keyboardEvent.altKey &&
|
| + case UI.KeyboardShortcut.Keys.N.code: // Ctrl+N = Next
|
| + if (Host.isMac() && keyboardEvent.ctrlKey && !keyboardEvent.metaKey && !keyboardEvent.altKey &&
|
| !keyboardEvent.shiftKey)
|
| newText = this._history.next();
|
| break;
|
| - case WebInspector.KeyboardShortcut.Keys.Enter.code:
|
| + case UI.KeyboardShortcut.Keys.Enter.code:
|
| this._enterKeyPressed(keyboardEvent);
|
| break;
|
| }
|
| @@ -134,7 +134,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| this.setText(newText);
|
|
|
| if (isPrevious)
|
| - this._editor.setSelection(WebInspector.TextRange.createFromLocation(0, Infinity));
|
| + this._editor.setSelection(Common.TextRange.createFromLocation(0, Infinity));
|
| else
|
| this.moveCaretToEndOfPrompt();
|
| }
|
| @@ -154,7 +154,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| if (!str.length)
|
| return;
|
|
|
| - var currentExecutionContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
|
| + var currentExecutionContext = UI.context.flavor(SDK.ExecutionContext);
|
| if (!this._isCaretAtEndOfPrompt() || !currentExecutionContext) {
|
| this._appendCommand(str, true);
|
| return;
|
| @@ -165,7 +165,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| /**
|
| * @param {!Protocol.Runtime.ScriptId=} scriptId
|
| * @param {?Protocol.Runtime.ExceptionDetails=} exceptionDetails
|
| - * @this {WebInspector.ConsolePrompt}
|
| + * @this {Console.ConsolePrompt}
|
| */
|
| function compileCallback(scriptId, exceptionDetails) {
|
| if (str !== this.text())
|
| @@ -188,11 +188,11 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| */
|
| _appendCommand(text, useCommandLineAPI) {
|
| this.setText('');
|
| - var currentExecutionContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
|
| + var currentExecutionContext = UI.context.flavor(SDK.ExecutionContext);
|
| if (currentExecutionContext) {
|
| - WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecutionContext, text, useCommandLineAPI);
|
| - if (WebInspector.ConsolePanel.instance().isShowing())
|
| - WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.CommandEvaluatedInConsolePanel);
|
| + SDK.ConsoleModel.evaluateCommandInConsole(currentExecutionContext, text, useCommandLineAPI);
|
| + if (Console.ConsolePanel.instance().isShowing())
|
| + Host.userMetrics.actionTaken(Host.UserMetrics.Action.CommandEvaluatedInConsolePanel);
|
| }
|
| }
|
|
|
| @@ -202,7 +202,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| /**
|
| * @param {string} prefix
|
| * @param {boolean=} force
|
| - * @return {!WebInspector.SuggestBox.Suggestions}
|
| + * @return {!UI.SuggestBox.Suggestions}
|
| */
|
| _historyCompletions(prefix, force) {
|
| if (!this._addCompletionsFromHistory || !this._isCaretAtEndOfPrompt() || (!prefix && !force))
|
| @@ -236,7 +236,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| /**
|
| * @param {number} lineNumber
|
| * @param {number} columnNumber
|
| - * @return {?WebInspector.TextRange}
|
| + * @return {?Common.TextRange}
|
| */
|
| _substituteRange(lineNumber, columnNumber) {
|
| var lineText = this._editor.line(lineNumber);
|
| @@ -245,19 +245,19 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| if (' =:[({;,!+-*/&|^<>.'.indexOf(lineText.charAt(index)) !== -1)
|
| break;
|
| }
|
| - return new WebInspector.TextRange(lineNumber, index + 1, lineNumber, columnNumber);
|
| + return new Common.TextRange(lineNumber, index + 1, lineNumber, columnNumber);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.TextRange} queryRange
|
| - * @param {!WebInspector.TextRange} substituteRange
|
| + * @param {!Common.TextRange} queryRange
|
| + * @param {!Common.TextRange} substituteRange
|
| * @param {boolean=} force
|
| * @param {string=} currentTokenType
|
| - * @return {!Promise<!WebInspector.SuggestBox.Suggestions>}
|
| + * @return {!Promise<!UI.SuggestBox.Suggestions>}
|
| */
|
| _wordsWithQuery(queryRange, substituteRange, force, currentTokenType) {
|
| var query = this._editor.text(queryRange);
|
| - var before = this._editor.text(new WebInspector.TextRange(0, 0, queryRange.startLine, queryRange.startColumn));
|
| + var before = this._editor.text(new Common.TextRange(0, 0, queryRange.startLine, queryRange.startColumn));
|
| var historyWords = this._historyCompletions(query, force);
|
|
|
| var excludedTokens = new Set(['js-comment', 'js-string-2']);
|
| @@ -266,11 +266,11 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| if (excludedTokens.has(currentTokenType))
|
| return Promise.resolve(historyWords);
|
|
|
| - return WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentContext(before, query, force)
|
| + return Components.JavaScriptAutocomplete.completionsForTextInCurrentContext(before, query, force)
|
| .then(innerWordsWithQuery);
|
| /**
|
| * @param {!Array<string>} words
|
| - * @return {!WebInspector.SuggestBox.Suggestions}
|
| + * @return {!UI.SuggestBox.Suggestions}
|
| */
|
| function innerWordsWithQuery(words) {
|
| return words.map(item => ({title: item})).concat(historyWords);
|
| @@ -284,7 +284,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
|
| /**
|
| * @unrestricted
|
| */
|
| -WebInspector.ConsoleHistoryManager = class {
|
| +Console.ConsoleHistoryManager = class {
|
| constructor() {
|
| /**
|
| * @type {!Array.<string>}
|
|
|