@@ -45,16 +45,14 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
45
45
46
46
const formatterName = 'fprettify' ;
47
47
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.
52
52
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' ) ;
56
55
}
57
- const formatter : string = path . join ( formatterPath , formatterName ) ;
58
56
59
57
const args : string [ ] = [ document . fileName , ...this . getFormatterArgs ( ) ] ;
60
58
// args.push('--silent'); // TODO: pass?
@@ -86,16 +84,14 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
86
84
private doFormatFindent ( document : vscode . TextDocument ) {
87
85
const formatterName = 'findent' ;
88
86
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
- }
98
87
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
+ }
99
95
100
96
// Annoyingly findent only outputs to a file and not to a stream so
101
97
// let us go and create a temporary file
0 commit comments