-
Notifications
You must be signed in to change notification settings - Fork 6
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
Update webview theme on editor theme change #85
Conversation
- added try/catch when handling theme change event - added logger for ThemeService and WebViewController
|
||
private async void HandleThemeChanges(ThemeChangedEventArgs e) | ||
{ | ||
try |
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.
I've added try/catch here :) In general every code that is handling event should be in the try/catch.
Also Task.Delay(100).Wait() was blocking UI thread, so changed the method signature to allow awaiting it.
"; | ||
|
||
public void SetLogger(ILog logger) | ||
{ |
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.
Controller can use logger now :)
|
||
public async void OnThemeChanged(object sender, IColorThemeChangedEvent e) | ||
{ | ||
try |
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.
Additional try/catch because we're handling event.
… UX) by increasing Task.Delay(1000) (from 100 ms): - Task.Delay() returns code execution to the main UI thread and IDE has enough time to change entire VS Theme
CLOSE https://linear.app/sourcegraph/issue/CODY-3622/webview-theme-should-update-on-theme-changed
vs_theme_change.mp4
Test Plan:
Try following the steps shown in the demo video above to switch theme and confirm the webview is updated accordingly.