Skip to content

jhaisley/new_plus_ext

Repository files navigation

NewPlus for VS Code

Version GitHub Release VS Code Marketplace Version License SLSA Level 2 Install in VS Code Install in VS Code Insiders

Create files and folders from templates with context-aware suggestions and workspace intelligence. A powerful VS Code extension that brings PowerToys NewPlus functionality to your editor.

✨ Features

🎯 Smart Template Selection

  • Context-Aware Filtering: Automatically suggests templates based on your current location and project type
  • Workspace Intelligence: Detects Node.js, Python, Java, and other project types
  • File vs Folder Context: Shows appropriate templates when right-clicking files or folders

πŸ“ Template System

  • File Templates: Individual files with variable substitution
  • Folder Templates: Complete directory structures with multiple files
  • Variable Support: Built-in variables ($DATE$, $USER$, $WORKSPACE_NAME$, etc.)
  • PowerToys Compatible: Uses PowerToys NewPlus template directory structure

πŸš€ Seamless Integration

  • Explorer Context Menu: Right-click to create from templates
  • Command Palette: Quick access via Ctrl+Shift+P β†’ "New+"
  • Progress Feedback: Visual progress for multi-file operations
  • Smart Naming: Context-aware default names with validation

🎬 Quick Start

Installation

From VS Code Marketplace:

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "NewPlus"
  4. Click Install

From VSIX:

  1. Download the latest .vsix file from releases
  2. Open VS Code
  3. Run Extensions: Install from VSIX...
  4. Select the downloaded file

πŸ”’ Security & Attestations

This project achieves SLSA Level 2 compliance:

  • βœ… Automated builds using GitHub Actions
  • βœ… Version-controlled source in GitHub
  • βœ… Provenance generated and signed for all releases
  • βœ… Build attestations publicly verifiable

All releases are signed with GitHub Attestations to verify authenticity and integrity.

To verify a release:

Using GitHub CLI:

gh attestation verify newplus-1.0.4.vsix --owner jhaisley

Or verify online:

  1. Go to Attestations
  2. Find the artifact you downloaded
  3. Verify the checksum matches your downloaded file

This ensures the VSIX file you download is the official release from this repository and hasn't been tampered with.

🎯 Usage

Creating from Templates

Via Context Menu (Recommended)

  1. Right-click on any folder in the Explorer
  2. Select "New+"
  3. Choose a template (filtered by context)
  4. Enter a name and any custom variables
  5. Done! πŸŽ‰

Via Command Palette

  1. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac)
  2. Type "New+"
  3. Select your template
  4. Follow the prompts

Template Structure

Templates are stored in:
Windows: %LOCALAPPDATA%\Microsoft\PowerToys\NewPlus\Templates
Mac/Linux: ~/.local/share/Microsoft/PowerToys/NewPlus/Templates

File Template Example:

MyComponent.tsx

Folder Template Example:

ReactComponent/
β”œβ”€β”€ index.tsx
β”œβ”€β”€ styles.module.css
└── __tests__/
    └── component.test.tsx

πŸ”§ Variables

Templates support powerful variable substitution:

Built-in Variables

Variable Description Example
$DATE$ Current date 2025-10-06
$TIME$ Current time 14:30:45
$YEAR$ Current year 2025
$MONTH$ Current month 10
$DAY$ Current day 06
$USER$ Current user jhaisley
$RANDOM$ Random number 42857
$UUID$ UUID v4 a1b2c3d4-...

Context Variables (Auto-filled)

Variable Description
$WORKSPACE_NAME$ Active workspace name
$TARGET_DIR$ Target directory name
$TARGET_PATH$ Full target path

Note: Custom variable prompts are not currently implemented. Only the built-in and context variables listed above are supported.

βš™οΈ Configuration

Setting Type Default Description
newFromTemplate.templatesPath string %LOCALAPPDATA%\Microsoft\PowerToys\NewPlus\Templates Templates directory path
newFromTemplate.display.hideFileExtensions boolean true Hide extensions in picker
newFromTemplate.display.hideSortingPrefix boolean false Hide leading numbers (e.g., 01.)
newFromTemplate.behavior.replaceVariablesInFilename boolean false Enable variables in filenames

Commands

Command Description
New+ Create from template
New+: Open Templates Folder Open templates directory

🧠 Smart Features

Context Detection

NewPlus detects your project type and suggests relevant templates:

  • Node.js β†’ JavaScript/TypeScript templates
  • Python β†’ Python module templates
  • Java β†’ Class/interface templates
  • Generic β†’ All templates

Workspace Integration

  • βœ… Multi-root workspace support
  • βœ… Active editor context awareness
  • βœ… Intelligent target directory resolution
  • βœ… Real-time name validation

πŸ”§ Development

Build from Source

git clone https://github.com/jhaisley/new_plus_ext.git
cd new_plus_ext
npm install
npm run compile
npm test

Architecture

Commands β†’ Services β†’ Models β†’ Utils
   ↓
Template Discovery (lazy loading, parallel)
Variable Substitution (10-level recursion)
Context Detection (workspace intelligence)

Tech Stack:

  • TypeScript 5.1+ (strict mode)
  • VS Code Extension API 1.104+
  • Mocha test framework

πŸ“‹ Requirements

  • VS Code 1.104.0 or higher
  • Node.js 16+ (for development)

πŸ› Troubleshooting

Templates not showing?

  • Check newFromTemplate.templatesPath setting
  • Verify templates directory exists and is readable
  • Reload window: Developer: Reload Window

Variables not working?

  • Enable newFromTemplate.behavior.replaceVariablesInFilename
  • Use correct syntax: $VARIABLE_NAME$
  • Check recursion limit (max 10 levels)

Context menu missing?

  • Reload VS Code
  • Verify extension is enabled
  • Right-click on folders or files in Explorer

🀝 Contributing

Contributions welcome! Areas of interest:

  • Template examples and starter packs
  • Additional project type detection
  • Custom variable prompts and enhanced variable features
  • UI/UX improvements

See CONTRIBUTING.md for guidelines.

πŸ“œ License

MIT License - see file for details.

πŸ™ Acknowledgments


Made with ❀️ by Jordan Haisley

GitHub Issues PRs Welcome

About

VS Code extension for creating files and folders from templates. PowerToys NewPlus compatible.

Resources

License

Contributing

Stars

Watchers

Forks

Contributors