7
7
*/
8
8
9
9
import * as path from 'path' ;
10
+ import { ExtensionContext , ProgressLocation , window , workspace } from 'vscode' ;
11
+ import { LanguageClient , LanguageClientOptions , RevealOutputChannelOn , ServerOptions , TransportKind } from 'vscode-languageclient' ;
10
12
11
- import { workspace , ExtensionContext , window , ProgressLocation } from 'vscode' ;
12
- import { LanguageClient , LanguageClientOptions , ServerOptions , TransportKind , RevealOutputChannelOn } from 'vscode-languageclient' ;
13
- import { projectLoadingNotification } from './protocol' ;
13
+ import { projectLoadingNotification } from './protocol' ;
14
14
15
15
export function activate ( context : ExtensionContext ) {
16
-
17
16
// Log file does not yet exist on disk. It is up to the server to create the
18
17
// file.
19
18
const logFile = path . join ( context . logPath , 'nglangsvc.log' ) ;
20
19
21
20
// If the extension is launched in debug mode then the debug server options are used
22
21
// Otherwise the run options are used
23
22
const serverOptions : ServerOptions = {
24
- run : {
23
+ run : {
25
24
module : context . asAbsolutePath ( path . join ( 'server' , 'server.js' ) ) ,
26
25
transport : TransportKind . ipc ,
27
26
args : [
@@ -39,8 +38,10 @@ export function activate(context: ExtensionContext) {
39
38
module : context . asAbsolutePath ( path . join ( 'server' , 'out' , 'server.js' ) ) ,
40
39
transport : TransportKind . ipc ,
41
40
args : [
42
- '--logFile' , logFile ,
43
- '--logVerbosity' , 'verbose' ,
41
+ '--logFile' ,
42
+ logFile ,
43
+ '--logVerbosity' ,
44
+ 'verbose' ,
44
45
] ,
45
46
options : {
46
47
env : {
@@ -80,35 +81,35 @@ export function activate(context: ExtensionContext) {
80
81
} ;
81
82
82
83
// Create the language client and start the client.
83
- const forceDebug = ! ! process . env [ 'NG_DEBUG' ] ;
84
- const client = new LanguageClient (
85
- 'Angular Language Service' , serverOptions , clientOptions , forceDebug ) ;
84
+ const forceDebug = ! ! process . env [ 'NG_DEBUG' ] ;
85
+ const client =
86
+ new LanguageClient ( 'Angular Language Service' , serverOptions , clientOptions , forceDebug ) ;
86
87
const disposable = client . start ( ) ;
87
88
88
89
// Push the disposable to the context's subscriptions so that the
89
90
// client can be deactivated on extension deactivation
90
91
context . subscriptions . push ( disposable ) ;
91
92
92
- client . onReady ( ) . then ( ( ) => {
93
-
94
- const projectLoadingTasks = new Map < string , { resolve : ( ) => void } > ( ) ;
93
+ client . onReady ( ) . then ( ( ) => {
94
+ const projectLoadingTasks = new Map < string , { resolve : ( ) => void } > ( ) ;
95
95
96
96
client . onNotification ( projectLoadingNotification . start , ( projectName : string ) => {
97
- window . withProgress ( {
98
- location : ProgressLocation . Window ,
99
- title : 'Initializing Angular language features' ,
100
- } , ( ) => new Promise ( ( resolve ) => {
101
- projectLoadingTasks . set ( projectName , { resolve } ) ;
102
- } ) ) ;
97
+ window . withProgress (
98
+ {
99
+ location : ProgressLocation . Window ,
100
+ title : 'Initializing Angular language features' ,
101
+ } ,
102
+ ( ) => new Promise ( ( resolve ) => {
103
+ projectLoadingTasks . set ( projectName , { resolve} ) ;
104
+ } ) ) ;
103
105
} ) ;
104
-
106
+
105
107
client . onNotification ( projectLoadingNotification . finish , ( projectName : string ) => {
106
- const task = projectLoadingTasks . get ( projectName ) ;
107
- if ( task ) {
108
- task . resolve ( ) ;
109
- projectLoadingTasks . delete ( projectName ) ;
110
- }
108
+ const task = projectLoadingTasks . get ( projectName ) ;
109
+ if ( task ) {
110
+ task . resolve ( ) ;
111
+ projectLoadingTasks . delete ( projectName ) ;
112
+ }
111
113
} ) ;
112
-
113
114
} ) ;
114
115
}
0 commit comments