Fixed statusbar error when focusing to webview #181
Merged
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.
Hi Waldo,
I have seen that your extension is subscribed to
vscode.workspace.onDidOpenTextDocument
event. This subscription causes errors when there is no active TextEditor.1. A Webview is focused
First case is no big issue as it happens rarely, but still it should be fixed. :)
2. No open document
Second case, however, can easily become a real performance-killer when another extension decides to read up all AL files via VSCode api, thus emitting
onDidOpenTextDocument
event like 6000 times for a BaseApp.The fix
My proposed solution would be to move your statusbar update code from
workspace.onDidOpenTextDocument
towindow.onDidChangeActiveTextEditor
with some additional error checks to avoid unexpected exceptions.It would be a big help for me, as AL Studio is currently crashing during activation phase when AL XML Documentation is present, indirectly overloading VSCode by an event subscription in your extension. Simple times indeed :)
Thanks,
Marton