File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff 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 ( ) ;
You can’t perform that action at this time.
0 commit comments