mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-06 06:41:56 +00:00
feat(web): show hidden directories in workspace browser (#1331)
* feat(web): show hidden directories in workspace browser Add optional includeHidden param to the machine list-directory RPC so the WorkspaceBrowser can toggle hidden (dot-prefixed) entries. Default remains filtered for backward compatibility; the toggle persists via localStorage. * fix(web): disable show-hidden toggle while directory loading Prevent overlapping list-directory requests with opposite includeHidden values; the toggle is now disabled while a directory load is active.
This commit is contained in:
@@ -56,6 +56,7 @@ interface PathExistsRequest {
|
||||
|
||||
interface ListMachineDirectoryRequest {
|
||||
path: string
|
||||
includeHidden?: boolean
|
||||
}
|
||||
|
||||
interface CursorChatStoreStatusRequest {
|
||||
@@ -168,6 +169,8 @@ export class ApiMachineClient {
|
||||
return { success: false, error: 'Path is required' }
|
||||
}
|
||||
|
||||
const includeHidden = params?.includeHidden === true
|
||||
|
||||
const targetPath = await this.resolveForWorkspaceCheck(rawPath)
|
||||
if (!this.isWithinWorkspaceRoots(targetPath)) {
|
||||
return { success: false, error: 'Path is outside workspace roots' }
|
||||
@@ -183,7 +186,7 @@ export class ApiMachineClient {
|
||||
const entries: MachineDirectoryEntry[] = []
|
||||
|
||||
await Promise.all(dirEntries.map(async (entry) => {
|
||||
if (entry.name.startsWith('.')) return
|
||||
if (!includeHidden && entry.name.startsWith('.')) return
|
||||
|
||||
const fullPath = join(targetPath, entry.name)
|
||||
let type: 'file' | 'directory' | 'other' = 'other'
|
||||
|
||||
Reference in New Issue
Block a user