File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
extensions/typescript-language-features/src/tsServer Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
+ import * as vscode from 'vscode' ;
7
+ import * as nls from 'vscode-nls' ;
6
8
import type * as Proto from '../protocol' ;
7
9
import { TypeScriptServiceConfiguration } from '../utils/configuration' ;
10
+ import { memoize } from '../utils/memoize' ;
8
11
import { TsServerProcess , TsServerProcessKind } from './server' ;
9
12
13
+
14
+ const localize = nls . loadMessageBundle ( ) ;
15
+
10
16
declare const Worker : any ;
11
17
declare type Worker = any ;
12
18
@@ -37,13 +43,23 @@ export class WorkerServerProcess implements TsServerProcess {
37
43
args : readonly string [ ] ,
38
44
) {
39
45
worker . addEventListener ( 'message' , ( msg : any ) => {
46
+ if ( msg . data . type === 'log' ) {
47
+ this . output . appendLine ( msg . data . body ) ;
48
+ return ;
49
+ }
50
+
40
51
for ( const handler of this . _onDataHandlers ) {
41
52
handler ( msg . data ) ;
42
53
}
43
54
} ) ;
44
55
worker . postMessage ( args ) ;
45
56
}
46
57
58
+ @memoize
59
+ private get output ( ) : vscode . OutputChannel {
60
+ return vscode . window . createOutputChannel ( localize ( 'channelName' , 'TypeScript Server Log' ) ) ;
61
+ }
62
+
47
63
write ( serverRequest : Proto . Request ) : void {
48
64
this . worker . postMessage ( serverRequest ) ;
49
65
}
You can’t perform that action at this time.
0 commit comments