Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js

Issue 2385793003: DevTools: Fix visible whitespace for cm_modes (Closed)
Patch Set: Use promises Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698