1
- import chalk from 'chalk ' ;
1
+ import pc from 'picocolors ' ;
2
2
import { sep } from 'path' ;
3
3
import { Writable } from 'stream' ;
4
4
import { Diagnostic , DiagnosticSeverity } from 'vscode-languageserver-protocol' ;
@@ -54,7 +54,7 @@ export class HumanFriendlyWriter implements Writer {
54
54
const { line, character } = diagnostic . range . start ;
55
55
// eslint-disable-next-line max-len
56
56
this . stream . write (
57
- `${ workspaceDir } ${ sep } ${ chalk . green ( filename ) } :${ line + 1 } :${ character + 1 } \n`
57
+ `${ workspaceDir } ${ sep } ${ pc . green ( filename ) } :${ line + 1 } :${ character + 1 } \n`
58
58
) ;
59
59
60
60
// Show some context around diagnostic range
@@ -65,17 +65,17 @@ export class HumanFriendlyWriter implements Writer {
65
65
66
66
let msg ;
67
67
if ( this . isVerbose ) {
68
- msg = `${ diagnostic . message } ${ source } \n${ chalk . cyan ( code ) } ` ;
68
+ msg = `${ diagnostic . message } ${ source } \n${ pc . cyan ( code ) } ` ;
69
69
} else {
70
70
msg = `${ diagnostic . message } ${ source } ` ;
71
71
}
72
72
73
73
if ( diagnostic . severity === DiagnosticSeverity . Error ) {
74
- this . stream . write ( `${ chalk . red ( 'Error' ) } : ${ msg } \n` ) ;
74
+ this . stream . write ( `${ pc . red ( 'Error' ) } : ${ msg } \n` ) ;
75
75
} else if ( diagnostic . severity === DiagnosticSeverity . Warning ) {
76
- this . stream . write ( `${ chalk . yellow ( 'Warn' ) } : ${ msg } \n` ) ;
76
+ this . stream . write ( `${ pc . yellow ( 'Warn' ) } : ${ msg } \n` ) ;
77
77
} else {
78
- this . stream . write ( `${ chalk . gray ( 'Hint' ) } : ${ msg } \n` ) ;
78
+ this . stream . write ( `${ pc . gray ( 'Hint' ) } : ${ msg } \n` ) ;
79
79
}
80
80
81
81
this . stream . write ( '\n' ) ;
@@ -89,7 +89,7 @@ export class HumanFriendlyWriter implements Writer {
89
89
offsetAt ( { line : diagnostic . range . start . line , character : 0 } , text ) ,
90
90
startOffset
91
91
) ;
92
- const codeHighlight = chalk . magenta ( text . substring ( startOffset , endOffset ) ) ;
92
+ const codeHighlight = pc . magenta ( text . substring ( startOffset , endOffset ) ) ;
93
93
const codePost = text . substring (
94
94
endOffset ,
95
95
offsetAt ( { line : diagnostic . range . end . line , character : Number . MAX_SAFE_INTEGER } , text )
@@ -113,13 +113,13 @@ export class HumanFriendlyWriter implements Writer {
113
113
`${ hintCount } ${ hintCount === 1 ? 'hint' : 'hints' } \n`
114
114
] . join ( '' ) ;
115
115
if ( errorCount !== 0 ) {
116
- this . stream . write ( chalk . red ( message ) ) ;
116
+ this . stream . write ( pc . red ( message ) ) ;
117
117
} else if ( warningCount !== 0 ) {
118
- this . stream . write ( chalk . yellow ( message ) ) ;
118
+ this . stream . write ( pc . yellow ( message ) ) ;
119
119
} else if ( hintCount !== 0 ) {
120
- this . stream . write ( chalk . grey ( message ) ) ;
120
+ this . stream . write ( pc . gray ( message ) ) ;
121
121
} else {
122
- this . stream . write ( chalk . green ( message ) ) ;
122
+ this . stream . write ( pc . green ( message ) ) ;
123
123
}
124
124
if ( this . isWatchMode ) {
125
125
this . stream . write ( 'Watching for file changes...' ) ;
0 commit comments