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

Side by Side Diff: Source/devtools/front_end/CodeMirrorTextEditor.js

Issue 18341003: DevTools: [CodeMirror] Add syntax highlighting for some other languages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 importScript("cm/codemirror.js"); 31 importScript("cm/codemirror.js");
32 importScript("cm/css.js"); 32 importScript("cm/css.js");
33 importScript("cm/javascript.js"); 33 importScript("cm/javascript.js");
34 importScript("cm/xml.js"); 34 importScript("cm/xml.js");
35 importScript("cm/htmlmixed.js"); 35 importScript("cm/htmlmixed.js");
36
36 importScript("cm/matchbrackets.js"); 37 importScript("cm/matchbrackets.js");
37 importScript("cm/closebrackets.js"); 38 importScript("cm/closebrackets.js");
38 importScript("cm/markselection.js"); 39 importScript("cm/markselection.js");
39 importScript("cm/showhint.js"); 40 importScript("cm/showhint.js");
40 importScript("cm/comment.js"); 41 importScript("cm/comment.js");
41 importScript("cm/overlay.js"); 42 importScript("cm/overlay.js");
42 43
44 importScript("cm/htmlembedded.js");
45 importScript("cm/clike.js");
46 importScript("cm/coffeescript.js");
47 importScript("cm/php.js");
48 importScript("cm/python.js");
49 importScript("cm/shell.js");
50
43 /** 51 /**
44 * @constructor 52 * @constructor
45 * @extends {WebInspector.View} 53 * @extends {WebInspector.View}
46 * @implements {WebInspector.TextEditor} 54 * @implements {WebInspector.TextEditor}
47 * @param {?string} url 55 * @param {?string} url
48 * @param {WebInspector.TextEditorDelegate} delegate 56 * @param {WebInspector.TextEditorDelegate} delegate
49 */ 57 */
50 WebInspector.CodeMirrorTextEditor = function(url, delegate) 58 WebInspector.CodeMirrorTextEditor = function(url, delegate)
51 { 59 {
52 WebInspector.View.call(this); 60 WebInspector.View.call(this);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 * @param {string} mimeType 479 * @param {string} mimeType
472 */ 480 */
473 set mimeType(mimeType) 481 set mimeType(mimeType)
474 { 482 {
475 if (this._hasLongLines()) 483 if (this._hasLongLines())
476 this._enableLongLinesMode(); 484 this._enableLongLinesMode();
477 else 485 else
478 this._disableLongLinesMode(); 486 this._disableLongLinesMode();
479 var showWhitespaces = WebInspector.settings.showWhitespacesInEditor.get( ); 487 var showWhitespaces = WebInspector.settings.showWhitespacesInEditor.get( );
480 this._codeMirror.setOption("mode", showWhitespaces ? this._whitespaceOve rlayMode(mimeType) : mimeType); 488 this._codeMirror.setOption("mode", showWhitespaces ? this._whitespaceOve rlayMode(mimeType) : mimeType);
481 switch (mimeType) { 489 switch (mimeType) {
apavlov 2013/07/01 12:46:48 Remove themes
482 case "text/html": this._codeMirror.setOption("theme", "web-inspector-htm l"); break; 490 case "text/html":
491 this._codeMirror.setOption("theme", "web-inspector-html");
492 break;
483 case "text/css": 493 case "text/css":
484 case "text/x-scss": 494 case "text/x-scss":
485 this._codeMirror.setOption("theme", "web-inspector-css"); 495 this._codeMirror.setOption("theme", "web-inspector-css");
486 break; 496 break;
487 case "text/javascript": this._codeMirror.setOption("theme", "web-inspect or-js"); break; 497 case "text/javascript":
498 this._codeMirror.setOption("theme", "web-inspector-js");
499 break;
500 default:
501 this._codeMirror.setOption("theme", "default");
502 break;
488 } 503 }
489 }, 504 },
490 505
491 /** 506 /**
492 * @param {boolean} readOnly 507 * @param {boolean} readOnly
493 */ 508 */
494 setReadOnly: function(readOnly) 509 setReadOnly: function(readOnly)
495 { 510 {
496 this._codeMirror.setOption("readOnly", readOnly ? "nocursor" : false); 511 this._codeMirror.setOption("readOnly", readOnly ? "nocursor" : false);
497 }, 512 },
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 var modifierKey = WebInspector.isMac() ? "Alt" : "Ctrl"; 1227 var modifierKey = WebInspector.isMac() ? "Alt" : "Ctrl";
1213 var leftKey = modifierKey + "-Left"; 1228 var leftKey = modifierKey + "-Left";
1214 var rightKey = modifierKey + "-Right"; 1229 var rightKey = modifierKey + "-Right";
1215 var keyMap = {}; 1230 var keyMap = {};
1216 keyMap[leftKey] = moveLeft.bind(this, false); 1231 keyMap[leftKey] = moveLeft.bind(this, false);
1217 keyMap[rightKey] = moveRight.bind(this, false); 1232 keyMap[rightKey] = moveRight.bind(this, false);
1218 keyMap["Shift-" + leftKey] = moveLeft.bind(this, true); 1233 keyMap["Shift-" + leftKey] = moveLeft.bind(this, true);
1219 keyMap["Shift-" + rightKey] = moveRight.bind(this, true); 1234 keyMap["Shift-" + rightKey] = moveRight.bind(this, true);
1220 codeMirror.addKeyMap(keyMap); 1235 codeMirror.addKeyMap(keyMap);
1221 } 1236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698