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

Fire a buffer update instead of filechanged when active editor changes #5218

Merged
merged 2 commits into from
May 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/features/fileOpenCloseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,18 @@ class FileOpenCloseProvider implements IDisposable {
return;
}

await serverUtils.filesChanged(this._server, [{ FileName: e.document.fileName }]);
// This handler is attempting to alert O# that the current file has changed and
// to update diagnostics. This is necessary because O# does not recompute all diagnostics
// for the projects affected when code files are changed. We want to at least provide
// up to date diagnostics for the active document.
//
// The filesChanges service notifies O# that files have changed on disk. This causes
// the document to be reloaded from disk. If there were unsaved changes in VS Code then
// the server is no longer aware of those changes. This is not a good fit for our needs.
//
// Instead we will update the buffer for the current document which causes diagnostics to be
// recomputed.
await serverUtils.updateBuffer(this._server, { FileName: e.document.fileName, Buffer: e.document.getText() });
}

dispose = () => this._disposable.dispose();
Expand Down