Skip to content
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

viewer: bring focus to editor if it already exists #5631

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extensions/positron-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"menus": {
"explorer/context": [
{
"when": "resourceLangId == html",
"when": "resourceLangId == html && resourceScheme == file",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since the tab is technically not "looking at a file", this allows source html to keep the eye icon to open in viewer, but it should not show up at all for viewer->editor tabs!

Copy link
Contributor

Choose a reason for hiding this comment

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

Works great!

"command": "positronProxy.showHtmlPreview",
"group": "navigation"
}
],
"editor/title": [
{
"when": "resourceLangId == html",
"when": "resourceLangId == html && resourceScheme == file",
"command": "positronProxy.showHtmlPreview",
"group": "navigation"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ export class PositronPreviewService extends Disposable implements IPositronPrevi

public async openEditor(uri: URI, title?: string): Promise<void> {
// Create and store webview overlay for editor
const previewId = `editorPreview.${PositronPreviewService._previewIdCounter++}`;
// We use the URI to attempt to bring focus to an editor if it already exists
const previewId = `editorPreview.${uri.toString()}`;
this._editors.set(previewId, {
uri: uri,
webview: this.createPreviewUrl(previewId, undefined, uri),
Expand Down
Loading