Skip to content

Commit 17e201c

Browse files
committed
issue-42 -- Simplify browser extension
1 parent 7926837 commit 17e201c

2 files changed

Lines changed: 3 additions & 77 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Removed
1919

20+
- LSP loading and messages for browser extension
21+
2022
### Fixed
2123

2224
### Security

‎src/clients/browser/extension.ts‎

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,7 @@
11
import * as vscode from "vscode";
22

3-
import {
4-
LanguageClient,
5-
LanguageClientOptions,
6-
ServerOptions,
7-
} from "vscode-languageclient/browser";
83
import { localExtension } from "../shared/extension";
94

10-
let client: LanguageClient;
11-
125
export function activate(context: vscode.ExtensionContext) {
13-
const rascriptLanguageServer =
14-
vscode.workspace.getConfiguration("rascript").languageServer;
15-
setup(context, rascriptLanguageServer);
16-
}
17-
18-
async function setup(
19-
context: vscode.ExtensionContext,
20-
rascriptLanguageServer: string,
21-
) {
22-
const fileUri = vscode.Uri.file(rascriptLanguageServer);
23-
if (rascriptLanguageServer === undefined || rascriptLanguageServer === "") {
24-
vscode.window.showInformationMessage("No Language Server specified");
25-
localExtension(context);
26-
return;
27-
}
28-
languageServer(context, rascriptLanguageServer);
29-
}
30-
31-
function languageServer(
32-
context: vscode.ExtensionContext,
33-
rascriptLanguageServer: string,
34-
) {
35-
let serverOptions: ServerOptions = {
36-
run: { command: rascriptLanguageServer },
37-
debug: { command: rascriptLanguageServer },
38-
};
39-
40-
// Options to control the language client
41-
let clientOptions: LanguageClientOptions = {
42-
// Register the server for plain text documents
43-
documentSelector: [
44-
{
45-
pattern: "**/*.rascript",
46-
},
47-
],
48-
synchronize: {
49-
configurationSection: "rascriptLanguageServer",
50-
fileEvents: vscode.workspace.createFileSystemWatcher("**/*.rascript"),
51-
},
52-
};
53-
54-
// Create the language client and start the client.
55-
client = new LanguageClient(
56-
"rascript-language-server",
57-
"RAScript Language Server",
58-
serverOptions,
59-
clientOptions,
60-
);
61-
62-
// Start the client. This will also launch the server
63-
client
64-
.start()
65-
.then(() => {
66-
vscode.window.showInformationMessage(
67-
"Language Server started from: " + rascriptLanguageServer,
68-
);
69-
})
70-
.catch((error) => {
71-
vscode.window.showInformationMessage(
72-
"Failed to start language server: " + error,
73-
);
74-
localExtension(context);
75-
});
76-
}
77-
78-
export function deactivate(): Thenable<void> | undefined {
79-
if (!client) {
80-
return undefined;
81-
}
82-
return client.stop();
6+
localExtension(context);
837
}

0 commit comments

Comments
 (0)