File tree 4 files changed +9
-23
lines changed
extensions/typescript/src/features
4 files changed +9
-23
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ export default class TypeScriptQuickFixProvider implements vscode.CodeActionProv
106
106
private getCommandForAction ( action : Proto . CodeAction ) : vscode . CodeAction {
107
107
return {
108
108
title : action . description ,
109
- edits : getEditForCodeAction ( this . client , action ) ,
109
+ edit : getEditForCodeAction ( this . client , action ) ,
110
110
command : action . commands ? {
111
111
command : ApplyCodeActionCommand . ID ,
112
112
arguments : [ action ] ,
@@ -115,4 +115,4 @@ export default class TypeScriptQuickFixProvider implements vscode.CodeActionProv
115
115
diagnostics : [ ]
116
116
} ;
117
117
}
118
- }
118
+ }
Original file line number Diff line number Diff line change @@ -210,21 +210,21 @@ declare module 'vscode' {
210
210
title : string ;
211
211
212
212
/**
213
- * Optional edit that performs the code action.
213
+ * A workspace edit this code action performs .
214
214
*
215
- * Either `command` or `edits` must be provided for a `CodeAction` .
215
+ * *Note* that either an [`edit`](CodeAction#edit) or a [`command`](CodeAction#command) must be supplied .
216
216
*/
217
- edits ?: TextEdit [ ] | WorkspaceEdit ;
217
+ edit ?: WorkspaceEdit ;
218
218
219
219
/**
220
220
* Diagnostics that this code action resolves.
221
221
*/
222
222
diagnostics ?: Diagnostic [ ] ;
223
223
224
224
/**
225
- * Optional command that performs the code action.
225
+ * A command this code action performs .
226
226
*
227
- * Executed after `edits` if any edits are provided. Either `command` or `edits` must be provided for a `CodeAction` .
227
+ * *Note* that either an [`edit`](CodeAction#edit) or a [`command`](CodeAction#command) must be supplied .
228
228
*/
229
229
command ?: Command ;
230
230
@@ -237,7 +237,7 @@ declare module 'vscode' {
237
237
* @param title The title of the code action.
238
238
* @param edits The edit of the code action.
239
239
*/
240
- constructor ( title : string , edits ?: TextEdit [ ] | WorkspaceEdit ) ;
240
+ constructor ( title : string , edit ?: WorkspaceEdit ) ;
241
241
}
242
242
243
243
export interface CodeActionProvider {
Original file line number Diff line number Diff line change @@ -314,9 +314,7 @@ class CodeActionAdapter {
314
314
title : candidate . title ,
315
315
command : candidate . command && this . _commands . toInternal ( candidate . command ) ,
316
316
diagnostics : candidate . diagnostics && candidate . diagnostics . map ( DiagnosticCollection . toMarkerData ) ,
317
- edits : Array . isArray ( candidate . edits )
318
- ? TypeConverters . WorkspaceEdit . fromTextEdits ( resource , candidate . edits )
319
- : candidate . edits && TypeConverters . WorkspaceEdit . from ( candidate . edits ) ,
317
+ edits : candidate . edit && TypeConverters . WorkspaceEdit . from ( candidate . edit ) ,
320
318
} ) ;
321
319
}
322
320
}
Original file line number Diff line number Diff line change @@ -241,18 +241,6 @@ export namespace WorkspaceEdit {
241
241
return result ;
242
242
}
243
243
244
- export function fromTextEdits ( uri : vscode . Uri , textEdits : vscode . TextEdit [ ] ) : modes . WorkspaceEdit {
245
- const result : modes . WorkspaceEdit = { edits : [ ] } ;
246
- for ( let textEdit of textEdits ) {
247
- result . edits . push ( {
248
- resource : uri ,
249
- newText : textEdit . newText ,
250
- range : fromRange ( textEdit . range )
251
- } ) ;
252
- }
253
- return result ;
254
- }
255
-
256
244
export function to ( value : modes . WorkspaceEdit ) {
257
245
const result = new types . WorkspaceEdit ( ) ;
258
246
for ( const edit of value . edits ) {
You can’t perform that action at this time.
0 commit comments