@@ -97,14 +97,15 @@ export function createWatcher(args, { state, rebuild }) {
97
97
*
98
98
* @param {* } file
99
99
* @param {(() => Promise<string>) | null } content
100
+ * @param {boolean } skipPendingCheck
100
101
* @returns {Promise<void> }
101
102
*/
102
- function recordChangedFile ( file , content = null ) {
103
+ function recordChangedFile ( file , content = null , skipPendingCheck = false ) {
103
104
file = path . resolve ( file )
104
105
105
106
// Applications like Vim/Neovim fire both rename and change events in succession for atomic writes
106
107
// In that case rebuild has already been queued by rename, so can be skipped in change
107
- if ( pendingRebuilds . has ( file ) ) {
108
+ if ( pendingRebuilds . has ( file ) && ! skipPendingCheck ) {
108
109
return Promise . resolve ( )
109
110
}
110
111
@@ -198,8 +199,10 @@ export function createWatcher(args, { state, rebuild }) {
198
199
}
199
200
200
201
// This will push the rebuild onto the chain
202
+ // We MUST skip the rebuild check here otherwise the rebuild will never happen on Linux
203
+ // This is because the order of events and timing is different on Linux
201
204
// @ts -ignore: TypeScript isn't picking up that content is a string here
202
- await recordChangedFile ( filePath , ( ) => content )
205
+ await recordChangedFile ( filePath , ( ) => content , true )
203
206
} catch {
204
207
// If reading the file fails, it's was probably a deleted temporary file
205
208
// So we can ignore it and no rebuild is needed
0 commit comments