pull/2257/head^2
bunsenstraat 3 years ago committed by yann300
parent beb47308ff
commit 64d624e4c6
  1. 16
      libs/remix-ui/search/src/lib/context/context.tsx

@ -111,7 +111,7 @@ export const SearchProvider = ({
payload: value
})
},
setSearchResults(value: SearchResult[]) {
setSearchResults(value: SearchResult[]) {
dispatch({
type: 'SET_SEARCH_RESULTS',
payload: value
@ -285,6 +285,7 @@ export const SearchProvider = ({
},
clearStats: () => {
plugin.call('editor', 'discardHighlight')
dispatch({
type: 'CLEAR_STATS',
payload: undefined
@ -320,6 +321,12 @@ export const SearchProvider = ({
await reloadStateForFile(file)
await checkUndoState(file)
})
plugin.on('fileManager', 'rootFolderChanged', async file => {
const workspace = await plugin.call('filePanel', 'getCurrentWorkspace')
if(workspace) value.setCurrentWorkspace(workspace.name)
setFiles(await getDirectory('/', plugin))
})
plugin.on('fileManager', 'fileAdded', async file => {
setFiles(await getDirectory('/', plugin))
await reloadStateForFile(file)
@ -328,6 +335,13 @@ export const SearchProvider = ({
value.setCurrentFile(file)
await checkUndoState(file)
})
async function fetchWorkspace() {
const workspace = await plugin.call('filePanel', 'getCurrentWorkspace')
if(workspace) value.setCurrentWorkspace(workspace.name)
setFiles(await getDirectory('/', plugin))
}
fetchWorkspace()
return () => {
plugin.off('fileManager', 'fileChanged')

Loading…
Cancel
Save