-
Notifications
You must be signed in to change notification settings - Fork 1
Claude/add create template button 01 c9sv d4 nb2pfqo p7ps n1tn u #119
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
Claude/add create template button 01 c9sv d4 nb2pfqo p7ps n1tn u #119
Conversation
- Added prominent 'Create New Template' button in the header - Button triggers the existing noted.createCustomTemplate command - Auto-refreshes template list after creation - Provides quick access to template creation from browser UI
- Created new command noted.createTemplateWithVariables - Prompts for template name, description, and category - Creates JSON template with variable system support - Opens Template Browser and directs user to Variable Editor - Added dedicated button in Template Browser header - Provides clear separation between simple and advanced templates
Major improvements to help users understand how to use variables:
1. **Variable Usage Guide Panel**:
- Replaced template preview with clear usage instructions
- Shows step-by-step guide on how to use variables
- Lists all custom variables with copy buttons
- One-click copy of {variable_name} syntax
2. **Edit Template Content Button**:
- Added prominent button in variable editor header
- Opens template file directly from variable editor
- Shows helpful tip when clicked
3. **Improved Save Flow**:
- Success message now includes next steps
- Keeps editor open for 8 seconds after save
- Clear guidance to click "Edit Template Content"
- User can immediately start using variables
4. **Enhanced Visual Feedback**:
- Copy buttons show "✓ Copied!" confirmation
- Green success banner with actionable next step
- Variable types displayed as badges
- Clearer separation between instructions and actions
This addresses the issue where users could save variables but didn't
know how to actually use them in their templates.
Summary of ChangesHello @jsonify, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant new feature allowing users to create and utilize templates with custom variables. This enhancement provides greater flexibility and power in template creation by enabling dynamic content generation based on user input. The changes span across the extension's command registration, core template service logic for variable handling, and updates to the Template Browser's user interface to facilitate the creation and management of these new variable-enabled templates. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new feature to create templates with variables, which is a great addition for creating more dynamic and reusable notes. The implementation covers the creation of these new JSON-based templates, a mechanism to collect variable values from the user when using a template, and updates to the template browser UI to support this new workflow.
My review focuses on improving the robustness of file operations, enhancing the user experience during template creation, and addressing potential race conditions and maintainability issues. I've identified a few areas for improvement, such as handling user input cancellation more consistently, using safer file creation methods, and avoiding fragile setTimeout calls for webview communication.
Overall, this is a solid implementation of a valuable feature. The changes are well-structured, and the new variable editor UI is a thoughtful addition.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
**CI/CD Fixes**: - Add missing `import * as os from 'os'` for userInfo() usage - Remove reference to undefined `templatesProvider` in createTemplateWithVariables **Code Review: Race Condition Fixes**: 1. **Remove setTimeout race condition**: - Removed fragile 500ms setTimeout waiting for webview - Template browser auto-refreshes when opened - User gets clear instructions to click "Edit Variables" 2. **Fix TOCTOU race condition in file creation**: - Changed from access() check + writeFile() to atomic writeFile() with 'wx' flag - Prevents race condition where file could be created between check and write - Simplified error handling with specific EEXIST check **Code Review: Improvements**: 3. **Pre-fill author field with system username**: - Changed `author: ''` to `author: os.userInfo().username` - Provides better default value for template metadata 4. **Improve error handling in templateService.ts**: - Added error logging for JSON parsing failures - Distinguish between ENOENT (file not found) and parsing errors - Helps debugging malformed template files **Test Results**: ✓ All 579 unit tests passing ✓ TypeScript compilation successful ✓ No type errors or warnings
No description provided.