Smart Code Snippets
It's like Code Snippets, but smarter
A Code Snippet is a reusable block of code developers copy/paste from their browser to their development environment. A code snippet is found on the web, in a documentation, or in a forum.
Code Snippets VS Smart Code Snippets
Smart Code Snippets put Code Snippets on steroids. Smart Code Snippets augment the capabilities of Code Snippets by:
- Making Snippets Contextual: snippets are available for a language or library. Only the snippet that matters for your environment are available.
- Parameterize Code Snippets: snippets define variables that are being replaced by the developer when importing the snippet in their IDE.
- Indexing Snippets: snippets are associated with keywords and tags, which are indexes by a snippet search engine and make them easy to search.
- Share snippets with your team or the world: snippets can be public on the Codiga Hub or kept private and shared with your team.
Contextual Code Snippets
Smart Code Snippets are contextual. Each code snippets is assigned to a language and (potential) to a library. When searching for code snippets in your IDE, only code snippets that match your development environment are suggested.
Contextualization goes beyond language and library. You can also surface code snippets for a particular file pattern. For example, if you design a snippet only for files that matches the
**/*.test.js pattern, these snippets will be available in your IDE only if the file being edited match this pattern.
Parameterize your Code Snippets
Smart Code Snippets can use variables that are replaced when the snippet is imported in the IDE. For example, if you add the variable
&[GET_FILENAME_NO_EXT] in your snippet, it will be replaced automatically with the filename without extension when importing the snippet.
You can also add variables that are being completed by the user when the snippet is being imported.
Make your snippets searchable
With Smart Code Snippets, you can specify tags, keywords and a description. These elements (along with the code) are indexed to make the snippet easily accessible for you and your team.
When creating a code snippet, add specific keywords in your snippet to make it easier for your team to find it. Other elements of the snippets (language, library) are also being indexed to make the snippet easier to find.
Share your snippets with your team or with the world!
Smart Code Snippets can be either private or public.
Public Smart Code Snippets: a public smart code snippet is available to all developers on the Codiga Hub. Any user can favorite the snippet and import it in their IDE.
Private Smart Code Snippets: a private smart code snippet is only available to its owner and the group the smart code snippet is shared with.
The Codiga Hub contains thousands of Smart Code Snippets from the Codiga community. Explore the snippets and find blocks of code to reuse directly in your IDE. Look for a snippet, mark it as favorite and reuse it in your IDE as shown below.