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

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

Issue 1264133002: Devtools: [WIP] Implement enhanced devtools extension language APIs Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modify override dropdown to apply to console completions & transpile Created 5 years, 4 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 /* 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 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 { 949 {
950 this._mimeType = mimeType; 950 this._mimeType = mimeType;
951 if (this._hasLongLines()) 951 if (this._hasLongLines())
952 this._enableLongLinesMode(); 952 this._enableLongLinesMode();
953 else 953 else
954 this._disableLongLinesMode(); 954 this._disableLongLinesMode();
955 this._updateCodeMirrorMode(); 955 this._updateCodeMirrorMode();
956 }, 956 },
957 957
958 /** 958 /**
959 * @return {string}
960 */
961 getMimeType: function() {
pfeldman 2015/08/13 21:15:47 no get prefixes in Blink please!
wes 2015/08/14 00:55:05 Understood! Is there a lint rule for this? :P
962 return this._mimeType;
963 },
964
965 /**
959 * @param {boolean} readOnly 966 * @param {boolean} readOnly
960 */ 967 */
961 setReadOnly: function(readOnly) 968 setReadOnly: function(readOnly)
962 { 969 {
963 this.element.classList.toggle("CodeMirror-readonly", readOnly); 970 this.element.classList.toggle("CodeMirror-readonly", readOnly);
964 this._codeMirror.setOption("readOnly", readOnly); 971 this._codeMirror.setOption("readOnly", readOnly);
965 }, 972 },
966 973
967 /** 974 /**
968 * @return {boolean} 975 * @return {boolean}
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 }, 1058 },
1052 1059
1053 _gutterClick: function(instance, lineNumber, gutter, event) 1060 _gutterClick: function(instance, lineNumber, gutter, event)
1054 { 1061 {
1055 this.dispatchEventToListeners(WebInspector.CodeMirrorTextEditor.Events.G utterClick, { lineNumber: lineNumber, event: event }); 1062 this.dispatchEventToListeners(WebInspector.CodeMirrorTextEditor.Events.G utterClick, { lineNumber: lineNumber, event: event });
1056 }, 1063 },
1057 1064
1058 _contextMenu: function(event) 1065 _contextMenu: function(event)
1059 { 1066 {
1060 var contextMenu = new WebInspector.ContextMenu(event); 1067 var contextMenu = new WebInspector.ContextMenu(event);
1068 event.consume(true); //Consume event now to prevent document from handli ng the async menu
1061 var target = event.target.enclosingNodeOrSelfWithClass("CodeMirror-gutte r-elt"); 1069 var target = event.target.enclosingNodeOrSelfWithClass("CodeMirror-gutte r-elt");
1070 var prom;
1062 if (target) 1071 if (target)
1063 this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(t arget.textContent, 10) - 1); 1072 prom = this._delegate.populateLineGutterContextMenu(contextMenu, par seInt(target.textContent, 10) - 1);
1064 else { 1073 else {
1065 var textSelection = this.selection(); 1074 var textSelection = this.selection();
1066 this._delegate.populateTextAreaContextMenu(contextMenu, textSelectio n.startLine, textSelection.startColumn); 1075 prom = this._delegate.populateTextAreaContextMenu(contextMenu, textS election.startLine, textSelection.startColumn);
1067 } 1076 }
1068 contextMenu.appendApplicableItems(this); 1077
1069 contextMenu.show(); 1078 prom.then(showAsync, showAsync);
wes 2015/08/14 00:55:05 By the way - showing the context menu async seems
1079 var _this = this;
1080 function showAsync() {
1081 contextMenu.appendApplicableItems(_this);
1082 contextMenu.show();
1083 }
1070 }, 1084 },
1071 1085
1072 /** 1086 /**
1073 * @param {number} lineNumber 1087 * @param {number} lineNumber
1074 * @param {boolean} disabled 1088 * @param {boolean} disabled
1075 * @param {boolean} conditional 1089 * @param {boolean} conditional
1076 */ 1090 */
1077 addBreakpoint: function(lineNumber, disabled, conditional) 1091 addBreakpoint: function(lineNumber, disabled, conditional)
1078 { 1092 {
1079 if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount()) 1093 if (lineNumber < 0 || lineNumber >= this._codeMirror.lineCount())
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 1544
1531 /** 1545 /**
1532 * @return {number} 1546 * @return {number}
1533 */ 1547 */
1534 get linesCount() 1548 get linesCount()
1535 { 1549 {
1536 return this._codeMirror.lineCount(); 1550 return this._codeMirror.lineCount();
1537 }, 1551 },
1538 1552
1539 /** 1553 /**
1554 * @return {?string}
1555 */
1556 get url()
1557 {
1558 return this._url;
1559 },
1560
1561 /**
1540 * @param {number} line 1562 * @param {number} line
1541 * @param {string} name 1563 * @param {string} name
1542 * @param {?Object} value 1564 * @param {?Object} value
1543 */ 1565 */
1544 setAttribute: function(line, name, value) 1566 setAttribute: function(line, name, value)
1545 { 1567 {
1546 if (line < 0 || line >= this._codeMirror.lineCount()) 1568 if (line < 0 || line >= this._codeMirror.lineCount())
1547 return; 1569 return;
1548 var handle = this._codeMirror.getLineHandle(line); 1570 var handle = this._codeMirror.getLineHandle(line);
1549 if (handle.attributes === undefined) handle.attributes = {}; 1571 if (handle.attributes === undefined) handle.attributes = {};
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 /** 2179 /**
2158 * @param {number} lineNumber 2180 * @param {number} lineNumber
2159 */ 2181 */
2160 scrollChanged: function(lineNumber) { }, 2182 scrollChanged: function(lineNumber) { },
2161 2183
2162 editorFocused: function() { }, 2184 editorFocused: function() { },
2163 2185
2164 /** 2186 /**
2165 * @param {!WebInspector.ContextMenu} contextMenu 2187 * @param {!WebInspector.ContextMenu} contextMenu
2166 * @param {number} lineNumber 2188 * @param {number} lineNumber
2189 * @return {!Promise}
2167 */ 2190 */
2168 populateLineGutterContextMenu: function(contextMenu, lineNumber) { }, 2191 populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
2169 2192
2170 /** 2193 /**
2171 * @param {!WebInspector.ContextMenu} contextMenu 2194 * @param {!WebInspector.ContextMenu} contextMenu
2172 * @param {number} lineNumber 2195 * @param {number} lineNumber
2173 * @param {number} columnNumber 2196 * @param {number} columnNumber
2197 * @return {!Promise}
2174 */ 2198 */
2175 populateTextAreaContextMenu: function(contextMenu, lineNumber, columnNumber) { }, 2199 populateTextAreaContextMenu: function(contextMenu, lineNumber, columnNumber) { },
2176 2200
2177 /** 2201 /**
2178 * @param {?WebInspector.TextRange} from 2202 * @param {?WebInspector.TextRange} from
2179 * @param {?WebInspector.TextRange} to 2203 * @param {?WebInspector.TextRange} to
2180 */ 2204 */
2181 onJumpToPosition: function(from, to) { } 2205 onJumpToPosition: function(from, to) { }
2182 } 2206 }
2183 2207
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 WebInspector.CodeMirrorMimeMode = function() 2274 WebInspector.CodeMirrorMimeMode = function()
2251 { 2275 {
2252 } 2276 }
2253 2277
2254 WebInspector.CodeMirrorMimeMode.prototype = { 2278 WebInspector.CodeMirrorMimeMode.prototype = {
2255 /** 2279 /**
2256 * @param {!Runtime.Extension} extension 2280 * @param {!Runtime.Extension} extension
2257 */ 2281 */
2258 install: function(extension) { } 2282 install: function(extension) { }
2259 } 2283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698