-
Notifications
You must be signed in to change notification settings - Fork 37.3k
"Add Element to Chat" in integrated browser #286649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds "Add Element to Chat" functionality to the integrated browser, enabling users to select elements from browser views and attach them to chat conversations. The PR refactors the browser elements service architecture from using a BrowserType enum to a more flexible IBrowserTargetLocator interface that supports both webviews and browser views.
Key changes:
- Replaced
BrowserTypeenum withIBrowserTargetLocatorinterface for more flexible browser target identification - Added element selection functionality to integrated browser editor with new
SelectElementActionandselectElement()method - Extracted duplicate
getDisplayNameFromOuterHTMLfunction to a shared utility in the common layer
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/browserElements/common/browserElements.ts | Replaced BrowserType enum with IBrowserTargetLocator interface; added shared getDisplayNameFromOuterHTML utility function |
| src/vs/platform/browserElements/electron-main/nativeBrowserElementsMainService.ts | Updated to use IBrowserTargetLocator; refactored target finding logic to support both webview and browser view locators; removed magic number for title bar height |
| src/vs/workbench/services/browserElements/browser/browserElementsService.ts | Updated service interface signatures to use IBrowserTargetLocator |
| src/vs/workbench/services/browserElements/browser/webBrowserElementsService.ts | Updated method signatures and added async keyword for consistency |
| src/vs/workbench/services/browserElements/electron-browser/browserElementsService.ts | Updated to pass IBrowserTargetLocator to underlying service |
| src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.ts | Refactored to use webview IDs instead of URIs; removed duplicate getDisplayNameFromOuterHTML function; added title bar height offset |
| src/vs/workbench/contrib/browserView/electron-browser/browserEditor.ts | Added selectElement functionality with proper cleanup, context key management, and cancellation support |
| src/vs/workbench/contrib/browserView/electron-browser/browserViewActions.ts | Added SelectElementAction; removed precondition from ReloadAction; adjusted action ordering |
| src/vs/platform/browserView/electron-main/browserView.ts | Added webContents getter for external access |
| src/vs/platform/browserView/electron-main/browserViewMainService.ts | Added tryGetBrowserView method to retrieve browser views by ID |
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.ts:256
- The magic number 32.4 representing the title bar height should be extracted to a named constant to improve code maintainability and clarity. This value appears to be browser-specific UI measurement that could change.
height: editorContainerPosition.height - 32.4,
src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/browserView/electron-browser/browserViewActions.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.ts
Show resolved
Hide resolved
src/vs/platform/browserElements/electron-main/nativeBrowserElementsMainService.ts
Show resolved
Hide resolved
src/vs/platform/browserElements/electron-main/nativeBrowserElementsMainService.ts
Outdated
Show resolved
Hide resolved
|
@kycutler, PR build is 🔴 |
#286579