-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.ts
47 lines (43 loc) · 1.08 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { download, getOS } from "./downloader";
import path from "path";
import fs from "fs";
export function entry({ RunningConfig, Notification, StatusBarItem }: any) {
const binDir = fs.existsSync(path.join(__dirname, "bin"));
// * if binary or bin dir not exist
if (!binDir || !fs.existsSync(getOS().path)) {
if (!binDir) {
fs.mkdirSync(path.join(__dirname, "bin"), { recursive: true });
}
const notify = new Notification({
title: "Go",
content:
"Go plugin need to download some necessary files",
lifeTime: Infinity,
buttons: [
{
label: "Download",
action() {
download(getOS().platform, { Notification, StatusBarItem });
},
},
{
label: "Later",
action() {
notify.remove();
},
},
],
});
}
else {
RunningConfig.emit("registerLanguageServer", {
modes: ["go"],
args: [
getOS().path,
"-gocodecompletion",
"-func-snippet-enabled",
"-diagnostics",
],
});
}
}