trigger search node in workspace

This commit is contained in:
codetypes committed 2024-04-26 10:06:57 +08:00
1 parent 82d1d89311
commit 21df9b7cca
6 files changed
+82 -80

No files matched your search

+4 -4
View File
@@ -99,11 +99,11 @@ const renameFile = (oldPath: string, newPath: string) => {
for (const editor of workspace.editors) {
if (isDirectory) {
if (editor.path.startsWith(oldPath)) {
editor.dispatch?.("rename", editor.path.replace(oldPath, newPath));
editor.dispatch("rename", editor.path.replace(oldPath, newPath));
}
} else {
if (editor.path === oldPath) {
editor.dispatch?.("rename", newPath);
editor.dispatch("rename", newPath);
}
}
}
@@ -496,12 +496,12 @@ export const Explorer: FC = () => {
fs.renameSync(node.path, newPath);
for (const editor of workspace.editors) {
if (editor.path.startsWith(node.path)) {
editor.dispatch?.("rename", dest!.path + "/" + Path.basename(editor.path));
editor.dispatch("rename", dest!.path + "/" + Path.basename(editor.path));
}
console.log("editor move", editor.path === newPath, editor.path, newPath);
if (editor.path.startsWith(newPath)) {
console.log("editor reload", editor.path === newPath, editor.path, newPath);
editor.dispatch?.("reload");
editor.dispatch("reload");
}
}
};