-
Notifications
You must be signed in to change notification settings - Fork 323
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
Always call launchUrlVSCode, error or not #6780
Merged
kenzieschmoll
merged 1 commit into
flutter:master
from
DanTup:always-call-vs-code-launch-url
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
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.
would it be better to just call
launchUrlVSCode
by default whenideTheme.embed
== true? instead of attempting to call something we expect to fail?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.
for example, what if at some point,
url_launcher.launchUrl
starts working for the embedded environment? then we'd be launching the url twice.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.
We don't expect
launchUrlVSCode
to fail, it will just silently do nothing (it'llpostMessage
but nobody is listening).We can check that though - is there any possibility of ending up here without it being on
globals
? (I don't think so, but it feels slightly riskier than the change to just call this when an exception occurs for a cherry-pick)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.
Maybe my comment "we could fail" above is a bit misleading - it's referring to the existing
url_launcher
code.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.
Okay, yeah since we were already always calling
launchUrlVSCode
, then putting this infinally
is probably safer. So the real change here is just wrapping in atry
block to swallow the exception.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.
Just to be clear - the
launchUrlVSCode
method does not throw, the issue was thaturl_launcher.launchUrl
would sometimes throw (in the previous version, not the current stable).This code was originally written to always call
launchUrlVSCode
, but in the case whereurl_launcher.launchUrl
throws (something we never expected but was happening in the previous stable), it would be skipped.My change here just moves
launchUrlVSCode
into afinally
block so that it will be called also ifurl_launcher.launchUrl
throws, and not only if it completed without exception.I didn't use a
catch
because I didn't want to mask the original (unexpected) exception if it comes back, but this way we'll at least still open the URL from VS Code instead of silently doing nothing.