Skip to content

ui element selection #246643

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

Merged
merged 18 commits into from
Apr 25, 2025
Merged

ui element selection #246643

merged 18 commits into from
Apr 25, 2025

Conversation

justschen
Copy link
Collaborator

@justschen justschen commented Apr 15, 2025

allow users to attach UI elements to chat

@justschen justschen self-assigned this Apr 15, 2025

const buf = captured?.toJPEG(95);
return buf && VSBuffer.wrap(buf);
}

async getElementData(windowId: number | undefined, offsetX: number = 0, offsetY: number = 0, token?: CancellationToken): Promise<IElementData | undefined> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this takes a URI of the webview to target instead. To start picking, you would read the current URI (or maybe origin?) of the active (or last-active) webview from the IWebviewService and then find the target matching that URI here. Then you would not be tied to requiring the simple browser.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's a good idea. i think will maybe defer to next iteration and try this out


const margin = model.margin;
const x = margin[0];
const y = margin[1] + 32.4 + 35; // 32.4 is height of the title bar, 35 is height of the tab bar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably varies per platform and whether the custom titlebar is enabled or not

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm gonna try to pivot over to screenshotting the whole window + highlighting the element. if i can get that working, we won't need any funky calculations to grab screenshots like this

Copy link
Member

@connor4312 connor4312 Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what kind of model quality you get, my maybe outdated knowledge of vision is that they quantize subsections of the image into tokens and so a larger screenshot means the selected element gets less 'attention'. Though maybe adding some large buffer like 100px on each side around the selected element is good enough to give some extra context and titlebar buffer without going to the entire screen.

Copy link
Collaborator Author

@justschen justschen Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeahhh, i just tried both scenarios and it is very wonky how the screenshotting wants to work. the screenshot grabs everything on top, so having the buffer might capture things outside of the frame.

currently looking into how we can properly get the x/y/width of the frame, but i think i'll leave for now and explore other options next iteration, not sure if there is another good way to do this.

for (const group of groups) {

if (!(group instanceof EditorGroupView)) {
// TODO@jrieken better with https://github.com/microsoft/vscode/tree/ben/layout-group-container
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈 dupes the todo I should have taken care of ;-). @bpasero maybe it's time we make this more "offical"

}
}

export class SimpleBrowserOverlay implements IWorkbenchContribution {
Copy link
Member

@jrieken jrieken Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where we are going this but if editor overlays become "a thing" then we should make this more proper. We should have some kind of service where you register for an editor type and it calls you back to populate your overlay

@justschen justschen marked this pull request as ready for review April 25, 2025 16:45
Copy link

⚠️ This PR originates from a fork. Due to security restrictions, pipelines from forks are no longer triggered automatically. Learn more.

If the changes appear safe, you can manually trigger the pipeline by commenting /AzurePipelines run.

@vs-code-engineering vs-code-engineering bot added this to the April 2025 milestone Apr 25, 2025
@justschen justschen merged commit e3734c0 into microsoft:main Apr 25, 2025
7 checks passed
@bpasero bpasero mentioned this pull request Apr 27, 2025
4 tasks
@bpasero
Copy link
Member

bpasero commented Apr 27, 2025

I filed #247499 for follow up debt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants