flattentree
bunsenstraat 11 months ago
parent bb419eb01f
commit 3b532e2383
  1. 6
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  2. 21
      libs/remix-ui/search/src/lib/context/context.tsx

@ -171,18 +171,18 @@ export class CodeParser extends Plugin {
await this.call('fileDecorator', 'clearFileDecorators')
setTimeout(async () => {
await this.importService.setFileTree()}
, 2000)
, 3000)
})
this.on('fileManager', 'fileAdded', async () => {
setTimeout(async () => {
await this.importService.setFileTree()}
, 2000)
, 3000)
})
this.on('fileManager', 'fileRemoved', async () => {
setTimeout(async () => {
await this.importService.setFileTree()}
, 2000)
, 3000)
})
this.on('fileManager', 'currentFileChanged', async () => {

@ -266,12 +266,18 @@ export const SearchProvider = ({ children = [], reducer = SearchReducer, initial
await value.reloadFile(file)
}
const updateFiles = async () => {
setTimeout(async () => {
setFiles(await getDirectory('/', plugin))
}, 2000)
}
useEffect(() => {
plugin.on('filePanel', 'setWorkspace', async (workspace) => {
value.setSearchResults(null)
value.clearUndo()
value.setCurrentWorkspace(workspace.name)
setFiles(await getDirectory('/', plugin))
await updateFiles()
})
plugin.on('fileManager', 'fileSaved', async (file) => {
await reloadStateForFile(file)
@ -280,15 +286,15 @@ export const SearchProvider = ({ children = [], reducer = SearchReducer, initial
plugin.on('fileManager', 'rootFolderChanged', async (file) => {
const workspace = await plugin.call('filePanel', 'getCurrentWorkspace')
if (workspace) value.setCurrentWorkspace(workspace.name)
setFiles(await getDirectory('/', plugin))
await updateFiles()
})
plugin.on('fs', 'workingDirChanged', async () => {
setFiles(await getDirectory('/', plugin))
await updateFiles()
})
plugin.on('fileManager', 'fileAdded', async (file) => {
setFiles(await getDirectory('/', plugin))
await updateFiles()
await reloadStateForFile(file)
})
plugin.on('fileManager', 'currentFileChanged', async (file) => {
@ -300,15 +306,14 @@ export const SearchProvider = ({ children = [], reducer = SearchReducer, initial
const workspace = await plugin.call('filePanel', 'getCurrentWorkspace')
if (workspace && workspace.name) {
value.setCurrentWorkspace(workspace.name)
setFiles(await getDirectory('/', plugin))
await updateFiles()
}
} catch (e) {
console.log(e)
}
}
setTimeout(async () => {
await fetchWorkspace()
}, 5000)
fetchWorkspace()
return () => {
plugin.off('fileManager', 'fileChanged')

Loading…
Cancel
Save