Skip to content

Conversation

@jsonify
Copy link
Owner

@jsonify jsonify commented Nov 17, 2025

No description provided.

claude and others added 4 commits November 16, 2025 16:42
- 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.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • New "Create Template with Variables" Feature: Users can now create JSON templates that support custom variables, enhancing template flexibility and allowing for dynamic content generation based on user input.
  • Interactive Variable Creation Workflow: A new command and UI flow guide users through naming, describing, and categorizing new variable-enabled templates, making the creation process intuitive.
  • Dynamic Variable Replacement at Note Creation: When creating a note from a variable-enabled template, the system now prompts for variable values and dynamically replaces corresponding placeholders in the template content, personalizing each note.
  • Enhanced Template Browser User Interface: The Template Browser now includes a dedicated "Create with Variables" button and an updated variable editor with a clear usage guide and copy-to-clipboard functionality for custom variables, improving user experience.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

jsonify and others added 3 commits November 16, 2025 17:11
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
@jsonify jsonify merged commit 1867d62 into main Nov 17, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants