Skip to content

Commit f5139a1

Browse files
authored
Merge pull request #5218 from JoeRobich/fix-activeeditor-change
2 parents 58b95a6 + ac09347 commit f5139a1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/features/fileOpenCloseProvider.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,18 @@ class FileOpenCloseProvider implements IDisposable {
5959
return;
6060
}
6161

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

6576
dispose = () => this._disposable.dispose();

0 commit comments

Comments
 (0)