OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 * @extends {WebInspector.CodeMirrorTextEditor} | 7 * @extends {WebInspector.CodeMirrorTextEditor} |
8 * @param {!WebInspector.SourcesTextEditorDelegate} delegate | 8 * @param {!WebInspector.SourcesTextEditorDelegate} delegate |
9 */ | 9 */ |
10 WebInspector.SourcesTextEditor = function(delegate) | 10 WebInspector.SourcesTextEditor = function(delegate) |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 { | 478 { |
479 this._muteTextChangedEvent = true; | 479 this._muteTextChangedEvent = true; |
480 this._setEditorIndentation(text.split("\n").slice(0, WebInspector.Source
sTextEditor.LinesToScanForIndentationGuessing)); | 480 this._setEditorIndentation(text.split("\n").slice(0, WebInspector.Source
sTextEditor.LinesToScanForIndentationGuessing)); |
481 WebInspector.CodeMirrorTextEditor.prototype.setText.call(this, text); | 481 WebInspector.CodeMirrorTextEditor.prototype.setText.call(this, text); |
482 delete this._muteTextChangedEvent; | 482 delete this._muteTextChangedEvent; |
483 }, | 483 }, |
484 | 484 |
485 /** | 485 /** |
486 * @override | 486 * @override |
487 * @param {string} mimeType | 487 * @param {string} mimeType |
| 488 * @return {!Promise} |
488 */ | 489 */ |
489 setMimeType: function(mimeType) | 490 setMimeType: function(mimeType) |
490 { | 491 { |
491 this._mimeType = mimeType; | 492 this._mimeType = mimeType; |
492 WebInspector.CodeMirrorTextEditor.prototype.setMimeType.call(this, this.
_applyWhitespaceMimetype(mimeType)); | 493 return WebInspector.CodeMirrorTextEditor.prototype.setMimeType.call(this
, mimeType) |
| 494 .then(() => this._codeMirror.setOption("mode", this._applyWhitespace
Mimetype(mimeType))); |
493 }, | 495 }, |
494 | 496 |
495 _updateWhitespace: function() | 497 _updateWhitespace: function() |
496 { | 498 { |
497 if (this._mimeType) | 499 if (this._mimeType) |
498 this.setMimeType(this._mimeType); | 500 this.setMimeType(this._mimeType); |
499 }, | 501 }, |
500 | 502 |
501 /** | 503 /** |
502 * @param {string} mimeType | 504 * @param {string} mimeType |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 this._codeMirror.addOverlay(overlayMode); | 993 this._codeMirror.addOverlay(overlayMode); |
992 this._highlightDescriptor = { | 994 this._highlightDescriptor = { |
993 overlay: overlayMode, | 995 overlay: overlayMode, |
994 selectionStart: selectionStart | 996 selectionStart: selectionStart |
995 }; | 997 }; |
996 } | 998 } |
997 } | 999 } |
998 | 1000 |
999 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; | 1001 WebInspector.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; |
1000 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; | 1002 WebInspector.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; |
OLD | NEW |