/snippets

Primary LanguageJavaScript

# My Snippet Extension

## Overview
"My Snippet Extension" is a Visual Studio Code extension designed to streamline the process of creating, updating, and deleting code snippets. This extension supports JavaScript, TypeScript, and HTML snippets, making it easier for developers to manage and reuse common code patterns across their projects.

## Features
- **Generate Snippets**: Quickly create new snippets for JavaScript, TypeScript, and HTML.
- **Update Snippets**: Edit the content and names of existing snippets.
- **Delete Snippets**: Remove unwanted snippets from your workspace.
- **Customizable Messages**: Configure prompts and messages to suit your preferences.

## Installation

### Prerequisites
- Node.js and npm: Ensure you have Node.js installed with npm (Node Package Manager).

### Install the Extension
1. **Generate the Extension**:
   - Open a terminal and run:
     ```bash
     yo code
     ```
   - Follow the prompts to set up your extension project.

2. **Clone or Download**:
   - Clone or download this repository into your VS Code extension project directory.

3. **Install Dependencies**:
   - Navigate to your project directory and run:
     ```bash
     npm install
     ```

## Usage

1. **Launch the Extension**:
   - Open the command palette (`Ctrl/Cmd + Shift + P`), type "Run Extension", and select it to start the Extension Development Host.

2. **Generate a Snippet**:
   - Open the command palette, type "Generate JavaScript Snippet", "Generate TypeScript Snippet", or "Generate HTML Snippet", and select the desired command.
   - Follow the prompts to enter the snippet name and content.

3. **Update a Snippet**:
   - Open the command palette, type "Update Snippet", and select it.
   - Choose a snippet to update from the list and follow the prompts to modify its name and content.

4. **Delete a Snippet**:
   - Open the command palette, type "Delete Snippet", and select it.
   - Choose a snippet to delete from the list.

## Customization

You can customize the extension prompts and messages by modifying the configuration settings in your VS Code `settings.json` file:

```json
{
    "snippet-extension.snippetNamePrompt": "Enter a name for your snippet",
    "snippet-extension.snippetContentPrompt": "Enter the snippet content",
    "snippet-extension.snippetNameRequiredMessage": "Snippet generation canceled: snippet name is required.",
    "snippet-extension.snippetContentRequiredMessage": "Snippet generation canceled: snippet content is required.",
    "snippet-extension.snippetDescription": "Custom snippet",
    "snippet-extension.snippetGeneratedSuccessfullyMessage": "Snippet generated successfully!",
    "snippet-extension.snippetGenerationFailedMessage": "Failed to generate snippet.",
    "snippet-extension.updateSnippetNamePrompt": "Enter a new name for your snippet",
    "snippet-extension.updateSnippetContentPrompt": "Enter the new snippet content",
    "snippet-extension.snippetUpdateCanceledMessage": "Snippet update canceled: snippet name is required.",
    "snippet-extension.snippetUpdatedSuccessfullyMessage": "Snippet updated successfully!",
    "snippet-extension.snippetUpdateFailedMessage": "Failed to update snippet.",
    "snippet-extension.selectSnippetToUpdatePlaceholder": "Select snippet to update",
    "snippet-extension.selectSnippetToDeletePlaceholder": "Select snippet to delete",
    "snippet-extension.snippetDeletedSuccessfullyMessage": "Snippet deleted successfully!",
    "snippet-extension.snippetDeletionFailedMessage": "Failed to delete snippet."
}

Development

Scripts

  • Lint: Lint the code using ESLint:
    npm run lint
  • Test: Run tests:
    npm run test

Dev Dependencies

  • @types/vscode
  • @types/mocha
  • @types/node
  • eslint
  • typescript
  • @vscode/test-cli
  • @vscode/test-electron

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

This project was generated with Yeoman and the VS Code Extension Generator.

Feedback and Support

If you have any issues or feedback, please feel free to submit an issue on GitHub.


Feel free to customize this README further to better suit your extension and provide more detailed information as needed.


This README includes detailed installation instructions, usage guidelines, customization options, development scripts, licensing information, acknowledgments, and a call to action for contributions and feedback. Feel free to adapt it further to suit your specific extension and preferences.