-
Notifications
You must be signed in to change notification settings - Fork 676
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
Debounce diagnostic requests #5089
Debounce diagnostic requests #5089
Conversation
return setTimeout(async () => { | ||
let value = await serverUtils.codeCheck(this._server, { FileName: null }, new vscode.CancellationTokenSource().token); | ||
private async _validateEntireWorkspace() { | ||
let value = await serverUtils.codeCheck(this._server, { FileName: null }, new vscode.CancellationTokenSource().token); |
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.
No need to use set Timeouts the debounce has already waited to execute this code.
} | ||
} | ||
|
||
private _onProjectAnalysis(event: protocol.ProjectDiagnosticStatus) { | ||
if (event.Status == DiagnosticStatus.Ready) { | ||
if (event.Status == DiagnosticStatus.Ready && | ||
event.ProjectFilePath === "(100 %)") { |
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.
We are currently getting Ready status updates from O# with "(0 %)" regularly. This was causing us to continually request updated diagnostics.
.asObservable() | ||
.pipe(throttleTime(3000)) | ||
.subscribe(async () => { | ||
.pipe(debounceTime(3000)) |
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.
throttle and debounce work similarly. Throttle fires on first request then ignores requests for a set amount of time. Debounce will wait for incoming requests to settle down before firing. This is an important distinction because we would want to wait for a users to be finished editing a document before requesting diagnostics.
@@ -122,7 +122,7 @@ class DiagnosticsProvider extends AbstractSupport { | |||
private _disposable: CompositeDisposable; | |||
private _diagnostics: vscode.DiagnosticCollection; | |||
private _validateCurrentDocumentPipe = new Subject<vscode.TextDocument>(); | |||
private _validateAllPipe = new Subject(); | |||
private _validateAllPipe = new Subject<string>(); |
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.
This was useful for debugging to see what event was causing all diagnostics to be requested.
Please take a look @nohwnd |
The latest version is completely unusable as everything is so slow. I assume this fix will only be released next month. Until then, is there a prerelease version we can use? We'll provide feedback if it solves the problem. |
@lonix1 if you set your o# version to latest, it should pick up the prerelease build with this change as soon as it finishes building. |
This change will not show up when you set |
Oh right, I forgot which repo I was on 😅. |
May contribute to #5085