@@ -2,13 +2,13 @@ import * as path from "path";
22import { workspace , ExtensionContext , commands } from "vscode" ;
33
44import {
5- LanguageClient ,
6- LanguageClientOptions ,
7- ServerOptions ,
8- TransportKind ,
5+ LanguageClient ,
6+ LanguageClientOptions ,
7+ ServerOptions ,
8+ TransportKind ,
99} from "vscode-languageclient/node" ;
1010
11- import * as customCommands from ' ./commands' ;
11+ import * as customCommands from " ./commands" ;
1212
1313let client : LanguageClient ;
1414
@@ -61,55 +61,55 @@ let client: LanguageClient;
6161// });
6262
6363export function activate ( context : ExtensionContext ) {
64- // The server is implemented in node
65- let serverModule = context . asAbsolutePath (
66- path . join ( "server" , "out" , "server.js" )
67- ) ;
68- // The debug options for the server
69- // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
70- let debugOptions = { execArgv : [ "--nolazy" , "--inspect=6009" ] } ;
64+ // The server is implemented in node
65+ let serverModule = context . asAbsolutePath (
66+ path . join ( "server" , "out" , "server.js" )
67+ ) ;
68+ // The debug options for the server
69+ // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
70+ let debugOptions = { execArgv : [ "--nolazy" , "--inspect=6009" ] } ;
7171
72- // If the extension is launched in debug mode then the debug server options are used
73- // Otherwise the run options are used
74- let serverOptions : ServerOptions = {
75- run : { module : serverModule , transport : TransportKind . ipc } ,
76- debug : {
77- module : serverModule ,
78- transport : TransportKind . ipc ,
79- options : debugOptions ,
80- } ,
81- } ;
72+ // If the extension is launched in debug mode then the debug server options are used
73+ // Otherwise the run options are used
74+ let serverOptions : ServerOptions = {
75+ run : { module : serverModule , transport : TransportKind . ipc } ,
76+ debug : {
77+ module : serverModule ,
78+ transport : TransportKind . ipc ,
79+ options : debugOptions ,
80+ } ,
81+ } ;
8282
83- // Options to control the language client
84- let clientOptions : LanguageClientOptions = {
85- // Register the server for plain text documents
86- documentSelector : [ { scheme : "file" , language : "rescript" } ] ,
87- synchronize : {
88- // Notify the server about file changes to '.clientrc files contained in the workspace
89- fileEvents : workspace . createFileSystemWatcher ( "**/.clientrc" ) ,
90- } ,
91- } ;
83+ // Options to control the language client
84+ let clientOptions : LanguageClientOptions = {
85+ // Register the server for plain text documents
86+ documentSelector : [ { scheme : "file" , language : "rescript" } ] ,
87+ synchronize : {
88+ // Notify the server about file changes to '.clientrc files contained in the workspace
89+ fileEvents : workspace . createFileSystemWatcher ( "**/.clientrc" ) ,
90+ } ,
91+ } ;
9292
93- // Create the language client and start the client.
94- client = new LanguageClient (
95- "ReScriptLSP" ,
96- "ReScript Language Server" ,
97- serverOptions ,
98- clientOptions
99- ) ;
93+ // Create the language client and start the client.
94+ client = new LanguageClient (
95+ "ReScriptLSP" ,
96+ "ReScript Language Server" ,
97+ serverOptions ,
98+ clientOptions
99+ ) ;
100100
101- // Register custom commands
102- commands . registerCommand ( ' rescript-vscode.create_interface' , ( ) => {
103- customCommands . createInterface ( client ) ;
104- } ) ;
101+ // Register custom commands
102+ commands . registerCommand ( " rescript-vscode.create_interface" , ( ) => {
103+ customCommands . createInterface ( client ) ;
104+ } ) ;
105105
106- // Start the client. This will also launch the server
107- client . start ( ) ;
106+ // Start the client. This will also launch the server
107+ client . start ( ) ;
108108}
109109
110110export function deactivate ( ) : Thenable < void > | undefined {
111- if ( ! client ) {
112- return undefined ;
113- }
114- return client . stop ( ) ;
111+ if ( ! client ) {
112+ return undefined ;
113+ }
114+ return client . stop ( ) ;
115115}
0 commit comments