@@ -345,7 +345,7 @@ class PSDocumentFormattingEditProvider implements
345
345
// we do not return a valid array because our text edits
346
346
// need to be executed in a particular order and it is
347
347
// easier if we perform the edits ourselves
348
- return this . applyEdit ( editor , uniqueEdits , range , 0 , index ) ;
348
+ return this . applyEdit ( editor , uniqueEdits , 0 , index ) ;
349
349
} )
350
350
. then ( ( ) => {
351
351
// execute the same rule again if we left out violations
@@ -365,7 +365,6 @@ class PSDocumentFormattingEditProvider implements
365
365
private applyEdit (
366
366
editor : TextEditor ,
367
367
edits : ScriptRegion [ ] ,
368
- range : Range ,
369
368
markerIndex : number ,
370
369
ruleIndex : number ) : Thenable < void > {
371
370
if ( markerIndex >= edits . length ) {
@@ -377,27 +376,22 @@ class PSDocumentFormattingEditProvider implements
377
376
let edit : ScriptRegion = edits [ markerIndex ] ;
378
377
let editRange : Range = toRange ( edit ) ;
379
378
380
- if ( range === null || range . contains ( editRange . start ) ) {
381
-
382
- // accumulate the changes in number of lines
383
- // get the difference between the number of lines in the replacement text and
384
- // that of the original text
385
- this . lineDiff += this . getNumLines ( edit . text ) - ( editRange . end . line - editRange . start . line + 1 ) ;
386
- return editor . edit ( ( editBuilder ) => {
387
- editBuilder . replace (
388
- editRange ,
389
- edit . text ) ;
390
- } ,
391
- {
392
- undoStopAfter : undoStopAfter ,
393
- undoStopBefore : undoStopBefore
394
- } ) . then ( ( isEditApplied ) => {
395
- return this . applyEdit ( editor , edits , range , markerIndex + 1 , ruleIndex ) ;
396
- } ) ; // TODO handle rejection
397
- }
398
- else {
399
- return this . applyEdit ( editor , edits , range , markerIndex + 1 , ruleIndex ) ;
400
- }
379
+
380
+ // accumulate the changes in number of lines
381
+ // get the difference between the number of lines in the replacement text and
382
+ // that of the original text
383
+ this . lineDiff += this . getNumLines ( edit . text ) - ( editRange . end . line - editRange . start . line + 1 ) ;
384
+ return editor . edit ( ( editBuilder ) => {
385
+ editBuilder . replace (
386
+ editRange ,
387
+ edit . text ) ;
388
+ } ,
389
+ {
390
+ undoStopAfter : undoStopAfter ,
391
+ undoStopBefore : undoStopBefore
392
+ } ) . then ( ( isEditApplied ) => {
393
+ return this . applyEdit ( editor , edits , markerIndex + 1 , ruleIndex ) ;
394
+ } ) ; // TODO handle rejection
401
395
}
402
396
403
397
private getNumLines ( text : string ) : number {
0 commit comments