Skip to content

Commit 4d2d08a

Browse files
committed
Added safeguard for fprettify and fixed Fortran
1 parent 17dce23 commit 4d2d08a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/features/formatting-provider.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,19 @@ export class FortranFormattingProvider
3434
}
3535

3636
/**
37-
* Use `fprettyfy` to format a Fortran file.
37+
* Use `fprettify` to format a Fortran file.
3838
*
3939
* @param document vscode.TextDocument document to operate on
4040
*/
4141
private doFormatFprettify(document: vscode.TextDocument) {
4242

43+
// fprettify can only do FortranFreeFrom
44+
if (document.languageId !== 'FortranFreeForm') {
45+
this.logger.logError(`fprettify can only format FortranFreeForm, change
46+
to findent for FortranFixedForm formatting`);
47+
return
48+
}
49+
4350
const formatterName: string = 'fprettify';
4451
let formatterPath: string = this.getFormatterPath();
4552
// If no formatter path is present check that formatter is present in $PATH

0 commit comments

Comments
 (0)