OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @implements {WebInspector.TargetManager.Observer} | 7 * @implements {WebInspector.TargetManager.Observer} |
8 * @param {!WebInspector.TargetManager} targetManager | 8 * @param {!WebInspector.TargetManager} targetManager |
9 * @param {!WebInspector.Context} context | 9 * @param {!WebInspector.Context} context |
10 */ | 10 */ |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 } | 142 } |
143 this._contextIsGoingAway = true; | 143 this._contextIsGoingAway = true; |
144 this._context.setFlavor(WebInspector.ExecutionContext, newContext); | 144 this._context.setFlavor(WebInspector.ExecutionContext, newContext); |
145 this._contextIsGoingAway = false; | 145 this._contextIsGoingAway = false; |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 /** | 149 /** |
150 * @param {!Element} proxyElement | 150 * @param {!Element} proxyElement |
| 151 * @param {string} text |
| 152 * @param {number} cursorOffset |
151 * @param {!Range} wordRange | 153 * @param {!Range} wordRange |
152 * @param {boolean} force | 154 * @param {boolean} force |
153 * @param {function(!Array.<string>, number=)} completionsReadyCallback | 155 * @param {function(!Array.<string>, number=)} completionsReadyCallback |
154 */ | 156 */ |
155 WebInspector.ExecutionContextSelector.completionsForTextPromptInCurrentContext =
function(proxyElement, wordRange, force, completionsReadyCallback) | 157 WebInspector.ExecutionContextSelector.completionsForTextPromptInCurrentContext =
function(proxyElement, text, cursorOffset, wordRange, force, completionsReadyCa
llback) |
156 { | 158 { |
157 var executionContext = WebInspector.context.flavor(WebInspector.ExecutionCon
text); | 159 var executionContext = WebInspector.context.flavor(WebInspector.ExecutionCon
text); |
158 if (!executionContext) { | 160 if (!executionContext) { |
159 completionsReadyCallback([]); | 161 completionsReadyCallback([]); |
160 return; | 162 return; |
161 } | 163 } |
162 | 164 |
163 // Pass less stop characters to rangeOfWord so the range will be a more comp
lete expression. | 165 // Pass less stop characters to rangeOfWord so the range will be a more comp
lete expression. |
164 var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOf
fset, " =:({;,!+-*/&|^<>", proxyElement, "backward"); | 166 var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOf
fset, " =:({;,!+-*/&|^<>", proxyElement, "backward"); |
165 var expressionString = expressionRange.toString(); | 167 var expressionString = expressionRange.toString(); |
166 | 168 |
167 // The "[" is also a stop character, except when it's the last character of
the expression. | 169 // The "[" is also a stop character, except when it's the last character of
the expression. |
168 var pos = expressionString.lastIndexOf("[", expressionString.length - 2); | 170 var pos = expressionString.lastIndexOf("[", expressionString.length - 2); |
169 if (pos !== -1) | 171 if (pos !== -1) |
170 expressionString = expressionString.substr(pos + 1); | 172 expressionString = expressionString.substr(pos + 1); |
171 | 173 |
172 var prefix = wordRange.toString(); | 174 var prefix = wordRange.toString(); |
173 executionContext.completionsForExpression(expressionString, prefix, force, c
ompletionsReadyCallback); | 175 executionContext.completionsForExpression(expressionString, text, cursorOffs
et, prefix, force, completionsReadyCallback); |
174 } | 176 } |
OLD | NEW |