aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2021-05-10 00:36:03 +0200
committerDaniel Gavin <danielgavin5@hotmail.com>2021-05-10 00:36:03 +0200
commit1ef6ecbab7daf5947d70887da3286d0541d726d0 (patch)
tree473a74c271f51e742770e5e6307cc648877c3b9d /editors
parentff3fd70204fd7693f590d66c0019686c6590d9ab (diff)
added darwin x64 to extension
Diffstat (limited to 'editors')
-rw-r--r--editors/vscode/package.json2
-rw-r--r--editors/vscode/src/extension.ts6
-rw-r--r--editors/vscode/src/watch.ts23
3 files changed, 23 insertions, 8 deletions
diff --git a/editors/vscode/package.json b/editors/vscode/package.json
index 211967f..7a9fbae 100644
--- a/editors/vscode/package.json
+++ b/editors/vscode/package.json
@@ -7,7 +7,7 @@
"type": "git",
"url": "git://github.com/DanielGavin/ols.git"
},
- "version": "0.0.6",
+ "version": "0.0.7",
"engines": {
"vscode": "^1.55.2"
},
diff --git a/editors/vscode/src/extension.ts b/editors/vscode/src/extension.ts
index eabf6bb..7c48c1a 100644
--- a/editors/vscode/src/extension.ts
+++ b/editors/vscode/src/extension.ts
@@ -23,6 +23,7 @@ import { fetchRelease, download } from './net';
import { isOdinInstalled } from './toolchain';
import { Ctx } from './ctx';
import { runDebugTest, runTest } from './commands';
+import { watchOlsConfigFile } from './watch';
const onDidChange: vscode.EventEmitter<void> = new vscode.EventEmitter<void>();
@@ -129,6 +130,8 @@ export async function activate(context: vscode.ExtensionContext) {
await client.stop();
client.start();
});
+
+ watchOlsConfigFile(ctx, olsFile);
}
async function bootstrap(config: Config, state: PersistentState): Promise<string> {
@@ -160,7 +163,7 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise<
return path;
}
-async function parseOlsFile(config: Config, file: string) {
+export async function parseOlsFile(config: Config, file: string) {
/*
We have to parse the collections that they have specificed through the json(This will be changed when odin gets it's own builder files)
*/
@@ -186,6 +189,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
const platforms: { [key: string]: string } = {
"x64 win32": "x86_64-pc-windows-msvc",
"x64 linux": "x86_64-unknown-linux-gnu",
+ "x64 darwin": "x86_64-darwin",
};
let platform = platforms[`${process.arch} ${process.platform}`];
diff --git a/editors/vscode/src/watch.ts b/editors/vscode/src/watch.ts
index 0f960c0..f0e86b8 100644
--- a/editors/vscode/src/watch.ts
+++ b/editors/vscode/src/watch.ts
@@ -1,13 +1,24 @@
import * as vscode from "vscode";
+import { Ctx } from "./ctx";
+import { parseOlsFile } from "./extension";
+import { log } from "./util";
-export function watchOlsConfigFile()
+export function watchOlsConfigFile(ctx: Ctx, olsFile: string)
{
- var olsWatcher = vscode.workspace.createFileSystemWatcher("ols.json");
-
- olsWatcher.onDidCreate((uri) => {
+ var olsWatcher = vscode.workspace.createFileSystemWatcher(olsFile);
+ olsWatcher.onDidCreate(async (uri) => {
+ log.info("ols.json modified - restarting client");
+ await ctx.client.stop();
+ ctx.client.start();
+ parseOlsFile(ctx.config, uri.fsPath);
});
+ olsWatcher.onDidChange(async (uri) => {
+ log.info("ols.json modified - restarting client");
+ await ctx.client.stop();
+ ctx.client.start();
+ parseOlsFile(ctx.config, uri.fsPath);
+ });
-
-} \ No newline at end of file
+}