Skip to content

Commit

Permalink
Merge pull request #5218 from JoeRobich/fix-activeeditor-change
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed May 20, 2022
2 parents 58b95a6 + ac09347 commit f5139a1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/features/fileOpenCloseProvider.ts
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

0 comments on commit f5139a1

Please sign in to comment.