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

Log a warning when a widget is explicitly activated, but it does not accept focus #1604

Merged
merged 1 commit into from
Apr 10, 2018

Conversation

spoenemann
Copy link
Contributor

This does not really fix #1061, but it helps to find problems in that context.

private checkActivation(widget: Widget): Widget {
window.requestAnimationFrame(() => {
if (this.activeWidget !== widget) {
this.logger.warn("Widget was activated, but did not accept focus: " + widget.id);
Copy link
Contributor

Choose a reason for hiding this comment

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

I have tried it out (removed the if statement to always log); it worked. Unfortunately, this logging does not show up in the browser console but only in the backend console. I do not know whether it was on purpose, but if you would use console.warn instead of logger.warn, it would log to both places. What do you think?

screen shot 2018-03-30 at 09 40 57

[2018-03-30T07:40:52.944Z]  WARN: Theia/11837 on prprpr.fritz.box: Widget was activated, but did not accept focus: code-editor-opener:file:///Users/akos.kitta/Desktop/theia/.npmignore []

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does Electron support the browser console?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say; yes. (I have not tried it though.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we have any guideline on when to use console and when to use ILogger?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not aware of any.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this to console.warn.

Copy link
Member

Choose a reason for hiding this comment

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

console.warn is good, if you use ILogger it will end up only on the backend, via console you can log in the browser console and to the backend at the same time.

…es not accept focus

Signed-off-by: Miro Spönemann <miro.spoenemann@typefox.io>
@spoenemann spoenemann merged commit 637021b into master Apr 10, 2018
@spoenemann spoenemann deleted the msp_issue1061 branch April 10, 2018 09:16
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.

Application shell widgets must take focus on activation
3 participants