File tree 1 file changed +14
-1
lines changed 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -156,12 +156,25 @@ export function moveItem(ctx: Ctx, direction: ra.Direction): Cmd {
156
156
157
157
if ( ! edit ) return ;
158
158
159
+ let cursor : vscode . Position | null = null ;
160
+
159
161
await editor . edit ( ( builder ) => {
160
162
client . protocol2CodeConverter . asTextEdits ( edit . edits ) . forEach ( ( edit : any ) => {
161
163
builder . replace ( edit . range , edit . newText ) ;
164
+
165
+ if ( direction === ra . Direction . Up ) {
166
+ if ( ! cursor || edit . range . end . isBeforeOrEqual ( cursor ) ) {
167
+ cursor = edit . range . end ;
168
+ }
169
+ } else {
170
+ if ( ! cursor || edit . range . end . isAfterOrEqual ( cursor ) ) {
171
+ cursor = edit . range . end ;
172
+ }
173
+ }
162
174
} ) ;
163
175
} ) . then ( ( ) => {
164
- editor . selection = new vscode . Selection ( editor . selection . end , editor . selection . end ) ;
176
+ const newPosition = cursor ?? editor . selection . start ;
177
+ editor . selection = new vscode . Selection ( newPosition , newPosition ) ;
165
178
} ) ;
166
179
} ;
167
180
}
You can’t perform that action at this time.
0 commit comments