Skip to content

Commit d24809d

Browse files
Samiya CaurDevtools-frontend LUCI CQ
authored andcommitted
Context menu opened via file editor should not display "Ask AI"
Bug: 373592099 Change-Id: I67a55030d52cd8058e9dd35ce1b34dfb4ac0faa3 Fixed: 373592099 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5932951 Reviewed-by: Ergün Erdoğmuş <[email protected]> Auto-Submit: Samiya Caur <[email protected]> Commit-Queue: Ergün Erdoğmuş <[email protected]>
1 parent 9112a77 commit d24809d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

front_end/panels/sources/SourcesPanel.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -905,12 +905,6 @@ export class SourcesPanel extends UI.Panel.Panel implements
905905
SDK.NetworkRequest.NetworkRequest|UISourceCodeFrame): void {
906906
if (target instanceof Workspace.UISourceCode.UISourceCode) {
907907
this.appendUISourceCodeItems(event, contextMenu, target);
908-
if (UI.ActionRegistry.ActionRegistry.instance().hasAction('drjones.sources-panel-context')) {
909-
UI.Context.Context.instance().setFlavor(Workspace.UISourceCode.UISourceCode, target);
910-
contextMenu.headerSection().appendAction(
911-
'drjones.sources-panel-context',
912-
);
913-
}
914908
return;
915909
}
916910
if (target instanceof UISourceCodeFrame) {
@@ -945,6 +939,17 @@ export class SourcesPanel extends UI.Panel.Panel implements
945939
jslogContext: 'sources.reveal-in-navigator-sidebar',
946940
});
947941
}
942+
943+
if (UI.ActionRegistry.ActionRegistry.instance().hasAction('drjones.sources-panel-context')) {
944+
const editorElement = this.element.querySelector('devtools-text-editor');
945+
if (!eventTarget.isSelfOrDescendant(editorElement)) {
946+
UI.Context.Context.instance().setFlavor(Workspace.UISourceCode.UISourceCode, uiSourceCode);
947+
contextMenu.headerSection().appendAction(
948+
'drjones.sources-panel-context',
949+
);
950+
}
951+
}
952+
948953
// Ignore list only works for JavaScript debugging.
949954
if (uiSourceCode.contentType().hasScripts() &&
950955
Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()

0 commit comments

Comments
 (0)