BetterSnippets is a plugin for Acode that helps you manage and use code snippets more easily.
- Make, change, and delete snippets for different coding languages
- Snippets that work for specific languages
- Smart suggestions as you type
- Easy-to-use pop-up windows for managing snippets
- Fast loading with smart saving
- Open the command menu (Ctrl+Shift+P or Cmd+Shift+P)
- Type "Create Snippet" and pick it
- Fill in the boxes:
- Language: What coding language it's for
- Prefix: The short text that brings up the snippet
- Description: (If you want) A short note about what it does
- Type: (If you want) Extra info about the snippet
- Code: The actual snippet code
- Open the command menu
- Type "Update Snippet" and pick it
- Fill in the boxes with the new info
- Open the command menu
- Type "Remove Snippet" and pick it
- Type in the language and prefix of the snippet you want to delete
- To clear saved snippets for the current language: Use "Clear This Snippets Cache"
- To clear all saved snippets: Use "Clear All Snippets Cache"
BetterSnippets has tools for advanced users and plugin makers:
const BetterSnippetsAPI = acode.require('better-snippets');
getSessionMode(session)
: Find out the current languagecheckSnippetsDir()
: Make sure the snippet folder existsreadSnippetsFile(lang)
: Get snippets for a languagewriteSnippetsFile(lang, snippets)
: Save snippets for a languagecreateSnippet(lang, snippetData)
: Make a new snippetupdateSnippet(lang, snippetData)
: Change an existing snippetremoveSnippet(lang, prefix)
: Delete a snippetgetAllSnippets(lang)
: Get all snippets for a language
All your snippets are saved in the Acode data storage, in a folder called "snippets". Each language has its own file, named after the language (like "javascript" or "python"). These files are in JSON format, which means you can edit them directly if you want. Just be careful to keep the correct format when you make changes.
We'd love your help to make BetterSnippets even better! Here's how:
- Copy the project to your own GitHub account
- Make a new branch for your changes
- Make your changes and save them with clear messages
- Send your changes to your copy
- Ask us to add your changes to the main project
Please try to follow the way the code is written and add tests if you can.
If you have problems or questions, please tell us about it on our GitHub page.