|
1 | 1 | import * as vscode from "vscode"; |
2 | | -import { LanguageClient } from 'vscode-languageclient'; |
| 2 | +import { LanguageClient } from "vscode-languageclient"; |
3 | 3 |
|
4 | 4 | let langClient: LanguageClient; |
5 | 5 |
|
@@ -81,52 +81,52 @@ function loadFileInRepl(repl: vscode.Terminal, filePath: string) { |
81 | 81 |
|
82 | 82 | export function deactivate() { |
83 | 83 | if (!langClient) { |
84 | | - return undefined; |
85 | | - } |
86 | | - return langClient.stop(); |
| 84 | + return undefined; |
| 85 | + } |
| 86 | + return langClient.stop(); |
87 | 87 | } |
88 | 88 |
|
89 | 89 | export function activate(context: vscode.ExtensionContext) { |
90 | | - //******* Language Client ******** |
91 | | - const executable = { |
92 | | - command: 'racket', |
| 90 | + /******* Language Client ********/ |
| 91 | + const executable = { |
| 92 | + command: "racket", |
93 | 93 | // args: ['--lib', 'racket-langserver'], |
94 | | - args: [context.asAbsolutePath('racket-langserver/main.rkt')], |
| 94 | + args: [context.asAbsolutePath("racket-langserver/main.rkt")], |
95 | 95 | // args: [context.asAbsolutePath('racket-language-server/main.rkt')], |
96 | | - }; |
97 | | - |
98 | | - // If the extension is launched in debug mode then the debug server options are used |
99 | | - // Otherwise the run options are used |
100 | | - let serverOptions = { |
101 | | - run: executable, |
102 | | - debug: executable |
103 | | - }; |
104 | | - |
105 | | - // Options to control the language client |
106 | | - let clientOptions = { |
107 | | - // Register the server for racket documents |
108 | | - documentSelector: [{ scheme: 'file', language: 'racket' }], |
109 | | - synchronize: { |
110 | | - // Notify the server about file changes to '.clientrc files contained in the workspace |
111 | | - fileEvents: vscode.workspace.createFileSystemWatcher('**/.clientrc') |
112 | | - } |
113 | | - }; |
114 | | - |
115 | | - // Create the language client and start the client. |
116 | | - langClient = new LanguageClient( |
117 | | - 'magic-racket', |
118 | | - 'Racket Language Client', |
119 | | - serverOptions, |
120 | | - clientOptions |
121 | | - ); |
122 | | - |
123 | | - // Start the client. This will also launch the server |
124 | | - langClient.start(); |
125 | | - |
126 | | - //******* Language Client END ******** |
127 | | - |
128 | | - |
129 | | - let loadFileIntoCurrent = vscode.commands.registerCommand( |
| 96 | + }; |
| 97 | + |
| 98 | + // If the extension is launched in debug mode then the debug server options are used |
| 99 | + // Otherwise the run options are used |
| 100 | + const serverOptions = { |
| 101 | + run: executable, |
| 102 | + debug: executable |
| 103 | + }; |
| 104 | + |
| 105 | + // Options to control the language client |
| 106 | + const clientOptions = { |
| 107 | + // Register the server for racket documents |
| 108 | + documentSelector: [{ scheme: "file", language: "racket" }], |
| 109 | + synchronize: { |
| 110 | + // Notify the server about file changes to '.clientrc files contained in the workspace |
| 111 | + fileEvents: vscode.workspace.createFileSystemWatcher("**/.clientrc") |
| 112 | + } |
| 113 | + }; |
| 114 | + |
| 115 | + // Create the language client and start the client. |
| 116 | + langClient = new LanguageClient( |
| 117 | + "magic-racket", |
| 118 | + "Racket Language Client", |
| 119 | + serverOptions, |
| 120 | + clientOptions |
| 121 | + ); |
| 122 | + |
| 123 | + // Start the client. This will also launch the server |
| 124 | + langClient.start(); |
| 125 | + |
| 126 | + /******* Language Client END ********/ |
| 127 | + |
| 128 | + |
| 129 | + const loadFileIntoCurrent = vscode.commands.registerCommand( |
130 | 130 | "magic-racket.loadFileIntoRepl", |
131 | 131 | () => { |
132 | 132 | const editor = vscode.window.activeTextEditor; |
|
0 commit comments