@@ -6,36 +6,37 @@ import { workspace, Disposable, ExtensionContext } from 'vscode';
66import { LanguageClient , LanguageClientOptions , SettingMonitor , ServerOptions , TransportKind } from 'vscode-languageclient' ;
77
88export function activate ( context : ExtensionContext ) {
9- // The server is implemented in node
10- let serverModule = context . asAbsolutePath ( path . join ( 'server' , 'server.js' ) ) ;
11- // The debug options for the server
12- let debugOptions = { execArgv : [ "--nolazy" , "--debug=6004" ] } ;
13-
14- // If the extension is launched in debug mode then the debug server options are used
15- // Otherwise the run options are used
16- let serverOptions : ServerOptions = {
17- run : { module : serverModule , transport : TransportKind . ipc } ,
18- debug : { module : serverModule , transport : TransportKind . ipc , options : debugOptions }
19- }
20-
21- // Options to control the language client
22- let clientOptions : LanguageClientOptions = {
23- // Register the server for plain text documents
24- documentSelector : [ 'ng-template' ] ,
25- synchronize : {
26- fileEvents : [
27- workspace . createFileSystemWatcher ( '**/tsconfig.json' ) ,
28- workspace . createFileSystemWatcher ( '**/*.ts' )
29- ] ,
30- textDocumentFilter : document => document . fileName . endsWith ( '.ts' )
31- } ,
32- }
33-
34- // Create the language client and start the client.
35- let disposable = new LanguageClient ( 'Angular Language Service' , serverOptions , clientOptions , true ) . start ( ) ;
36-
37- // Push the disposable to the context's subscriptions so that the
38- // client can be deactivated on extension deactivation
39- context . subscriptions . push ( disposable ) ;
9+ // The server is implemented in node
10+ let serverModule = context . asAbsolutePath ( path . join ( 'server' , 'server.js' ) ) ;
11+ // The debug options for the server
12+ let debugOptions = { execArgv : [ "--nolazy" , "--debug=6004" ] } ;
13+
14+ // If the extension is launched in debug mode then the debug server options are used
15+ // Otherwise the run options are used
16+ let serverOptions : ServerOptions = {
17+ run : { module : serverModule , transport : TransportKind . ipc } ,
18+ debug : { module : serverModule , transport : TransportKind . ipc , options : debugOptions }
19+ }
20+
21+ // Options to control the language client
22+ let clientOptions : LanguageClientOptions = {
23+ // Register the server for Angular templates
24+ documentSelector : [ 'ng-template' , 'html' ] ,
25+
26+ // Information in the TypeScript project is necessary to generate Angular template completions
27+ synchronize : {
28+ fileEvents : [
29+ workspace . createFileSystemWatcher ( '**/tsconfig.json' ) ,
30+ workspace . createFileSystemWatcher ( '**/*.ts' )
31+ ] ,
32+ textDocumentFilter : document => document . fileName . endsWith ( '.ts' )
33+ } ,
34+ }
35+
36+ // Create the language client and start the client.
37+ let disposable = new LanguageClient ( 'Angular Language Service' , serverOptions , clientOptions , true ) . start ( ) ;
38+
39+ // Push the disposable to the context's subscriptions so that the
40+ // client can be deactivated on extension deactivation
41+ context . subscriptions . push ( disposable ) ;
4042}
41-
0 commit comments