garlic-vscode 0.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.activate = activate;
37
+ exports.deactivate = deactivate;
38
+ const net = __importStar(require("net"));
39
+ const vscode = __importStar(require("vscode"));
40
+ const node_1 = require("vscode-languageclient/node");
41
+ let client;
42
+ let restarting = false;
43
+ function activate(context) {
44
+ client = createClient();
45
+ context.subscriptions.push(client);
46
+ client.start();
47
+ context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((event) => {
48
+ if (event.affectsConfiguration('garlicLsp.host') || event.affectsConfiguration('garlicLsp.port')) {
49
+ restart(context);
50
+ }
51
+ }));
52
+ }
53
+ async function restart(context) {
54
+ if (restarting) {
55
+ return;
56
+ }
57
+ restarting = true;
58
+ try {
59
+ await client?.stop();
60
+ client = createClient();
61
+ context.subscriptions.push(client);
62
+ client.start();
63
+ }
64
+ finally {
65
+ restarting = false;
66
+ }
67
+ }
68
+ function createClient() {
69
+ const config = vscode.workspace.getConfiguration('garlicLsp');
70
+ const host = config.get('host', '127.0.0.1');
71
+ const port = config.get('port', 6009);
72
+ const serverOptions = async () => {
73
+ let lastError;
74
+ for (let attempt = 0; attempt < 5; attempt++) {
75
+ try {
76
+ return await new Promise((resolve, reject) => {
77
+ const socket = net.connect({ host, port }, () => resolve({ reader: socket, writer: socket }));
78
+ socket.on('error', reject);
79
+ });
80
+ }
81
+ catch (error) {
82
+ lastError = error;
83
+ await new Promise(resolve => setTimeout(resolve, 1000));
84
+ }
85
+ }
86
+ throw lastError ?? new Error(`cannot connect to Garlic LSP at ${host}:${port}`);
87
+ };
88
+ const clientOptions = {
89
+ documentSelector: [{ language: 'garlic' }]
90
+ };
91
+ return new node_1.LanguageClient('garlicLsp', 'Garlic LSP', serverOptions, clientOptions);
92
+ }
93
+ function deactivate() {
94
+ return client?.stop();
95
+ }
96
+ //# sourceMappingURL=extension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,4BASC;AA0CD,gCAEC;AA5DD,yCAA2B;AAC3B,+CAAiC;AACjC,qDAA8G;AAE9G,IAAI,MAAkC,CAAC;AACvC,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,SAAgB,QAAQ,CAAC,OAAgC;IACrD,MAAM,GAAG,YAAY,EAAE,CAAC;IACxB,OAAO,CAAC,aAAa,CAAC,IAAI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AO,EAAE,MAAM,EAAE,EAAE;oBACrD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;oBAC9F,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBAC/B,CAAC,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,SAAS,GAAG,KAAK,CAAC;gBAClB,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC;QACD,MAAM,SAAS,IAAI,IAAI,KAAK,CAAC,mCAAmC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC;IACF,MAAM,aAAa,GAA0B;QACzC,gBAAgB,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;KAC7C,CAAC;IACF,OAAO,IAAI,qBAAc,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;AACvF,CAAC;AAED,SAAgB,UAAU;IACtB,OAAO,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "garlic-vscode",
3
3
  "displayName": "Garlic",
4
4
  "description": "Garlic DSL language support for ShrimpVM (.srk)",
5
- "version": "0.1.0",
5
+ "version": "1.1.1",
6
6
  "publisher": "Rundll86",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -57,7 +57,8 @@
57
57
  "scripts": {
58
58
  "compile": "tsc",
59
59
  "watch": "tsc -watch",
60
- "prepublishOnly": "run-s vscode:prepublish",
60
+ "vscx": "@vscode/vsce package",
61
+ "prepublishOnly": "run-s compile",
61
62
  "vscode:prepublish": "run-s compile"
62
63
  },
