Commit 2c2de3a
Build AI template creator with description input (#89)
* fix(templates): prevent save dialog for AI template preview
- Changed preview mode from false to true to avoid save prompts
- Use revertAndCloseActiveEditor to close preview without save dialog
- Templates are automatically saved to .templates folder via saveTemplateAsJSON
- Fixes issue where preview document prompted for save with "# 📄 Template Preview/ " filename
- Applied fix to both showTemplatePreview and showTemplateEnhancementPreview functions
* refactor: address code review feedback
Performance optimization:
- Move TEMPLATE_NAME_MAP to static readonly property in TemplatesTreeProvider
- Avoids re-creating nameMap object on every getTemplateFriendlyName() call
Preview close robustness:
- Check if document is closed before attempting to close it
- Reactivate preview document before closing to ensure correct editor is closed
- Use preserveFocus: false to make preview active before closing
- Prevents accidentally closing wrong editor if user switches away during preview
* fix(templates): refresh Templates panel after browser operations
Problem:
- Deleting/duplicating templates in Template Browser updated the webview
- But didn't refresh the Templates sidebar tree panel
- Templates panel showed stale data until manual refresh
Solution:
- Pass templatesProvider to showTemplateBrowser()
- Store module-level reference for message handlers
- Call templatesProvider.refresh() after delete/duplicate operations
- Now both webview and sidebar stay in sync
Files changed:
- templateBrowserView.ts: Add provider param, refresh after operations
- extension.ts: Pass templatesProvider to showTemplateBrowser()
---------
Co-authored-by: Claude <[email protected]>1 parent d028e59 commit 2c2de3a
File tree
4 files changed
+29
-23
lines changed- src
- commands
- providers
- templates
4 files changed
+29
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
241 | 240 | | |
242 | 241 | | |
243 | 242 | | |
| |||
259 | 258 | | |
260 | 259 | | |
261 | 260 | | |
262 | | - | |
| 261 | + | |
263 | 262 | | |
264 | 263 | | |
265 | 264 | | |
| |||
283 | 282 | | |
284 | 283 | | |
285 | 284 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
295 | 293 | | |
296 | 294 | | |
297 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1808 | 1808 | | |
1809 | 1809 | | |
1810 | 1810 | | |
1811 | | - | |
| 1811 | + | |
1812 | 1812 | | |
1813 | 1813 | | |
1814 | 1814 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
263 | 262 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
| |||
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
| 79 | + | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
| 85 | + | |
77 | 86 | | |
78 | 87 | | |
79 | 88 | | |
| |||
0 commit comments