Skip to content

Commit 6d48577

Browse files
Update comment
1 parent 325d9a6 commit 6d48577

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

packages/cursorless-engine/src/actions/GenerateSnippet/GenerateSnippetCommunity.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,15 @@ import { getHeaderSnippet } from "talon-snippets";
4141
* 2. Find all cursor selections inside target - these will become the user
4242
* snippet variables
4343
* 3. Extract text of target
44-
* 4. Replace cursor selections in text with random ids that won't be affected
45-
* by json serialization. After serialization we'll replace these id's by
46-
* snippet placeholders.
44+
* 4. Replace cursor selections in text with snippet variables
4745
* 4. Construct the user snippet body as a list of strings
48-
* 5. Construct a javascript object that will be json-ified to become the meta
46+
* 5. Construct a javascript object that will be serialized to become the meta
4947
* snippet
50-
* 6. Serialize the javascript object to json
51-
* 7. Perform replacements on the random id's appearing in this json to get the
52-
* text we desire. This modified json output is the meta snippet.
53-
* 8. Open a new document in user custom snippets dir to hold the new snippet.
48+
* 6. Serialize the javascript object
49+
* 7. Escape dollar signs and replace placeholder text with snippet placeholders.
50+
* This modified json output is the meta snippet.
51+
* 8. Open a new document in the snippets dir to hold the new snippet.
5452
* 9. Insert the meta snippet so that the user can construct their snippet.
55-
*
56-
* Note that we avoid using JS interpolation strings here because the syntax is
57-
* very similar to snippet placeholders, so we would end up with lots of
58-
* confusing escaping.
5953
*/
6054
export default class GenerateSnippetCommunity {
6155
constructor(private snippets: Snippets) {

0 commit comments

Comments
 (0)