@gi-tcg/gts-language-server 0.7.4 → 0.7.6

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.
package/dist/browser.js CHANGED
@@ -266,9 +266,13 @@ function createLanguageServicePlugins(ts) {
266
266
  ];
267
267
  }
268
268
  //#endregion
269
+ //#region src/file_watcher.ts
270
+ const PROJECT_FILE_WATCH_PATTERNS = ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,gts}"];
271
+ //#endregion
269
272
  //#region src/browser.ts
270
273
  const connection = createConnection();
271
274
  const server = createServer(connection);
275
+ let projectFileWatcher;
272
276
  server.fileSystem.install("file", zenFsProvider(fs));
273
277
  connection.listen();
274
278
  connection.onInitialize(async (params) => {
@@ -283,8 +287,14 @@ connection.onInitialize(async (params) => {
283
287
  return { languagePlugins: [createGtsLanguagePlugin(tsdk.typescript, inlineGtsConfig)] };
284
288
  }), createLanguageServicePlugins(tsdk.typescript));
285
289
  });
286
- connection.onInitialized(server.initialized);
287
- connection.onShutdown(server.shutdown);
290
+ connection.onInitialized(async () => {
291
+ server.initialized();
292
+ projectFileWatcher = await server.fileWatcher.watchFiles(PROJECT_FILE_WATCH_PATTERNS);
293
+ });
294
+ connection.onShutdown(() => {
295
+ projectFileWatcher?.dispose();
296
+ server.shutdown();
297
+ });
288
298
  self.addEventListener("error", (event) => {
289
299
  console.error("Uncaught exception:", event.error);
290
300
  });
package/dist/node.js CHANGED
@@ -229,9 +229,13 @@ function createLanguageServicePlugins(ts) {
229
229
  ];
230
230
  }
231
231
  //#endregion
232
+ //#region src/file_watcher.ts
233
+ const PROJECT_FILE_WATCH_PATTERNS = ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,gts}"];
234
+ //#endregion
232
235
  //#region src/node.ts
233
236
  const connection = createConnection();
234
237
  const server = createServer(connection);
238
+ let projectFileWatcher;
235
239
  connection.listen();
236
240
  connection.onInitialize(async (params) => {
237
241
  const tsdk = loadTsdkByPath(params.initializationOptions.typescript.tsdk, params.locale);
@@ -239,8 +243,14 @@ connection.onInitialize(async (params) => {
239
243
  return { languagePlugins: [createGtsLanguagePlugin(tsdk.typescript, { pathModule: path })] };
240
244
  }), createLanguageServicePlugins(tsdk.typescript));
241
245
  });
242
- connection.onInitialized(server.initialized);
243
- connection.onShutdown(server.shutdown);
246
+ connection.onInitialized(async () => {
247
+ server.initialized();
248
+ projectFileWatcher = await server.fileWatcher.watchFiles(PROJECT_FILE_WATCH_PATTERNS);
249
+ });
250
+ connection.onShutdown(() => {
251
+ projectFileWatcher?.dispose();
252
+ server.shutdown();
253
+ });
244
254
  process.on("uncaughtException", (err) => {
245
255
  console.error("Uncaught exception:", err);
246
256
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gi-tcg/gts-language-server",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/piovium/gts.git"
@@ -31,8 +31,8 @@
31
31
  "path-browserify-esm": "^1.0.6",
32
32
  "volar-service-typescript": "volar-2.4",
33
33
  "vscode-uri": "^3.0.8",
34
- "@gi-tcg/gts-language-plugin": "0.7.4",
35
- "@gi-tcg/gts-transpiler": "0.7.4"
34
+ "@gi-tcg/gts-language-plugin": "0.7.6",
35
+ "@gi-tcg/gts-transpiler": "0.7.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "vscode-languageserver-textdocument": "^1.0.12"
package/src/browser.ts CHANGED
@@ -15,6 +15,7 @@ import { fs as memfs } from "@zenfs/core";
15
15
  import type ts from "typescript";
16
16
  import zenFsProvider from "./zen_fs_provider.ts";
17
17
  import { createLanguageServicePlugins } from "./services/index.ts";
18
+ import { PROJECT_FILE_WATCH_PATTERNS } from "./file_watcher.ts";
18
19
 
19
20
  export interface GtsLanguageServerBrowserInitializationOptions {
20
21
  tsdkUrl?: string;
@@ -25,13 +26,12 @@ export interface GtsLanguageServerBrowserInitializationOptions {
25
26
 
26
27
  const connection = createConnection();
27
28
  const server = createServer(connection);
29
+ let projectFileWatcher: { dispose(): void } | undefined;
28
30
 
29
31
  server.fileSystem.install("file", zenFsProvider(memfs));
30
32
 
31
33
  connection.listen();
32
34
 
33
- type AnyTuple = [unknown, ...unknown[]];
34
-
35
35
  connection.onInitialize(
36
36
  async (
37
37
  params: Omit<InitializeParams, "initializationOptions"> & {
@@ -68,9 +68,15 @@ connection.onInitialize(
68
68
  },
69
69
  );
70
70
 
71
- connection.onInitialized(server.initialized);
71
+ connection.onInitialized(async () => {
72
+ server.initialized();
73
+ projectFileWatcher = await server.fileWatcher.watchFiles(PROJECT_FILE_WATCH_PATTERNS);
74
+ });
72
75
 
73
- connection.onShutdown(server.shutdown);
76
+ connection.onShutdown(() => {
77
+ projectFileWatcher?.dispose();
78
+ server.shutdown();
79
+ });
74
80
 
75
81
  self.addEventListener("error", (event) => {
76
82
  console.error("Uncaught exception:", event.error);
@@ -0,0 +1,3 @@
1
+ export const PROJECT_FILE_WATCH_PATTERNS: string[] = [
2
+ "**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,gts}",
3
+ ];
package/src/node.ts CHANGED
@@ -3,14 +3,17 @@ import {
3
3
  createServer,
4
4
  createTypeScriptProject,
5
5
  Diagnostic,
6
+ Disposable,
6
7
  loadTsdkByPath,
7
8
  } from "@volar/language-server/node.js";
8
9
  import { createGtsLanguagePlugin } from "@gi-tcg/gts-language-plugin";
9
10
  import { createLanguageServicePlugins } from "./services/index.ts";
11
+ import { PROJECT_FILE_WATCH_PATTERNS } from "./file_watcher.ts";
10
12
  import path from "node:path";
11
13
 
12
14
  const connection = createConnection();
13
15
  const server = createServer(connection);
16
+ let projectFileWatcher: Disposable | undefined;
14
17
 
15
18
  connection.listen();
16
19
 
@@ -34,9 +37,17 @@ connection.onInitialize(async (params) => {
34
37
  );
35
38
  });
36
39
 
37
- connection.onInitialized(server.initialized);
40
+ connection.onInitialized(async () => {
41
+ server.initialized();
42
+ projectFileWatcher = await server.fileWatcher.watchFiles(
43
+ PROJECT_FILE_WATCH_PATTERNS,
44
+ );
45
+ });
38
46
 
39
- connection.onShutdown(server.shutdown);
47
+ connection.onShutdown(() => {
48
+ projectFileWatcher?.dispose();
49
+ server.shutdown();
50
+ });
40
51
 
41
52
  process.on("uncaughtException", (err) => {
42
53
  console.error("Uncaught exception:", err);