@@ -20,10 +20,14 @@ export class DocumentManager implements Disposable {
20
20
this . _client = client ;
21
21
}
22
22
23
- private _shouldSyncDocument ( e : PartialDocument ) : boolean {
23
+ private _shouldSyncDocument (
24
+ e : PartialDocument ,
25
+ changes ?: readonly vscode . TextDocumentContentChangeEvent [ ]
26
+ ) : boolean {
24
27
return (
25
28
e . languageId === 'php' &&
26
29
! e . isDirty &&
30
+ ( ! changes || changes . length === 0 ) &&
27
31
[ 'file' , 'vscode-vfs' , 'git' , 'vscode-remote' ] . includes (
28
32
e . uri . scheme
29
33
)
@@ -54,24 +58,26 @@ export class DocumentManager implements Disposable {
54
58
} ;
55
59
}
56
60
57
- private async _onDocumentChange ( e : vscode . TextDocument ) : Promise < void > {
58
- if ( this . _isConfigFile ( e ) ) {
61
+ private async _onDocumentChange (
62
+ e : vscode . TextDocumentChangeEvent
63
+ ) : Promise < void > {
64
+ if ( this . _isConfigFile ( e . document ) ) {
59
65
debug ( 'configChange' , {
60
- filePath : sanitizeFilePath ( e . uri . fsPath ) ,
66
+ filePath : sanitizeFilePath ( e . document . uri . fsPath ) ,
61
67
} ) ;
62
68
await this . _client . sendNotification ( watcherNotification , {
63
69
operation : 'onConfigChange' ,
64
- file : this . _toSendData ( e ) ,
70
+ file : this . _toSendData ( e . document ) ,
65
71
} ) ;
66
72
}
67
- if ( this . _shouldSyncDocument ( e ) ) {
73
+ if ( this . _shouldSyncDocument ( e . document , e . contentChanges ) ) {
68
74
debug ( 'documentChange' , {
69
75
checking : true ,
70
- filePath : sanitizeFilePath ( e . uri . fsPath ) ,
76
+ filePath : sanitizeFilePath ( e . document . uri . fsPath ) ,
71
77
} ) ;
72
78
await this . _client . sendNotification ( watcherNotification , {
73
79
operation : 'change' ,
74
- file : this . _toSendData ( e ) ,
80
+ file : this . _toSendData ( e . document ) ,
75
81
} ) ;
76
82
}
77
83
}
@@ -177,7 +183,7 @@ export class DocumentManager implements Disposable {
177
183
178
184
this . _disposables . push (
179
185
vscode . workspace . onDidChangeTextDocument ( ( e ) => {
180
- void this . _onDocumentChange ( e . document ) ;
186
+ void this . _onDocumentChange ( e ) ;
181
187
} )
182
188
) ;
183
189
0 commit comments