@@ -7,19 +7,20 @@ import * as fs from 'fs';
7
7
import * as path from 'path' ;
8
8
import { IEventEmitterFactory } from './IEventEmitterFactory' ;
9
9
import { Trace } from './Trace' ;
10
- import * as vscode from './vscodeAdapter' ;
10
+ import * as vscodeAdapter from './vscodeAdapter' ;
11
+ import * as vscode from 'vscode' ;
11
12
12
- export class RazorLogger implements vscode . Disposable {
13
+ export class RazorLogger implements vscodeAdapter . Disposable {
13
14
public static readonly logName = 'Razor Log' ;
14
15
public verboseEnabled ! : boolean ;
15
16
public messageEnabled ! : boolean ;
16
- public readonly outputChannel : vscode . OutputChannel ;
17
+ public readonly outputChannel : vscodeAdapter . OutputChannel ;
17
18
18
- private readonly onLogEmitter : vscode . EventEmitter < string > ;
19
- private readonly onTraceLevelChangeEmitter : vscode . EventEmitter < Trace > ;
19
+ private readonly onLogEmitter : vscodeAdapter . EventEmitter < string > ;
20
+ private readonly onTraceLevelChangeEmitter : vscodeAdapter . EventEmitter < Trace > ;
20
21
21
22
constructor (
22
- private readonly vscodeApi : vscode . api ,
23
+ private readonly vscodeApi : vscodeAdapter . api ,
23
24
eventEmitterFactory : IEventEmitterFactory ,
24
25
public trace : Trace ) {
25
26
this . processTraceLevel ( ) ;
@@ -29,6 +30,7 @@ export class RazorLogger implements vscode.Disposable {
29
30
this . outputChannel = this . vscodeApi . window . createOutputChannel ( RazorLogger . logName ) ;
30
31
31
32
this . logRazorInformation ( ) ;
33
+ this . setupToStringOverrides ( ) ;
32
34
}
33
35
34
36
public setTraceLevel ( trace : Trace ) {
@@ -119,6 +121,16 @@ ${error.stack}`;
119
121
this . log ( '' ) ;
120
122
}
121
123
124
+ private setupToStringOverrides ( ) {
125
+ vscode . Range . prototype . toString = function ( ) {
126
+ return `[${ this . start } , ${ this . end } ]` ;
127
+ } ;
128
+
129
+ vscode . Position . prototype . toString = function ( ) {
130
+ return `${ this . line } :${ this . character } ` ;
131
+ } ;
132
+ }
133
+
122
134
private processTraceLevel ( ) {
123
135
this . verboseEnabled = this . trace >= Trace . Verbose ;
124
136
this . messageEnabled = this . trace >= Trace . Messages ;
@@ -145,3 +157,4 @@ function findInDirectoryOrAncestor(dir: string, filename: string) {
145
157
dir = parentDir ;
146
158
}
147
159
}
160
+
0 commit comments