I have the following user snippet:
{
/*
// Place your snippets for JavaScript React here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"Small comment": {
"prefix": "//=",
"body": [
"// ===================================",
"// ${1:COMMENT}",
"// ==================================="
],
"description": "Small comment"
}
}
I get the following error on the second body line:
Invalid characters in string. Control characters must be escaped.
I thought that ${1:somestring}
was a valid placeholder. What am I doing wrong in constructing this snippet?
This fixed the problem for me: remove and then re-add all code snippet folders with the code snippet manager. Tools->Import and Export settings->Reset all settings. Chose reset and over write the existing settings options! Bingo.
For example, in Visual Basic there's a code snippet that inserts a property. To insert the snippet, choose Snippet > Insert Snippet from the right-click or context menu in a Visual Basic code file. Then, choose Code Patterns > Properties, Procedures, Events > Define a Property.
With a code file open in the editor, choose Snippets > Insert Snippet from the right-click menu, then My Code Snippets. You should see a snippet named Square Root. Double-click it. The snippet code is inserted in the code file.
You can also insert a snippet when logging an activity or leaving a comment on a record using the HubSpot mobile app for Android. There are two ways to add a snippet: Type the # symbol into the text editor. Start typing the snippet shortcut, then select the snippet from the dropdown menu.
I just found this question when looking for an answer, I used snippet generator so assumed the format for each would be the same but without thinking I pasted in code that had tabs in it.
Removing the tabs and used spaces instead for the formatting fixed it for me.
Hope this helps. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With