63
64
  "dependencies": {
@@ -68,5 +69,9 @@
68
69
  "@types/vscode": "^1.138.0",
69
70
  "npm-run-all": "^4.1.5",
70
71
  "typescript": "^5.9.3"
71
- }
72
- }
72
+ },
73
+ "files": [
74
+ "out",
75
+ "syntaxes"
76
+ ]
77
+ }
@@ -1,16 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "args": [
6
- "--extensionDevelopmentPath=${workspaceFolder}"
7
- ],
8
- "name": "Launch Extension",
9
- "outFiles": [
10
- "${workspaceFolder}/out/**/*.js"
11
- ],
12
- "request": "launch",
13
- "type": "extensionHost"
14
- },
15
- ]
16
- }
@@ -1,13 +0,0 @@
1
- {
2
- "version": "2.0.0",
3
- "tasks": [
4
- {
5
- "type": "npm",
6
- "script": "compile",
7
- "group": "build",
8
- "problemMatcher": [],
9
- "label": "npm: compile",
10
- "detail": "tsc -p ./"
11
- }
12
- ]
13
- }
package/.vscodeignore DELETED
@@ -1,5 +0,0 @@
1
- src/**
2
- tsconfig.json
3
- **/*.map
4
- node_modules/**/test/**
5
- .gitignore
package/examples/add.srk DELETED
@@ -1,11 +0,0 @@
1
- root(
2
- body={
3
- create_class(
4
- name="Apple",
5
- body={
6
- member_access(object=this());
7
- }
8
- );
9
- print(content=
10
- }
11
- )
@@ -1,110 +0,0 @@
1
- {
2
- "comments": {
3
- "blockComment": [
4
- "<",
5
- ">"
6
- ]
7
- },
8
- "brackets": [
9
- [
10
- "(",
11
- ")"
12
- ],
13
- [
14
- "{",
15
- "}"
16
- ],
17
- [
18
- "[",
19
- "]"
20
- ]
21
- ],
22
- "autoClosingPairs": [
23
- {
24
- "open": "(",
25
- "close": ")"
26
- },
27
- {
28
- "open": "{",
29
- "close": "}"
30
- },
31
- {
32
- "open": "[",
33
- "close": "]"
34
- },
35
- {
36
- "open": "\"",
37
- "close": "\"",
38
- "notIn": [
39
- "string",
40
- "comment"
41
- ]
42
- },
43
- {
44
- "open": "'",
45
- "close": "'",
46
- "notIn": [
47
- "string",
48
- "comment"
49
- ]
50
- },
51
- {
52
- "open": "“",
53
- "close": "”",
54
- "notIn": [
55
- "string",
56
- "comment"
57
- ]
58
- },
59
- {
60
- "open": "`",
61
- "close": "`",
62
- "notIn": [
63
- "string",
64
- "comment"
65
- ]
66
- },
67
- {
68
- "open": "「",
69
- "close": "」",
70
- "notIn": [
71
- "string",
72
- "comment"
73
- ]
74
- }
75
- ],
76
- "surroundingPairs": [
77
- [
78
- "(",
79
- ")"
80
- ],
81
- [
82
- "{",
83
- "}"
84
- ],
85
- [
86
- "[",
87
- "]"
88
- ],
89
- [
90
- "\"",
91
- "\""
92
- ],
93
- [
94
- "'",
95
- "'"
96
- ],
97
- [
98
- "“",
99
- "”"
100
- ],
101
- [
102
- "`",
103
- "`"
104
- ],
105
- [
106
- "「",
107
- "」"
108
- ]
109
- ]
110
- }
package/src/extension.ts DELETED
@@ -1,61 +0,0 @@
1
- import * as net from 'net';
2
- import * as vscode from 'vscode';
3
- import { LanguageClient, LanguageClientOptions, ServerOptions, StreamInfo } from 'vscode-languageclient/node';
4
-
5
- let client: LanguageClient | undefined;
6
- let restarting = false;
7
-
8
- export function activate(context: vscode.ExtensionContext) {
9
- client = createClient();
10
- context.subscriptions.push(client);
11
- client.start();
12
- context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((event: vscode.ConfigurationChangeEvent) => {
13
- if (event.affectsConfiguration('garlicLsp.host') || event.affectsConfiguration('garlicLsp.port')) {
14
- restart(context);
15
- }
16
- }));
17
- }
18
-
19
- async function restart(context: vscode.ExtensionContext) {
20
- if (restarting) {
21
- return;
22
- }
23
- restarting = true;
24
- try {
25
- await client?.stop();
26
- client = createClient();
27
- context.subscriptions.push(client);
28
- client.start();
29
- } finally {
30
- restarting = false;
31
- }
32
- }
33
-
34
- function createClient(): LanguageClient {
35
- const config = vscode.workspace.getConfiguration('garlicLsp');
36
- const host = config.get<string>('host', '127.0.0.1');
37
- const port = config.get<number>('port', 6009);
38
- const serverOptions: ServerOptions = async (): Promise<StreamInfo> => {
39
- let lastError: unknown;
40
- for (let attempt = 0; attempt < 5; attempt++) {
41
- try {
42
- return await new Promise<StreamInfo>((resolve, reject) => {
43
- const socket = net.connect({ host, port }, () => resolve({ reader: socket, writer: socket }));
44
- socket.on('error', reject);
45
- });
46
- } catch (error) {
47
- lastError = error;
48
- await new Promise(resolve => setTimeout(resolve, 1000));
49
- }
50
- }
51
- throw lastError ?? new Error(`cannot connect to Garlic LSP at ${host}:${port}`);
52
- };
53
- const clientOptions: LanguageClientOptions = {
54
- documentSelector: [{ language: 'garlic' }]
55
- };
56
- return new LanguageClient('garlicLsp', 'Garlic LSP', serverOptions, clientOptions);
57
- }
58
-
59
- export function deactivate(): Thenable<void> | undefined {
60
- return client?.stop();
61
- }
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "ES2022",
5
- "lib": [
6
- "ES2022"
7
- ],
8
- "outDir": "out",
9
- "rootDir": "src",
10
- "sourceMap": true,
11
- "strict": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true
14
- },
15
- "include": [
16
- "src"
17
- ]
18
- }