File tree Expand file tree Collapse file tree 3 files changed +61
-1
lines changed
cursorless-engine/src/processTargets/targets
cursorless-vscode-e2e/src/suite/fixtures Expand file tree Collapse file tree 3 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,15 @@ export default class PositionTarget extends BaseTarget {
44
44
if (
45
45
this . insertionDelimiter === "\n" &&
46
46
this . position === "after" &&
47
- this . thatTarget . contentRange . isSingleLine
47
+ this . state . thatTarget ! . contentRange . isSingleLine
48
48
) {
49
+ // If the target that we're wrapping is not a single line, then we
50
+ // want to compute indentation based on the entire target. Otherwise,
51
+ // we allow the editor to determine how to perform indentation.
52
+ // Note that we use `this.state.thatTarget` rather than `this.thatTarget`
53
+ // because we don't really want the transitive `thatTarget` behaviour, as
54
+ // it's not really the "that" target that we're after; it's the target that
55
+ // we're wrapping. Should rework this stuff as part of #803.
49
56
return "insertLineAfter" ;
50
57
}
51
58
Original file line number Diff line number Diff line change
1
+ {
2
+ "elseStatement": {
3
+ "definitions": [
4
+ {
5
+ "scope": {
6
+ "langIds": [
7
+ "python"
8
+ ]
9
+ },
10
+ "body": [
11
+ "else:",
12
+ "\t$body"
13
+ ]
14
+ }
15
+ ],
16
+ "description": "Else branch",
17
+ "variables": {
18
+ "body": {}
19
+ },
20
+ "insertionScopeTypes": ["branch"]
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ languageId : python
2
+ command :
3
+ version : 5
4
+ spokenForm : snip else after this
5
+ action :
6
+ name : insertSnippet
7
+ args :
8
+ - {type: named, name: elseStatement}
9
+ targets :
10
+ - type : primitive
11
+ mark : {type: cursor}
12
+ modifiers :
13
+ - {type: position, position: after}
14
+ usePrePhraseSnapshot : true
15
+ initialState :
16
+ documentContents : |
17
+ if True:
18
+ aaa = "bbb"
19
+ selections :
20
+ - anchor : {line: 1, character: 7}
21
+ active : {line: 1, character: 7}
22
+ marks : {}
23
+ finalState :
24
+ documentContents : |
25
+ if True:
26
+ aaa = "bbb"
27
+ else:
28
+
29
+ selections :
30
+ - anchor : {line: 3, character: 4}
31
+ active : {line: 3, character: 4}
You can’t perform that action at this time.
0 commit comments