Skip to content

Commit dc1e063

Browse files
committed
Support disabling AI features, PR feedback
1 parent 1b2ff99 commit dc1e063

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/vs/platform/browserElements/common/browserElements.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,19 @@ export interface IElementData {
2020
* Uses either the parent webview or browser view id to uniquely identify the target.
2121
*/
2222
export interface IBrowserTargetLocator {
23+
/**
24+
* Identifier of the parent webview hosting the target.
25+
*
26+
* Exactly one of {@link webviewId} or {@link browserViewId} should be provided.
27+
* Use this when the target is rendered inside a webview.
28+
*/
2329
readonly webviewId?: string;
30+
/**
31+
* Identifier of the browser view hosting the target.
32+
*
33+
* Exactly one of {@link webviewId} or {@link browserViewId} should be provided.
34+
* Use this when the target is rendered inside a browser view rather than a webview.
35+
*/
2436
readonly browserViewId?: string;
2537
}
2638

src/vs/platform/browserElements/electron-main/nativeBrowserElementsMainService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class NativeBrowserElementsMainService extends Disposable implements INat
4040

4141
/**
4242
* Find the webview target that matches the given locator.
43-
* Checks either parentWebviewOrigin or webContentsId depending on what's provided.
43+
* Checks either webviewId or browserViewId depending on what's provided.
4444
*/
4545
async findWebviewTarget(debuggers: Electron.Debugger, locator: IBrowserTargetLocator): Promise<string | undefined> {
4646
const { targetInfos } = await debuggers.sendCommand('Target.getTargets');

src/vs/workbench/contrib/browserView/electron-browser/browserViewActions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { BrowserEditor, CONTEXT_BROWSER_CAN_GO_BACK, CONTEXT_BROWSER_CAN_GO_FORW
1515
import { BrowserViewUri } from '../../../../platform/browserView/common/browserViewUri.js';
1616
import { IBrowserViewWorkbenchService } from '../common/browserView.js';
1717
import { BrowserViewStorageScope } from '../../../../platform/browserView/common/browserView.js';
18+
import { ChatContextKeys } from '../../chat/common/actions/chatContextKeys.js';
1819

1920
// Context key expression to check if browser editor is active
2021
const BROWSER_EDITOR_ACTIVE = ContextKeyExpr.equals('activeEditor', BrowserEditor.ID);
@@ -147,11 +148,13 @@ class SelectElementAction extends Action2 {
147148
title: localize2('browser.selectElementAction', 'Add Element to Chat'),
148149
icon: Codicon.inspect,
149150
f1: true,
151+
precondition: ChatContextKeys.enabled,
150152
toggled: CONTEXT_BROWSER_ELEMENT_SELECTION_ACTIVE,
151153
menu: {
152154
id: MenuId.BrowserActionsToolbar,
153155
group: 'actions',
154156
order: 1,
157+
when: ChatContextKeys.enabled
155158
}
156159
});
157160
}

src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ class SimpleBrowserOverlayController {
399399
this._store.add(autorun(r => {
400400

401401
const webviewId = activeIdObs.read(r);
402-
widget.setActiveLocator(webviewId ? { webviewId } : undefined);
403402

404403
if (!webviewId) {
405404
hide();

0 commit comments

Comments
 (0)