-
Notifications
You must be signed in to change notification settings - Fork 111
Add Show excluded files setting for the explorer
#217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ import { | |
| useEffect, | ||
| useRef, | ||
| useState, | ||
| useSyncExternalStore, | ||
| type KeyboardEvent as ReactKeyboardEvent, | ||
| type MouseEvent as ReactMouseEvent, | ||
| type ReactNode, | ||
|
|
@@ -25,6 +26,10 @@ import { | |
| type NameIssue, | ||
| } from "../lib/fileName"; | ||
| import { useLockOverscroll } from "../hooks/useLockOverscroll"; | ||
| import { | ||
| loadShowExcludedFiles, | ||
| subscribeShowExcludedFiles, | ||
| } from "../lib/appearance"; | ||
| import { | ||
| createParentOf, | ||
| dirsTouchedByCreate, | ||
|
|
@@ -95,6 +100,7 @@ type TreeCtxValue = { | |
| renaming: string | null; | ||
| cutPath: string | null; | ||
| epoch: number; | ||
| showExcludedFiles: boolean; | ||
| gitStatuses?: GitStatusMap; | ||
| onToggle: (path: string) => void; | ||
| onSelect: (path: string) => void; | ||
|
|
@@ -239,6 +245,11 @@ export const FileTree = memo(function FileTree({ | |
| const [menu, setMenu] = useState<MenuState | null>(null); | ||
| const [opError, setOpError] = useState<string | null>(null); | ||
| const [epoch, setEpoch] = useState(0); | ||
| const showExcludedFiles = useSyncExternalStore( | ||
| subscribeShowExcludedFiles, | ||
| loadShowExcludedFiles, | ||
| loadShowExcludedFiles, | ||
| ); | ||
| const creatingRef = useRef(creating); | ||
| creatingRef.current = creating; | ||
| const rootRef = useRef<HTMLDivElement>(null); | ||
|
|
@@ -602,6 +613,7 @@ export const FileTree = memo(function FileTree({ | |
| renaming, | ||
| cutPath: clip?.mode === "cut" ? clip.path : null, | ||
| epoch, | ||
| showExcludedFiles, | ||
| gitStatuses, | ||
| onToggle: toggle, | ||
| onSelect, | ||
|
|
@@ -840,8 +852,11 @@ function TreeChildren({ | |
| onCancel={() => ctx.onCreateCancel(creating.id)} | ||
| /> | ||
| ) : null; | ||
| const folders = entries?.filter((e) => e.isDir) ?? []; | ||
| const files = entries?.filter((e) => !e.isDir) ?? []; | ||
| const visible = ctx.showExcludedFiles | ||
| ? entries | ||
| : entries?.filter((e) => !e.ignored); | ||
| const folders = visible?.filter((e) => e.isDir) ?? []; | ||
| const files = visible?.filter((e) => !e.isDir) ?? []; | ||
| const pad = { paddingLeft: 28 + depth * 12 }; | ||
|
|
||
| return ( | ||
|
Comment on lines
852
to
862
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win The new tree-level behavior has no consumer coverage: the existing FileTree fixtures contain no 🤖 Prompt for AI Agents |
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.