-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
window.showTextDocument Performance Problems #12280
Comments
Could be due to this |
I was looking at this when debugging the problem, however, the vscode debugger for extensions doesn't work perfectly when it starts to dig into the vscode code. One work around I was thinking of that I couldn't find a way to do, is simply check if the file is currently showing in one of the editor windows. However it appears the only related call is the getter for activetexteditor, but this only gives you the active editor for the current window in focus. Is there a way to get the active editors for all the open windows? I.E can you get the editor that is currently open in the other windows when you have 2 or 3 files open side by side? |
I think |
It seems checking |
This problem affects Dart Code - I was going to try and implement this workaround, but the * @deprecated **This method is deprecated.**
* Use window.showTextDocument instead. This method shows unexpected behavior and will be removed in the next major update. Is there any other workaround for this that won't break in an upcoming update? |
@anthonydresser @DanTup Is opening the same document in the same editor column (basically a no-op) the slow case or when opening the same document in another column? |
@jrieken The no-op scenario is slow too. Our code is like this: vs.workspace.openTextDocument(location.file).then(document => {
vs.window.showTextDocument(document).then(editor => {
let range = toRange(location);
editor.revealRange(range, vs.TextEditorRevealType.InCenterIfOutsideViewport);
editor.selection = new vs.Selection(range.end, range.start);
});
}); We open the document then need the editor so that we can jump to the correct place. Even when everything is in one file there's a second delay between this code executing and the selection moving (inside the same file). |
Understood. The 1 second might come from here but I was assuming |
Actually, this should be easy to fix |
Great! Let me know if you'd like me to test with our code once it's in Insiders. |
Thanks - should be in insiders on Monday |
@jrieken this is working great in Insiders now, it's instant with no delay 👍 |
Marking as verified as per @DanTup's confirmation |
Steps to Reproduce:
window.showTextDocument seems to have performance problems (1-1.5 second promise resolve) when calling it with a document that is already in focus.
Calling showTextDocument on a document that is open but not in focus for one of the editor windows does not show this performance problem.
Edit: Clarification: This seems to be a performance problem specifically for the promise resolving. You can visually see the window come into focus in a reasonable amount of time, but the promise resolving with the editor object is greatly delayed.
The text was updated successfully, but these errors were encountered: