Delete theme files more selectively when regenerating them
Avoid deleting files that will be rewritten later, so that Zed won't observe states where themes are missing if two zed processes are running at once.
This commit is contained in:
@@ -449,7 +449,7 @@ async fn watch_themes(
|
||||
mut cx: AsyncAppContext,
|
||||
) -> Option<()> {
|
||||
let mut events = fs
|
||||
.watch("styles/src".as_ref(), Duration::from_millis(250))
|
||||
.watch("styles/src".as_ref(), Duration::from_millis(100))
|
||||
.await;
|
||||
while let Some(_) = events.next().await {
|
||||
let output = Command::new("npm")
|
||||
|
||||
@@ -11,7 +11,10 @@ const tempDirectory = fs.mkdtempSync(path.join(tmpdir(), 'build-themes'));
|
||||
// Clear existing themes
|
||||
for (const file of fs.readdirSync(themeDirectory)) {
|
||||
if (file.endsWith('.json')) {
|
||||
fs.unlinkSync(path.join(themeDirectory, file));
|
||||
const name = file.replace(/\.json$/, '');
|
||||
if (!themes.find(theme => theme.name === name)) {
|
||||
fs.unlinkSync(path.join(themeDirectory, file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user