Skip to content

Commit f91bee0

Browse files
committed
Re-read file content upon closing
1 parent 21e30e0 commit f91bee0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/server/editorServices.ts

+5
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,11 @@ namespace ts.server {
683683
* @param info The file that has been closed or newly configured
684684
*/
685685
closeOpenFile(info: ScriptInfo) {
686+
// Closing file should trigger re-reading the file content from disk. This is
687+
// because the user may chose to discard the buffer content before saving
688+
// to the disk, and the server's version of the file can be out of sync.
689+
info.svc.reloadFromFile(info.fileName);
690+
686691
var openFileRoots: ScriptInfo[] = [];
687692
var removedProject: Project;
688693
for (var i = 0, len = this.openFileRoots.length; i < len; i++) {

0 commit comments

Comments
 (0)