Skip to content

Commit 5a84dcd

Browse files
authored
1 parent 324385a commit 5a84dcd

9 files changed

Lines changed: 377 additions & 334 deletions

File tree

.github/agents/extension-developer.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ class WikiTreeDataProvider implements vscode.TreeDataProvider<WikiItem> {
104104

105105
```typescript
106106
const disposables: vscode.Disposable[] = [];
107-
disposables.push(
108-
vscode.commands.registerCommand('workspaceWiki.refreshTree', () => provider.refresh())
109-
);
107+
disposables.push(vscode.commands.registerCommand('workspaceWiki.refreshTree', () => provider.refresh()));
110108
return vscode.Disposable.from(...disposables);
111109
```
112110

docs/architecture/preview-controller.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,21 @@ See also: [Settings Manager](./settings.md)
4545
```mermaid
4646
sequenceDiagram
4747
participant User as User
48-
participant Tree as Workspace Wiki Tree
49-
participant Controller as Preview/Open Controller
50-
participant Editor as VS Code Editor
51-
User->>Tree: Click file
52-
Tree->>Controller: Request open (preview/editor)
53-
Controller->>Editor: Open file (preview or editor)
48+
participant Tree as Tree View
49+
participant Handler as handleFileClick
50+
participant Command as VS Code
51+
User->>Tree: Single Click
52+
Tree->>Handler: Trigger Click Handler
53+
activate Handler
54+
Handler->>Handler: Check Click Time
55+
alt Single Click (< 500ms)
56+
Handler->>Command: Execute Default Command
57+
Command->>User: Open Preview
58+
else Double Click (< 500ms apart)
59+
Handler->>Command: Execute vscode.open
60+
Command->>User: Open in Editor
61+
end
62+
deactivate Handler
5463
```
5564

56-
This diagram shows how user actions in the tree trigger file opening in preview or editor mode.
65+
This diagram shows the double-click detection flow: single clicks open files in preview mode (using the configured `openWith` command), while double clicks within 500ms open files in the full editor.

docs/architecture/scanner.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,30 @@ See also: [Settings Manager](./settings.md)
5656

5757
```mermaid
5858
flowchart TD
59-
A[Start Scan] --> B{Find Files}
60-
B -->|Supported Extensions| C[Collect Metadata]
61-
C --> D[Cache Metadata]
62-
D --> E[Watch for Changes]
63-
E -->|File Changed| B
59+
A[Start Scan] --> B[Read Config]
60+
B -->|Get supportedExtensions| C[Set Extension Patterns]
61+
B -->|Get excludeGlobs| D[Set Exclude Patterns]
62+
B -->|Check showIgnoredFiles| E{Read .gitignore?}
63+
E -->|Yes| F[Parse .gitignore]
64+
E -->|No| G[Find Files]
65+
F --> H[Merge Exclude Patterns]
66+
H --> G
67+
C --> G
68+
D --> G
69+
G -->|Pattern Matching| I[Get File URIs]
70+
I -->|README Filter| J[Handle README Matching]
71+
I -->|Hidden Files Filter| K{showHiddenFiles?}
72+
K -->|No| L[Exclude Dot Files]
73+
K -->|Yes| M[Include All Files]
74+
J --> N{Depth OK?}
75+
N -->|Yes| O[Return Files]
76+
N -->|No| P[Skip Deep Files]
77+
P --> O
78+
L --> N
79+
M --> N
80+
O --> Q[Setup File Watcher]
81+
Q --> R[Watch for Changes]
82+
R -->|File Changed| G
6483
```
6584

66-
This diagram shows the scanning process: finding files, collecting and caching metadata, and watching for changes.
85+
This diagram shows the core scanning process: reading configuration, matching file patterns, filtering by various rules, and watching for changes.

docs/architecture/settings.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ The Settings Manager reads and applies user configuration for the Workspace Wiki
88

99
- `workspaceWiki.supportedExtensions`: File types to scan (default: `md`, `markdown`, `txt`).
1010
- If `md` or `markdown` is included, files named `README` (no extension, case-insensitive) are also included and treated as Markdown.
11-
- `workspaceWiki.excludeGlobs`: Patterns to exclude (e.g., `**/node_modules/**`).
12-
- `workspaceWiki.maxSearchDepth`: Limit scan depth for large repos.
13-
- `workspaceWiki.showIgnoredFiles`: Show files listed in .gitignore and excludeGlobs (default: false).
14-
- `workspaceWiki.showHiddenFiles`: Show hidden files/folders starting with a dot (default: false).
11+
- `workspaceWiki.excludeGlobs`: Glob patterns to exclude files and folders (default: `**/node_modules/**`, `**/.git/**`).
12+
- `workspaceWiki.maxSearchDepth`: Maximum directory depth to search for documentation files (default: `10`).
13+
- `workspaceWiki.showIgnoredFiles`: Show files listed in `.gitignore` and matched by `excludeGlobs` patterns (default: `false`).
14+
- `workspaceWiki.showHiddenFiles`: Show hidden files and folders starting with a dot (e.g., `.github`, `.env`) (default: `false`).
1515

1616
### File Opening & Display
1717

18-
- `workspaceWiki.defaultOpenMode`: `preview` or `editor`.
19-
- `workspaceWiki.openWith`: Commands to use for opening different file types.
20-
- `workspaceWiki.directorySort`: How to sort files and folders (default: "files-first").
18+
- `workspaceWiki.defaultOpenMode`: `preview` or `editor` (default: `preview`).
19+
- `workspaceWiki.openWith`: Commands to use for opening different file types (default: `markdown.showPreview` for `.md`/`.markdown`, `vscode.open` for `.txt`).
20+
- `workspaceWiki.directorySort`: How to sort files and folders: `files-first`, `folders-first`, or `alphabetical` (default: `files-first`).
2121

2222
### Title Formatting
2323

24-
- `workspaceWiki.acronymCasing`: Acronyms to preserve proper casing in file titles.
24+
- `workspaceWiki.acronymCasing`: Acronyms to preserve proper casing in file titles (default: `HTML`, `CSS`, `JS`, `TS`, `API`, `URL`, `JSON`, `XML`, `HTTP`, `HTTPS`, `REST`, `SQL`, `CSV`, `FHIR`).
2525

2626
### Sync & Auto-Reveal
2727

28-
- `workspaceWiki.autoReveal`: Enable automatic file revelation in tree (default: `true`).
29-
- `workspaceWiki.autoRevealDelay`: Delay in milliseconds before revealing (default: `500`).
28+
- `workspaceWiki.autoReveal`: Automatically reveal the active file in the Workspace Wiki tree when the editor changes (default: `true`).
29+
- `workspaceWiki.autoRevealDelay`: Delay in milliseconds before revealing the active file (default: `500`). Set to `0` for immediate reveal.
3030

3131
## Example
3232

docs/architecture/sync.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,28 @@ See also: [Tree Data Provider](./tree-data-provider.md), [Settings](./settings.m
7979

8080
```mermaid
8181
sequenceDiagram
82-
participant VSCode as VS Code
83-
participant User as User
84-
participant Tree as Workspace Wiki Tree
85-
User->>VSCode: Change active editor
86-
VSCode->>Tree: Notify active file
87-
Tree->>Tree: Reveal file in tree
82+
participant VSCode as VS Code Editor
83+
participant Listener as Editor Change Listener
84+
participant Config as Config Manager
85+
participant Tree as Tree Provider
86+
participant View as Tree View
87+
VSCode->>Listener: onDidChangeActiveTextEditor
88+
activate Listener
89+
Listener->>Config: Get autoReveal Setting
90+
alt autoReveal disabled
91+
Listener-->>VSCode: Return
92+
else autoReveal enabled
93+
Listener->>Config: Get autoRevealDelay
94+
alt autoRevealDelay > 0
95+
Listener->>Listener: Wait (setTimeout)
96+
end
97+
Listener->>Tree: findNodeByPath
98+
alt Node Found & Tree Visible
99+
Listener->>View: reveal(node)
100+
View->>VSCode: Highlight & Expand
101+
end
102+
end
103+
deactivate Listener
88104
```
89105

90-
This diagram shows how the sync module listens for editor changes and reveals the corresponding file in the tree.
106+
This diagram shows how the sync module listens for active editor changes, checks configuration, and reveals the corresponding file in the tree with optional delay.

docs/architecture/tree-data-provider.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,28 @@ Workspace Wiki
9191

9292
See also: [Scanner/Indexer](./scanner.md)
9393

94-
## TreeDataProvider Ordering Logic
94+
## Ordering Logic
9595

9696
```mermaid
9797
flowchart TD
98-
A[All Files] --> B{Is Root?}
99-
B -->|Yes| C[README.md First]
100-
B -->|No| D[Folder Node]
101-
C --> E[Other Root Docs A-Z]
102-
D --> F{index.md Exists?}
103-
F -->|Yes| G[Folder Named by index.md]
104-
F -->|No| H[Folder Name]
105-
G --> I[README.md in Folder]
106-
G --> J[Other Files A-Z]
107-
H --> J
98+
A[All Nodes] --> B{Is README?}
99+
B -->|Yes| C[Rank First]
100+
B -->|No| D{Root Level?}
101+
D -->|Yes| E[Apply Sort Mode]
102+
D -->|No| F[Subfolder Node]
103+
E -->|Get directorySort| G{Sort Mode}
104+
G -->|files-first| H[Files before Folders]
105+
G -->|folders-first| I[Folders before Files]
106+
G -->|alphabetical| J[Alphabetical Order]
107+
H --> K[Then Alphabetical]
108+
I --> K
109+
J --> K
110+
K --> L[Final Sorted List]
111+
F -->|index.md Exists| M[Folder Named by index]
112+
F -->|No index.md| N[Use Folder Name]
113+
M --> O[Children Sorted]
114+
N --> O
115+
O --> L
108116
```
109117

110-
This diagram shows how files are ordered and displayed in the tree.
118+
This diagram shows the node ordering logic: README files rank first, then root-level files/folders are sorted according to `directorySort` setting, then alphabetically by title within each type.

docs/usage/setup.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ The extension works out-of-the-box, but you can customize it via settings:
1818

1919
- `workspaceWiki.supportedExtensions`: File types to include (default: `md`, `markdown`, `txt`).
2020
- `workspaceWiki.excludeGlobs`: Glob patterns to exclude (e.g., `**/node_modules/**`).
21-
- `workspaceWiki.defaultOpenMode`: `preview` or `editor`.
21+
- `workspaceWiki.directorySort`: How to sort files and folders (default: `files-first`).
22+
- `workspaceWiki.openWith`: Commands to use for opening different file types.
23+
- `workspaceWiki.maxSearchDepth`: Maximum directory depth to search (default: `10`).
2224
- `workspaceWiki.autoReveal`: Auto-reveal active file in tree (default: `true`).
2325
- `workspaceWiki.autoRevealDelay`: Delay before revealing active file in milliseconds (default: `500`).
24-
- `workspaceWiki.showIgnoredFiles`: Show files/folders listed in .gitignore and excludeGlobs (default: false).
25-
- `workspaceWiki.showHiddenFiles`: **Show hidden files and folders** (those starting with a dot, e.g. `.github`, `.env`) in the Workspace Wiki tree, unless excluded by .gitignore or excludeGlobs. Default is false (hidden files are not shown).
26+
- `workspaceWiki.showIgnoredFiles`: Show files/folders listed in .gitignore and excludeGlobs (default: `false`).
27+
- `workspaceWiki.showHiddenFiles`: Show hidden files and folders (those starting with a dot, e.g. `.github`, `.env`) in the Workspace Wiki tree, unless excluded by .gitignore or excludeGlobs (default: `false`).
2628

2729
To change settings:
2830

@@ -36,9 +38,9 @@ To change settings:
3638
{
3739
"workspaceWiki.supportedExtensions": ["md", "markdown", "txt"],
3840
"workspaceWiki.excludeGlobs": ["**/node_modules/**", "**/.git/**"],
39-
"workspaceWiki.defaultOpenMode": "preview",
41+
"workspaceWiki.directorySort": "files-first",
4042
"workspaceWiki.autoReveal": true,
4143
"workspaceWiki.autoRevealDelay": 500,
42-
"workspaceWiki.showHiddenFiles": true
44+
"workspaceWiki.showHiddenFiles": false
4345
}
4446
```

0 commit comments

Comments
 (0)