forked from quickshell/quickshell
core/reloader: fix file watcher compatibility with vscode
This commit is contained in:
parent
f90bef2d99
commit
3bbf39c67e
1 changed files with 5 additions and 0 deletions
|
@ -222,6 +222,11 @@ void EngineGeneration::onFileChanged(const QString& name) {
|
|||
if (!this->watcher->files().contains(name)) {
|
||||
this->deletedWatchedFiles.push_back(name);
|
||||
} else {
|
||||
// some editors (e.g vscode) perform file saving in two steps: truncate + write
|
||||
// ignore the first event (truncate) with size 0 to prevent incorrect live reloading
|
||||
auto fileInfo = QFileInfo(name);
|
||||
if (fileInfo.isFile() && fileInfo.size() == 0) return;
|
||||
|
||||
emit this->filesChanged();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue