@@ -6,7 +6,7 @@ import * as which from 'which';
6
6
import * as vscode from 'vscode' ;
7
7
import * as cp from 'child_process' ;
8
8
9
- import { LoggingService } from '../services/logging-service' ;
9
+ import { Logger } from '../services/logging-service' ;
10
10
import {
11
11
FORMATTERS ,
12
12
EXTENSION_ID ,
@@ -18,7 +18,7 @@ import {
18
18
export class FortranFormattingProvider implements vscode . DocumentFormattingEditProvider {
19
19
private readonly workspace = vscode . workspace . getConfiguration ( EXTENSION_ID ) ;
20
20
private formatter : string | undefined ;
21
- constructor ( private logger : LoggingService ) { }
21
+ constructor ( private logger : Logger ) { }
22
22
23
23
public async provideDocumentFormattingEdits (
24
24
document : vscode . TextDocument ,
@@ -32,7 +32,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
32
32
} else if ( formatterName === 'findent' ) {
33
33
return this . doFormatFindent ( document ) ;
34
34
} 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' ) ;
36
36
}
37
37
38
38
return undefined ;
@@ -46,7 +46,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
46
46
private async doFormatFprettify ( document : vscode . TextDocument ) : Promise < vscode . TextEdit [ ] > {
47
47
// fprettify can only do FortranFreeFrom
48
48
if ( document . languageId !== 'FortranFreeForm' ) {
49
- this . logger . logError ( `fprettify can only format FortranFreeForm, change
49
+ this . logger . error ( `fprettify can only format FortranFreeForm, change
50
50
to findent for FortranFixedForm formatting` ) ;
51
51
return undefined ;
52
52
}
@@ -56,7 +56,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
56
56
const formatter : string = path . join ( formatterPath , formatterName ) ;
57
57
// If no formatter is detected try and install it
58
58
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.
60
60
Attempting to install now.` ) ;
61
61
const msg = `Installing ${ formatterName } through pip with --user option` ;
62
62
promptForMissingTool ( formatterName , msg , 'Python' , [ 'Install' ] , this . logger ) ;
@@ -66,7 +66,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
66
66
const edits : vscode . TextEdit [ ] = [ ] ;
67
67
const [ stdout , stderr ] = await spawnAsPromise ( formatter , args , undefined , document . getText ( ) ) ;
68
68
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 } ` ) ;
70
70
return edits ;
71
71
}
72
72
@@ -81,7 +81,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
81
81
const formatter : string = path . join ( formatterPath , formatterName ) ;
82
82
// If no formatter is detected try and install it
83
83
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.
85
85
Attempting to install now.` ) ;
86
86
const msg = `Installing ${ formatterName } through pip with --user option` ;
87
87
promptForMissingTool ( formatterName , msg , 'Python' , [ 'Install' ] , this . logger ) ;
@@ -91,7 +91,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
91
91
const edits : vscode . TextEdit [ ] = [ ] ;
92
92
const [ stdout , stderr ] = await spawnAsPromise ( formatter , args , undefined , document . getText ( ) ) ;
93
93
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 } ` ) ;
95
95
return edits ;
96
96
}
97
97
@@ -107,7 +107,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
107
107
this . formatter = this . workspace . get ( 'formatting.formatter' , 'Disabled' ) ;
108
108
109
109
if ( ! FORMATTERS . includes ( this . formatter ) ) {
110
- this . logger . logError ( `Unsupported formatter: ${ this . formatter } ` ) ;
110
+ this . logger . error ( `Unsupported formatter: ${ this . formatter } ` ) ;
111
111
}
112
112
return this . formatter ;
113
113
}
@@ -130,7 +130,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
130
130
private getFormatterPath ( ) : string {
131
131
const formatterPath : string = this . workspace . get ( 'formatting.path' , '' ) ;
132
132
if ( formatterPath !== '' ) {
133
- this . logger . logInfo ( `Formatter located in: ${ formatterPath } ` ) ;
133
+ this . logger . info ( `Formatter located in: ${ formatterPath } ` ) ;
134
134
}
135
135
136
136
return formatterPath ;
0 commit comments