@@ -6,7 +6,7 @@ import * as which from 'which';
66import * as vscode from 'vscode' ;
77import * as cp from 'child_process' ;
88
9- import { LoggingService } from '../services/logging-service' ;
9+ import { Logger } from '../services/logging-service' ;
1010import {
1111 FORMATTERS ,
1212 EXTENSION_ID ,
@@ -18,7 +18,7 @@ import {
1818export class FortranFormattingProvider implements vscode . DocumentFormattingEditProvider {
1919 private readonly workspace = vscode . workspace . getConfiguration ( EXTENSION_ID ) ;
2020 private formatter : string | undefined ;
21- constructor ( private logger : LoggingService ) { }
21+ constructor ( private logger : Logger ) { }
2222
2323 public async provideDocumentFormattingEdits (
2424 document : vscode . TextDocument ,
@@ -32,7 +32,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
3232 } else if ( formatterName === 'findent' ) {
3333 return this . doFormatFindent ( document ) ;
3434 } else {
35- this . logger . logError ( 'Cannot format document with formatter set to Disabled' ) ;
35+ this . logger . error ( 'Cannot format document with formatter set to Disabled' ) ;
3636 }
3737
3838 return undefined ;
@@ -46,7 +46,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
4646 private async doFormatFprettify ( document : vscode . TextDocument ) : Promise < vscode . TextEdit [ ] > {
4747 // fprettify can only do FortranFreeFrom
4848 if ( document . languageId !== 'FortranFreeForm' ) {
49- this . logger . logError ( `fprettify can only format FortranFreeForm, change
49+ this . logger . error ( `fprettify can only format FortranFreeForm, change
5050 to findent for FortranFixedForm formatting` ) ;
5151 return undefined ;
5252 }
@@ -56,7 +56,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
5656 const formatter : string = path . join ( formatterPath , formatterName ) ;
5757 // If no formatter is detected try and install it
5858 if ( ! which . sync ( formatter , { nothrow : true } ) ) {
59- this . logger . logWarning ( `Formatter: ${ formatterName } not detected in your system.
59+ this . logger . warn ( `Formatter: ${ formatterName } not detected in your system.
6060 Attempting to install now.` ) ;
6161 const msg = `Installing ${ formatterName } through pip with --user option` ;
6262 promptForMissingTool ( formatterName , msg , 'Python' , [ 'Install' ] , this . logger ) ;
@@ -66,7 +66,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
6666 const edits : vscode . TextEdit [ ] = [ ] ;
6767 const [ stdout , stderr ] = await spawnAsPromise ( formatter , args , undefined , document . getText ( ) ) ;
6868 edits . push ( new vscode . TextEdit ( getWholeFileRange ( document ) , stdout ) ) ;
69- if ( stderr ) this . logger . logInfo ( `fprettify error output: ${ stderr } ` ) ;
69+ if ( stderr ) this . logger . info ( `fprettify error output: ${ stderr } ` ) ;
7070 return edits ;
7171 }
7272
@@ -81,7 +81,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
8181 const formatter : string = path . join ( formatterPath , formatterName ) ;
8282 // If no formatter is detected try and install it
8383 if ( ! which . sync ( formatter , { nothrow : true } ) ) {
84- this . logger . logWarning ( `Formatter: ${ formatterName } not detected in your system.
84+ this . logger . warn ( `Formatter: ${ formatterName } not detected in your system.
8585 Attempting to install now.` ) ;
8686 const msg = `Installing ${ formatterName } through pip with --user option` ;
8787 promptForMissingTool ( formatterName , msg , 'Python' , [ 'Install' ] , this . logger ) ;
@@ -91,7 +91,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
9191 const edits : vscode . TextEdit [ ] = [ ] ;
9292 const [ stdout , stderr ] = await spawnAsPromise ( formatter , args , undefined , document . getText ( ) ) ;
9393 edits . push ( new vscode . TextEdit ( getWholeFileRange ( document ) , stdout ) ) ;
94- if ( stderr ) this . logger . logInfo ( `findent error output: ${ stderr } ` ) ;
94+ if ( stderr ) this . logger . info ( `findent error output: ${ stderr } ` ) ;
9595 return edits ;
9696 }
9797
@@ -107,7 +107,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
107107 this . formatter = this . workspace . get ( 'formatting.formatter' , 'Disabled' ) ;
108108
109109 if ( ! FORMATTERS . includes ( this . formatter ) ) {
110- this . logger . logError ( `Unsupported formatter: ${ this . formatter } ` ) ;
110+ this . logger . error ( `Unsupported formatter: ${ this . formatter } ` ) ;
111111 }
112112 return this . formatter ;
113113 }
@@ -130,7 +130,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
130130 private getFormatterPath ( ) : string {
131131 const formatterPath : string = this . workspace . get ( 'formatting.path' , '' ) ;
132132 if ( formatterPath !== '' ) {
133- this . logger . logInfo ( `Formatter located in: ${ formatterPath } ` ) ;
133+ this . logger . info ( `Formatter located in: ${ formatterPath } ` ) ;
134134 }
135135
136136 return formatterPath ;
0 commit comments