File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -193,9 +193,21 @@ export class VscodeTextEditorImpl implements EditableTextEditor {
193
193
}
194
194
195
195
public async extractVariable ( _range ?: Range ) : Promise < void > {
196
- await vscode . commands . executeCommand ( "editor.action.codeAction" , {
197
- kind : "refactor.extract.constant" ,
198
- preferred : true ,
199
- } ) ;
196
+ if ( this . document . languageId === "python" ) {
197
+ // Workaround for https://github.com/microsoft/vscode-python/issues/20455
198
+ await vscode . commands . executeCommand ( "editor.action.codeAction" , {
199
+ kind : "refactor.extract" ,
200
+ } ) ;
201
+ await sleep ( 250 ) ;
202
+ await vscode . commands . executeCommand ( "selectNextCodeAction" ) ;
203
+ await vscode . commands . executeCommand ( "acceptSelectedCodeAction" ) ;
204
+ } else {
205
+ await vscode . commands . executeCommand ( "editor.action.codeAction" , {
206
+ kind : "refactor.extract.constant" ,
207
+ preferred : true ,
208
+ } ) ;
209
+ }
210
+
211
+ await sleep ( 250 ) ;
200
212
}
201
213
}
You can’t perform that action at this time.
0 commit comments