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
SCM Tab refresh on every keypress on editor #179441
Comments
This happens only when connected to remote dev environment and we have an active SCM plugin. I have tested with Git as well as my own custom SCM plugin. But I have not found my scm plugin code being called during that refresh icon popping up Recording.2023-04-07.103317.mp4 |
Recording.2023-04-07.103606.mp4Showing the tab and progress indicator as well |
I've narrowed it down to registration of quickDiffProvider. This function gets called on every keypress As soon as I register it, this behavior starts happening. I won't assume this is a fault of my plugin, as it happens for git plugin as well. |
@anandbibek, apologies for not getting back to you on this until now. Are you able to reproduce this issue with the latest Stable release of VS Code? There have been couple of known issues related to the quick diff provider that have been fixed since you have filed this issue. Thank you! |
I do see this happening every now and then, but the impact seems to have reduced a bit. Sometimes feels much faster if I just reload the window. Let me re-evaluate this and get back with latest observation. |
Hi @lszomoru , I just debugged my extension right now. I still see the function I don't think this is necessary. Maybe once every file save or maybe even less.. Problem is that every time it gets called, the autocomplete, suggestions, etc. and other editor functions get invoked only after that call returns. Introducing a clear delay in the interaction with editor. |
@anandbibek, I would really like to get to the bottom of this so I was wondering if you could provide more information so that I can attempt to reproduce the issue. Looking at the list of extensions that you have installed, is it safe to assume that you are using Remote-SSH in order to connect to your remote machine? Are you able to reproduce the same behaviour with all extensions disabled except Remote-SSH? Thank you! |
This would not happen if I disable all plugins. It needs at least one SCM plugin to be active and QuickDiff provider to be registered. I can reproduce this with git plugin or with my own SCM plugin I've developed. The delay and loading animation on UI is caused by repeated calls to I've personally debugged my own plugin and came to this conclusion. Yes, I do use remote-ssh and the issue shows up prominently on remote use case. But the actual RCA seems to be that above function should not get called on every keypress. It returns a static value in most cases and calling that repeatedly serves no real purpose. |
@alexr00, would you be able to take a look at this since it's related to the quick diff provider? |
Yes I will look. |
I went back and looked at version 1.70, and I can see that it did the same thing: call |
I've reverted the caching change as it's flawed. |
@alexr00 What's the issue you saw that made you revert it? I remember testing it. |
I was getting missing quick diffs from git. They could be triggered by:
Since this is an old issue I don't want to make a new fix so close to release. I also think that the best fix would be to give extensions API to announce when their quick diff base has changed, which should go through API review. Example: /**
* A quick diff provider provides a {@link Uri uri} to the original state of a
* modified resource. The editor will use this information to render ad'hoc diffs
* within the text.
*/
export interface QuickDiffProvider {
/**
* Provide a {@link Uri} to the original resource of any given resource uri.
*
* @param uri The uri of the resource open in a text editor.
* @param token A cancellation token.
* @returns A thenable that resolves to uri of the matching original resource.
*/
provideOriginalResource?(uri: Uri, token: CancellationToken): ProviderResult<Uri>;
/**
* **NEW API**
* Announce that the original resource has changed. This will trigger the editor to ask the provider for the original resource again.
* This should be implmented for performance reasons - e.g. if the provider is able to detect that the original resource has changed and fire this event,
* then `provideOriginalResoure` doesn't need to be called frequently and instead can be called only when there's an actual change.
*/
onDidChange?: Event<Uri | undefined | null | void>;
} |
Type: Bug
The issue is reproducible when connected to remote env via SSH and there is an active SCM system recognised.
Every keypress on the editor shows the SCM tab refreshing for a split second. This also somehow makes the code completion and suggestion popups appear after that SCM refresh is done. This causes an overall delay in working with the editor and getting suggestions.
VS Code version: Code 1.77.1 (b7886d7, 2023-04-04T23:21:11.906Z)
OS version: Windows_NT x64 10.0.22000
Modes:
Sandboxed: No
Remote OS version: Linux x64 5.4.17-2136.317.5.3.el8uek.x86_64
Remote OS version: Linux x64 5.4.17-2136.317.5.3.el8uek.x86_64
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Extensions (37)
(17 theme extensions excluded)
The text was updated successfully, but these errors were encountered: