| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.SuggestBoxDelegate} | 7 * @implements {WebInspector.SuggestBoxDelegate} |
| 8 * @param {!WebInspector.CodeMirrorTextEditor} textEditor | 8 * @param {!WebInspector.CodeMirrorTextEditor} textEditor |
| 9 * @param {!CodeMirror} codeMirror | 9 * @param {!CodeMirror} codeMirror |
| 10 */ | 10 */ |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 this.finishAutocomplete(); | 131 this.finishAutocomplete(); |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 | 134 |
| 135 if (!this._suggestBox) | 135 if (!this._suggestBox) |
| 136 this._suggestBox = new WebInspector.SuggestBox(this, 6); | 136 this._suggestBox = new WebInspector.SuggestBox(this, 6); |
| 137 var oldPrefixRange = this._prefixRange; | 137 var oldPrefixRange = this._prefixRange; |
| 138 this._prefixRange = prefixRange; | 138 this._prefixRange = prefixRange; |
| 139 if (!oldPrefixRange || prefixRange.startLine !== oldPrefixRange.startLin
e || prefixRange.startColumn !== oldPrefixRange.startColumn) | 139 if (!oldPrefixRange || prefixRange.startLine !== oldPrefixRange.startLin
e || prefixRange.startColumn !== oldPrefixRange.startColumn) |
| 140 this._updateAnchorBox(); | 140 this._updateAnchorBox(); |
| 141 this._suggestBox.updateSuggestions(this._anchorBox, wordsWithPrefix, 0,
true, this._textEditor.copyRange(prefixRange)); | 141 this._suggestBox.updateSuggestions(this._anchorBox, wordsWithPrefix.map(
item => ({title: item})), 0, true, this._textEditor.copyRange(prefixRange)); |
| 142 if (!this._suggestBox.visible()) | 142 if (!this._suggestBox.visible()) |
| 143 this.finishAutocomplete(); | 143 this.finishAutocomplete(); |
| 144 this._onSuggestionsShownForTest(wordsWithPrefix); | 144 this._onSuggestionsShownForTest(wordsWithPrefix); |
| 145 }, | 145 }, |
| 146 | 146 |
| 147 /** | 147 /** |
| 148 * @param {!Array.<string>} suggestions | 148 * @param {!Array.<string>} suggestions |
| 149 */ | 149 */ |
| 150 _onSuggestionsShownForTest: function(suggestions) { }, | 150 _onSuggestionsShownForTest: function(suggestions) { }, |
| 151 | 151 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 { | 340 { |
| 341 return dictionary.wordCount(b) - dictionary.wordCount(a) || a.length
- b.length; | 341 return dictionary.wordCount(b) - dictionary.wordCount(a) || a.length
- b.length; |
| 342 } | 342 } |
| 343 | 343 |
| 344 function excludeFilter(excludeWord, word) | 344 function excludeFilter(excludeWord, word) |
| 345 { | 345 { |
| 346 return word !== excludeWord; | 346 return word !== excludeWord; |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 } | 349 } |
| OLD | NEW |