Skip to content

Commit

Permalink
Added a little more configurability so I don't need to reload the ext…
Browse files Browse the repository at this point in the history
…ension often
  • Loading branch information
VonTum committed Jul 2, 2023
1 parent 1cb34d3 commit e00ac1d
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 353 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
*.vsix
*.map
21 changes: 19 additions & 2 deletions client/out/extension.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/out/extension.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */

import * as path from 'path';
import { workspace, ExtensionContext } from 'vscode';
import { workspace, ExtensionContext, commands } from 'vscode';

import {
LanguageClient,
Expand All @@ -16,11 +16,13 @@ import {

let client: LanguageClient;

export function activate(context: ExtensionContext) {

function start_lsp() {
// The server is implemented in node
const config = workspace.getConfiguration("sus_lsp");
const command_path = config.get("executable_path");
console.log("Command path is: ", command_path);
const serverExecutable: Executable = {
command: "/home/lennart/Desktop/sus-compiler/target/release/sus_compiler",
command: String(command_path),
args: ["--lsp"],
transport : TransportKind.stdio
/*transport: {
Expand Down Expand Up @@ -66,6 +68,24 @@ export function activate(context: ExtensionContext) {
client.start();
}

function stop_lsp() {
if (!client) {
return undefined;
}
return client.stop();
}

function restart_lsp() {
stop_lsp();
start_lsp();
}

export function activate(context: ExtensionContext) {
context.subscriptions.push(commands.registerCommand("sus.restartServer", restart_lsp));

start_lsp();
}

export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
Expand Down
Loading

0 comments on commit e00ac1d

Please sign in to comment.