Be nicer about where to open the results webview#1037
Merged
aeisenberg merged 5 commits intomainfrom Dec 15, 2021
Merged
Conversation
shati-patel
reviewed
Dec 7, 2021
Contributor
shati-patel
left a comment
There was a problem hiding this comment.
I wasn't sure how to review the actual code, but I tried opening webviews in various locations locally, and that worked as expected! 🕸️
Could you add a changelog entry for this PR?
Currently, the webview _always_ opens next to the currently active editor. This is a pain if you already have 2 columns open since this means that the webview will open in a third column, which is rarely what you want. This change uses a more sophisticated approach to opening the webview: 1. If there is only one column, open webview to the right of it 2. If there are multiple columns and the active editor is _not_ the last column, open to the right of the active editor 3. Otherwise open in the first column. This will avoid opening a new column unless there is only one column open right now. There is no native API that vscode exposed to compare column locations, so this uses the `ViewColumn` api is a slightly non-standard way. A limitation is that if the last column is empty and the active editor is to the left of it, then the webview will not be opened there (which would be nice). Instead, it will be opened in column 1.
58a4d3b to
33420c0
Compare
3 tasks
Contributor
Author
|
@shati-patel can I get another look at this one? |
shati-patel
approved these changes
Dec 15, 2021
Contributor
shati-patel
left a comment
There was a problem hiding this comment.
Ooops sorry, I completely forgot to approve this 🙈
Thanks for the ping!!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the webview always opens next to the currently active
editor. This is a pain if you already have 2 columns open since this
means that the webview will open in a third column, which is rarely
what you want.
This change uses a more sophisticated approach to opening the webview:
last column, open to the right of the active editor
This will avoid opening a new column unless there is only one column
open right now.
There is no native API that vscode exposed to compare column locations,
so this uses the
ViewColumnapi is a slightly non-standard way.A limitation is that if the last column is empty and the active editor
is to the left of it, then the webview will not be opened there (which
would be nice). Instead, it will be opened in column 1.
Checklist
@github/docs-content-codeqlhas been cc'd in all issues for UI or other user-facing changes made by this pull request.