77
88import { configuration } from '../configuration/config' ;
99import { GCommands } from '../constants' ;
10- import { LineNumberer , LineNumbererOptions } from '../lineNumberer' ;
10+ import { LineNumberer } from '../lineNumberer' ;
1111import { LineNumbersInput } from '../quickpicks/lineNumbers' ;
1212import { GCommand } from './base' ;
1313
@@ -17,18 +17,15 @@ export class AddLineNumbers extends GCommand {
1717 }
1818
1919 async execute ( ) {
20- const lnInputs = new LineNumbersInput ( ) ;
21- const state = await lnInputs . collect ( ) ;
22-
23- const opts : LineNumbererOptions = { } ;
20+ const ln = new LineNumberer ( ) ;
2421
25- opts . addSpaceAfter = configuration . getParam ( 'lineNumberer.addSpaceAfter' ) ;
26- opts . frequency = configuration . getParam ( 'lineNumberer.frequency' ) ;
27- opts . ignoreBlank = configuration . getParam ( 'lineNumberer.ignoreBlank' ) ;
28- opts . ignoreComments = configuration . getParam ( 'lineNumberer.ignoreComments' ) ;
29- opts . ignoreProgramNumbers = configuration . getParam ( 'lineNumberer.ignoreProgramNumbers' ) ;
22+ if ( configuration . getParam ( 'lineNumberer.enableQuickPick' ) ) {
23+ const lnInputs = new LineNumbersInput ( ) ;
24+ const state = await lnInputs . collect ( ) ;
3025
31- const ln = new LineNumberer ( ) ;
32- await ln . addNumbers ( state . start , state . increment , true , opts ) ;
26+ await ln . addNumbers ( state . start , state . increment ) ;
27+ } else {
28+ await ln . addNumbers ( ) ;
29+ }
3330 }
3431}
0 commit comments