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

Unified Diff: third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
diff --git a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
index f7b0fe19c9014197f1408bb54e77b9979a17fa22..0e509158196432ba7e1c8181169c0efbf81295be 100644
--- a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
@@ -698,27 +698,7 @@ WebInspector.CodeMirrorTextEditor.prototype = {
/**
* @param {string} mimeType
- */
- _updateCodeMirrorMode: function(mimeType)
- {
- this._codeMirror.setOption("mode", mimeType);
- WebInspector.CodeMirrorTextEditor._loadMimeTypeModes(mimeType, innerUpdateCodeMirrorMode.bind(this));
-
- /**
- * @this WebInspector.CodeMirrorTextEditor
- */
- function innerUpdateCodeMirrorMode()
- {
- this._mimeTypeModesLoadedForTest();
- this._updateCodeMirrorMode(mimeType);
- }
- },
-
- // Do not remove, this function is sniffed in tests.
- _mimeTypeModesLoadedForTest: function() { },
-
- /**
- * @param {string} mimeType
+ * @return {!Promise}
*/
setMimeType: function(mimeType)
{
@@ -726,7 +706,7 @@ WebInspector.CodeMirrorTextEditor.prototype = {
this._enableLongLinesMode();
else
this._disableLongLinesMode();
- this._updateCodeMirrorMode(mimeType);
+ return WebInspector.CodeMirrorTextEditor._loadMimeTypeModes(mimeType).then(() => this._codeMirror.setOption("mode", mimeType));
},
/**
@@ -1621,9 +1601,9 @@ WebInspector.CodeMirrorTextEditor._loadedMimeModeExtensions = new Set();
/**
* @param {string} mimeType
- * @param {function()} callback
+ * @return {!Promise}
*/
-WebInspector.CodeMirrorTextEditor._loadMimeTypeModes = function(mimeType, callback)
+WebInspector.CodeMirrorTextEditor._loadMimeTypeModes = function(mimeType)
{
var installed = WebInspector.CodeMirrorTextEditor._loadedMimeModeExtensions;
@@ -1650,8 +1630,7 @@ WebInspector.CodeMirrorTextEditor._loadMimeTypeModes = function(mimeType, callba
var promises = [];
for (var extension of modesToLoad)
promises.push(extension.instance().then(installMode.bind(null, extension)));
- if (promises.length)
- Promise.all(promises).then(callback);
+ return Promise.all(promises);
/**
* @param {!Runtime.Extension} extension
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/SourcesTextEditor.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698