File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
cursorless-engine/src/snippets
cursorless-vscode-e2e/src/suite/fixtures/recorded/actions/snippets Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ export function transformSnippetVariables(
53
53
candidate . children . forEach ( ( child ) => placeholder . appendChild ( child ) ) ;
54
54
candidate . parent . replace ( candidate , [ placeholder ] ) ;
55
55
}
56
+ } else if ( candidate instanceof Placeholder ) {
57
+ if ( candidate . index . toString ( ) === placeholderName ) {
58
+ candidate . parent . replace ( candidate , [ new Variable ( "TM_SELECTED_TEXT" ) ] ) ;
59
+ }
56
60
}
57
61
return true ;
58
62
} ) ;
Original file line number Diff line number Diff line change
1
+ languageId : typescript
2
+ command :
3
+ version : 6
4
+ spokenForm : if wrap cap
5
+ action :
6
+ name : wrapWithSnippet
7
+ snippetDescription :
8
+ type : custom
9
+ body : " if ($1) {\n\t $0\n }"
10
+ scopeType : {type: statement}
11
+ variableName : " 0"
12
+ target :
13
+ type : primitive
14
+ mark : {type: decoratedSymbol, symbolColor: default, character: c}
15
+ usePrePhraseSnapshot : true
16
+ spokenFormError : Custom wrap with snippet
17
+ initialState :
18
+ documentContents : const value = 2;
19
+ selections :
20
+ - anchor : {line: 0, character: 0}
21
+ active : {line: 0, character: 0}
22
+ marks :
23
+ default.c :
24
+ start : {line: 0, character: 0}
25
+ end : {line: 0, character: 5}
26
+ finalState :
27
+ documentContents : |-
28
+ if () {
29
+ const value = 2;
30
+ }
31
+ selections :
32
+ - anchor : {line: 0, character: 4}
33
+ active : {line: 0, character: 4}
34
+ thatMark :
35
+ - type : UntypedTarget
36
+ contentRange :
37
+ start : {line: 0, character: 0}
38
+ end : {line: 2, character: 1}
39
+ isReversed : false
40
+ hasExplicitRange : true
You can’t perform that action at this time.
0 commit comments