| Index: Source/devtools/front_end/CodeMirrorTextEditor.js
|
| diff --git a/Source/devtools/front_end/CodeMirrorTextEditor.js b/Source/devtools/front_end/CodeMirrorTextEditor.js
|
| index 029f07fe4a4ff56d68ffe7bc35feebda5eb86d73..2dacbdbed567f8b1324035ac869ab14d1aeadc35 100644
|
| --- a/Source/devtools/front_end/CodeMirrorTextEditor.js
|
| +++ b/Source/devtools/front_end/CodeMirrorTextEditor.js
|
| @@ -46,6 +46,7 @@ importScript("cm/coffeescript.js");
|
| importScript("cm/php.js");
|
| importScript("cm/python.js");
|
| importScript("cm/shell.js");
|
| +importScript("CodeMirrorUtils.js");
|
|
|
| /**
|
| * @constructor
|
| @@ -163,10 +164,6 @@ WebInspector.CodeMirrorTextEditor = function(url, delegate)
|
| this.element.addEventListener("keydown", this._handleKeyDown.bind(this), true);
|
| this.element.tabIndex = 0;
|
|
|
| - this._overrideModeWithPrefixedTokens("css-base", "css-");
|
| - this._overrideModeWithPrefixedTokens("javascript", "js-");
|
| - this._overrideModeWithPrefixedTokens("xml", "xml-");
|
| -
|
| this._setupSelectionColor();
|
| this._setupWhitespaceHighlight();
|
| }
|
| @@ -453,17 +450,6 @@ WebInspector.CodeMirrorTextEditor.prototype = {
|
| return this._toRange(coords, coords);
|
| },
|
|
|
| - _convertTokenType: function(tokenType)
|
| - {
|
| - if (tokenType.startsWith("js-variable") || tokenType.startsWith("js-property") || tokenType === "js-def")
|
| - return "javascript-ident";
|
| - if (tokenType === "js-string-2")
|
| - return "javascript-regexp";
|
| - if (tokenType === "js-number" || tokenType === "js-comment" || tokenType === "js-string" || tokenType === "js-keyword")
|
| - return "javascript-" + tokenType.substring("js-".length);
|
| - return null;
|
| - },
|
| -
|
| /**
|
| * @param {number} lineNumber
|
| * @param {number} column
|
| @@ -476,7 +462,7 @@ WebInspector.CodeMirrorTextEditor.prototype = {
|
| var token = this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber, (column || 0) + 1));
|
| if (!token || !token.type)
|
| return null;
|
| - var convertedType = this._convertTokenType(token.type);
|
| + var convertedType = WebInspector.CodeMirrorUtils.convertTokenType(token.type);
|
| if (!convertedType)
|
| return null;
|
| return {
|
| @@ -557,38 +543,6 @@ WebInspector.CodeMirrorTextEditor.prototype = {
|
| return modeName;
|
| },
|
|
|
| - /**
|
| - * @param {string} modeName
|
| - * @param {string} tokenPrefix
|
| - */
|
| - _overrideModeWithPrefixedTokens: function(modeName, tokenPrefix)
|
| - {
|
| - var oldModeName = modeName + "-old";
|
| - if (CodeMirror.modes[oldModeName])
|
| - return;
|
| -
|
| - CodeMirror.defineMode(oldModeName, CodeMirror.modes[modeName]);
|
| - CodeMirror.defineMode(modeName, modeConstructor);
|
| -
|
| - function modeConstructor(config, parserConfig)
|
| - {
|
| - var innerConfig = {};
|
| - for (var i in parserConfig)
|
| - innerConfig[i] = parserConfig[i];
|
| - innerConfig.name = oldModeName;
|
| - var codeMirrorMode = CodeMirror.getMode(config, innerConfig);
|
| - codeMirrorMode.name = modeName;
|
| - codeMirrorMode.token = tokenOverride.bind(this, codeMirrorMode.token);
|
| - return codeMirrorMode;
|
| - }
|
| -
|
| - function tokenOverride(superToken, stream, state)
|
| - {
|
| - var token = superToken(stream, state);
|
| - return token ? tokenPrefix + token : token;
|
| - }
|
| - },
|
| -
|
| _enableLongLinesMode: function()
|
| {
|
| this._codeMirror.setOption("styleSelectedText", false);
|
|
|