@@ -45,16 +45,14 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
4545
4646 const formatterName = 'fprettify' ;
4747 const formatterPath : string = this . getFormatterPath ( ) ;
48- // If no formatter path is present check that formatter is present in $PATH
49- if ( ! formatterPath ) {
50- if ( ! which . sync ( formatterName , { nothrow : true } ) ) {
51- this . logger . logWarning ( `Formatter: ${ formatterName } not detected in your system.
48+ const formatter : string = path . join ( formatterPath , formatterName ) ;
49+ // If no formatter is detected try and install it
50+ if ( ! which . sync ( formatter , { nothrow : true } ) ) {
51+ this . logger . logWarning ( `Formatter: ${ formatterName } not detected in your system.
5252 Attempting to install now.` ) ;
53- const msg = `Installing ${ formatterName } through pip with --user option` ;
54- promptForMissingTool ( formatterName , msg , 'Python' ) ;
55- }
53+ const msg = `Installing ${ formatterName } through pip with --user option` ;
54+ promptForMissingTool ( formatterName , msg , 'Python' ) ;
5655 }
57- const formatter : string = path . join ( formatterPath , formatterName ) ;
5856
5957 const args : string [ ] = [ document . fileName , ...this . getFormatterArgs ( ) ] ;
6058 // args.push('--silent'); // TODO: pass?
@@ -86,16 +84,14 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
8684 private doFormatFindent ( document : vscode . TextDocument ) {
8785 const formatterName = 'findent' ;
8886 const formatterPath : string = this . getFormatterPath ( ) ;
89- // If no formatter path is present check that formatter is present in $PATH
90- if ( ! formatterPath ) {
91- if ( ! which . sync ( formatterName , { nothrow : true } ) ) {
92- this . logger . logWarning ( `Formatter: ${ formatterName } not detected in your system.
93- Attempting to install now.` ) ;
94- const msg = `Installing ${ formatterName } through pip with --user option` ;
95- promptForMissingTool ( formatterName , msg , 'Python' ) ;
96- }
97- }
9887 let formatter : string = path . join ( formatterPath , formatterName ) ;
88+ // If no formatter is detected try and install it
89+ if ( ! which . sync ( formatter , { nothrow : true } ) ) {
90+ this . logger . logWarning ( `Formatter: ${ formatterName } not detected in your system.
91+ Attempting to install now.` ) ;
92+ const msg = `Installing ${ formatterName } through pip with --user option` ;
93+ promptForMissingTool ( formatterName , msg , 'Python' ) ;
94+ }
9995
10096 // Annoyingly findent only outputs to a file and not to a stream so
10197 // let us go and create a temporary file
0 commit comments