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

Unified Diff: Source/devtools/front_end/sources/UISourceCodeFrame.js

Issue 1264133002: Devtools: [WIP] Implement enhanced devtools extension language APIs Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Small cleanups - prefer URIs to contentURLs, revert protocol unifications, remove lambdas 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/sources/UISourceCodeFrame.js
diff --git a/Source/devtools/front_end/sources/UISourceCodeFrame.js b/Source/devtools/front_end/sources/UISourceCodeFrame.js
index a6cdd620ad306077d3b56b422677a36ddb58f370..a46bd962f87b1490faf8d55634fbfcffd13c6aa4 100644
--- a/Source/devtools/front_end/sources/UISourceCodeFrame.js
+++ b/Source/devtools/front_end/sources/UISourceCodeFrame.js
@@ -114,6 +114,11 @@ WebInspector.UISourceCodeFrame.prototype = {
this._uiSourceCode.resetWorkingCopy();
else
this._uiSourceCode.setWorkingCopyGetter(this._textEditor.text.bind(this._textEditor));
+ WebInspector.workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeEdited, {
+ range: oldRange,
+ replacement: this._textEditor.copyRange(newRange),
+ uiSourceCode: this._uiSourceCode
+ });
delete this._muteSourceCodeEvents;
},
@@ -168,12 +173,39 @@ WebInspector.UISourceCodeFrame.prototype = {
delete this._isSettingContent;
},
+ /**
+ * @override
+ * @return {!Promise}
+ */
populateTextAreaContextMenu: function(contextMenu, lineNumber, columnNumber)
{
- WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber, columnNumber);
- contextMenu.appendApplicableItems(this._uiSourceCode);
- contextMenu.appendApplicableItems(new WebInspector.UILocation(this._uiSourceCode, lineNumber, columnNumber));
- contextMenu.appendSeparator();
+ /**
+ * @this {WebInspector.UISourceCodeFrame}
+ */
+ function appendItems() {
+ contextMenu.appendApplicableItems(this._uiSourceCode);
+ contextMenu.appendApplicableItems(new WebInspector.UILocation(this._uiSourceCode, lineNumber, columnNumber));
+ contextMenu.appendSeparator();
+ }
+
+ return WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber, columnNumber).then((function(){
+ var mimeType = WebInspector.ResourceType.mimeFromURL(this._uiSourceCode.uri());
+ if (!mimeType) {
+ return;
+ }
+ if (!WebInspector.languageService.handles.populateContextMenu(mimeType)) {
+ return;
+ }
+ return WebInspector.languageService.populateContextMenu(mimeType, {
+ source: this._uiSourceCode.uri(),
+ line: lineNumber,
+ column: columnNumber
+ }).then(function(items) {
+ items.forEach(function(elem) {
+ contextMenu.appendItem(elem.text, elem.callback);
+ });
+ });
+ }).bind(this)).then(appendItems.bind(this), appendItems.bind(this)); //Ignore failure in language service handler
},
/**
« no previous file with comments | « Source/devtools/front_end/sources/SourcesView.js ('k') | Source/devtools/front_end/sources/WatchExpressionsSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698