@@ -29,7 +29,7 @@ async function editorFromUri(uri: vscode.Uri): Promise<vscode.TextEditor | undef
29
29
}
30
30
31
31
export async function applySnippetTextEdits ( editor : vscode . TextEditor , edits : vscode . TextEdit [ ] ) {
32
- let selection : vscode . Selection | undefined = undefined ;
32
+ let selections : vscode . Selection [ ] = [ ] ;
33
33
let lineDelta = 0 ;
34
34
await editor . edit ( ( builder ) => {
35
35
for ( const indel of edits ) {
@@ -44,18 +44,18 @@ export async function applySnippetTextEdits(editor: vscode.TextEditor, edits: vs
44
44
indel . range . start . character + placeholderStart
45
45
: prefix . length - lastNewline - 1 ;
46
46
const endColumn = startColumn + placeholderLength ;
47
- selection = new vscode . Selection (
47
+ selections . push ( new vscode . Selection (
48
48
new vscode . Position ( startLine , startColumn ) ,
49
49
new vscode . Position ( startLine , endColumn ) ,
50
- ) ;
50
+ ) ) ;
51
51
builder . replace ( indel . range , newText ) ;
52
52
} else {
53
- lineDelta = countLines ( indel . newText ) - ( indel . range . end . line - indel . range . start . line ) ;
54
53
builder . replace ( indel . range , indel . newText ) ;
55
54
}
55
+ lineDelta = countLines ( indel . newText ) - ( indel . range . end . line - indel . range . start . line ) ;
56
56
}
57
57
} ) ;
58
- if ( selection ) editor . selection = selection ;
58
+ if ( selections . length > 0 ) editor . selections = selections ;
59
59
}
60
60
61
61
function parseSnippet ( snip : string ) : [ string , [ number , number ] ] | undefined {
0 commit comments