@ripple-ts/language-server 0.3.40 → 0.3.42

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/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@ripple-ts/language-server",
3
- "version": "0.3.40",
3
+ "version": "0.3.42",
4
4
  "description": "Language Server Protocol implementation for Ripple",
5
5
  "main": "dist/server.js",
6
6
  "type": "module",
7
7
  "bin": {
8
- "ripple-language-server": "bin/language-server.js"
8
+ "ripple-language-server": "./dist/language-server.js"
9
9
  },
10
+ "files": [
11
+ "dist"
12
+ ],
10
13
  "author": "Dominic Gannaway",
11
14
  "license": "MIT",
12
15
  "repository": {
@@ -20,12 +23,12 @@
20
23
  "volar-service-typescript": "0.0.70",
21
24
  "vscode-languageserver-textdocument": "^1.0.12",
22
25
  "vscode-uri": "^3.1.0",
23
- "@tsrx/typescript-plugin": "0.3.40",
24
- "@tsrx/core": "0.0.20"
26
+ "@tsrx/typescript-plugin": "0.3.42",
27
+ "@tsrx/core": "0.0.22"
25
28
  },
26
29
  "devDependencies": {
27
30
  "tsdown": "^0.20.3",
28
- "@tsrx/ripple": "0.0.22"
31
+ "@tsrx/ripple": "0.0.24"
29
32
  },
30
33
  "peerDependencies": {
31
34
  "typescript": "^5.9.3"
package/CHANGELOG.md DELETED
@@ -1,504 +0,0 @@
1
- # @ripple-ts/language-server
2
-
3
- ## 0.3.40
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies
8
- [[`31193f2`](https://github.com/Ripple-TS/ripple/commit/31193f23aa6b6b5b79cd858f57e8aca69cd44b6d),
9
- [`31193f2`](https://github.com/Ripple-TS/ripple/commit/31193f23aa6b6b5b79cd858f57e8aca69cd44b6d)]:
10
- - @tsrx/core@0.0.20
11
- - @tsrx/typescript-plugin@0.3.40
12
-
13
- ## 0.3.39
14
-
15
- ### Patch Changes
16
-
17
- - Updated dependencies
18
- [[`7832be8`](https://github.com/Ripple-TS/ripple/commit/7832be8d1d2937e7f1005ab79e964329d42e0108),
19
- [`7832be8`](https://github.com/Ripple-TS/ripple/commit/7832be8d1d2937e7f1005ab79e964329d42e0108),
20
- [`7832be8`](https://github.com/Ripple-TS/ripple/commit/7832be8d1d2937e7f1005ab79e964329d42e0108)]:
21
- - @tsrx/core@0.0.19
22
- - @tsrx/typescript-plugin@0.3.39
23
-
24
- ## 0.3.38
25
-
26
- ### Patch Changes
27
-
28
- - Updated dependencies
29
- [[`088299c`](https://github.com/Ripple-TS/ripple/commit/088299ce94a6022c017ce2e56c7e1b59bd5973f7),
30
- [`bce43be`](https://github.com/Ripple-TS/ripple/commit/bce43be304812ca04dd8d196e2439f28ea392237)]:
31
- - @tsrx/core@0.0.18
32
- - @tsrx/typescript-plugin@0.3.38
33
-
34
- ## 0.3.37
35
-
36
- ### Patch Changes
37
-
38
- - Updated dependencies
39
- [[`c631ab0`](https://github.com/Ripple-TS/ripple/commit/c631ab0076b7e2cb30f4998101b54c3a86e78c61)]:
40
- - @tsrx/core@0.0.17
41
- - @tsrx/typescript-plugin@0.3.37
42
-
43
- ## 0.3.36
44
-
45
- ### Patch Changes
46
-
47
- - Updated dependencies
48
- [[`f660969`](https://github.com/Ripple-TS/ripple/commit/f66096972bc8d2f03061e6018d03e40207761aaa)]:
49
- - @tsrx/core@0.0.16
50
- - @tsrx/typescript-plugin@0.3.36
51
-
52
- ## 0.3.35
53
-
54
- ### Patch Changes
55
-
56
- - Updated dependencies
57
- [[`0ad85f1`](https://github.com/Ripple-TS/ripple/commit/0ad85f1107ce9bddb72cee44b908a34c5264c0b5),
58
- [`7684132`](https://github.com/Ripple-TS/ripple/commit/7684132ed71db6c550ecbe1c623975ddbed96be5)]:
59
- - @tsrx/core@0.0.15
60
- - @tsrx/typescript-plugin@0.3.35
61
-
62
- ## 0.3.34
63
-
64
- ### Patch Changes
65
-
66
- - [#986](https://github.com/Ripple-TS/ripple/pull/986)
67
- [`b8cd7c4`](https://github.com/Ripple-TS/ripple/commit/b8cd7c4195505976995033a8e369502996f345ad)
68
- Thanks [@leonidaz](https://github.com/leonidaz)! - Improve lazy destructuring
69
- editor support for TSX targets, including typed virtual params, hover display
70
- rewrites, and loose-mode diagnostics for duplicate lazy parameter names.
71
-
72
- - Updated dependencies
73
- [[`383feed`](https://github.com/Ripple-TS/ripple/commit/383feed84b09541c0b58992c09816b5a15c2d2d8),
74
- [`cf4f06e`](https://github.com/Ripple-TS/ripple/commit/cf4f06e8bcbb41f863d047dfaa6d9d17ed212163),
75
- [`fcd25aa`](https://github.com/Ripple-TS/ripple/commit/fcd25aa549db0d56ccbd596b657b856a5061e20f),
76
- [`30126c7`](https://github.com/Ripple-TS/ripple/commit/30126c753c3a08809bacd07c8cf2eca84e8f8cbb),
77
- [`b8cd7c4`](https://github.com/Ripple-TS/ripple/commit/b8cd7c4195505976995033a8e369502996f345ad),
78
- [`b8cd7c4`](https://github.com/Ripple-TS/ripple/commit/b8cd7c4195505976995033a8e369502996f345ad),
79
- [`3ddb1a9`](https://github.com/Ripple-TS/ripple/commit/3ddb1a92ffeb48a7d47c445b929b982a2b96e123),
80
- [`fee8620`](https://github.com/Ripple-TS/ripple/commit/fee8620fa4e82a7c7e4adb3e434e9db552a3e157),
81
- [`2fcacb4`](https://github.com/Ripple-TS/ripple/commit/2fcacb471d7780074f92b20c9b394f7650a941bb),
82
- [`8e2aa8e`](https://github.com/Ripple-TS/ripple/commit/8e2aa8e75678c9ebc9b72055f4da474c82a8e834)]:
83
- - @tsrx/typescript-plugin@0.3.34
84
- - @tsrx/core@0.0.14
85
-
86
- ## 0.3.33
87
-
88
- ### Patch Changes
89
-
90
- - Updated dependencies
91
- [[`a9f706d`](https://github.com/Ripple-TS/ripple/commit/a9f706d6626dc1a9e8505d9ea8f16989b2b024b3),
92
- [`3e07109`](https://github.com/Ripple-TS/ripple/commit/3e071098508449158fa11f2ae48c912d4d673b68),
93
- [`112cfd9`](https://github.com/Ripple-TS/ripple/commit/112cfd9fbfd4412efea543abc55deceb186cf351)]:
94
- - @tsrx/core@0.0.13
95
- - @tsrx/typescript-plugin@0.3.33
96
-
97
- ## 0.3.32
98
-
99
- ### Patch Changes
100
-
101
- - Updated dependencies
102
- [[`ea56fa0`](https://github.com/Ripple-TS/ripple/commit/ea56fa021798afe8621699d11b7e1d9e675cbfb4)]:
103
- - @tsrx/core@0.0.12
104
- - @tsrx/typescript-plugin@0.3.32
105
-
106
- ## 0.3.31
107
-
108
- ### Patch Changes
109
-
110
- - Updated dependencies
111
- [[`079617d`](https://github.com/Ripple-TS/ripple/commit/079617d639569e4cb2c79239011a6b892dbdbb45),
112
- [`7529e1f`](https://github.com/Ripple-TS/ripple/commit/7529e1fe3f0870319bd3399501fd2eb43c516065)]:
113
- - @tsrx/typescript-plugin@0.3.31
114
- - @tsrx/core@0.0.11
115
-
116
- ## 0.3.30
117
-
118
- ### Patch Changes
119
-
120
- - Updated dependencies
121
- [[`7f59ed8`](https://github.com/Ripple-TS/ripple/commit/7f59ed80d7b44c847fb9eb8bf00d4fe9835c3136)]:
122
- - @tsrx/core@0.0.10
123
- - @tsrx/typescript-plugin@0.3.30
124
-
125
- ## 0.3.29
126
-
127
- ### Patch Changes
128
-
129
- - Updated dependencies
130
- [[`4543794`](https://github.com/Ripple-TS/ripple/commit/45437944a99decfb4bc56f7171772614a7f5691a),
131
- [`4543794`](https://github.com/Ripple-TS/ripple/commit/45437944a99decfb4bc56f7171772614a7f5691a)]:
132
- - @tsrx/core@0.0.9
133
- - @tsrx/typescript-plugin@0.3.29
134
-
135
- ## 0.3.28
136
-
137
- ### Patch Changes
138
-
139
- - Updated dependencies
140
- [[`4292598`](https://github.com/Ripple-TS/ripple/commit/42925982e88f48f0af6cc74deeaa3c17bc6657cf),
141
- [`e4b5555`](https://github.com/Ripple-TS/ripple/commit/e4b5555fb5b1651a2bf1bf232565c7e0e40213b8)]:
142
- - @tsrx/core@0.0.8
143
- - @tsrx/typescript-plugin@0.3.28
144
-
145
- ## 0.3.27
146
-
147
- ### Patch Changes
148
-
149
- - Updated dependencies []:
150
- - @tsrx/typescript-plugin@0.3.27
151
-
152
- ## 0.3.26
153
-
154
- ### Patch Changes
155
-
156
- - [#916](https://github.com/Ripple-TS/ripple/pull/916)
157
- [`5b01246`](https://github.com/Ripple-TS/ripple/commit/5b01246b8e1a3a3c7c9da294f3ebda8c73af3ee7)
158
- Thanks [@trueadm](https://github.com/trueadm)! - Rename the TypeScript plugin
159
- package to `@tsrx/typescript-plugin` and update local consumers, templates, and
160
- playgrounds to use the new package name.
161
-
162
- - [`68d80f8`](https://github.com/Ripple-TS/ripple/commit/68d80f8c7a6398692e00497b90cb3d0ba981aea3)
163
- Thanks [@leonidaz](https://github.com/leonidaz)! - Correct package versions.
164
-
165
- - Updated dependencies
166
- [[`5b01246`](https://github.com/Ripple-TS/ripple/commit/5b01246b8e1a3a3c7c9da294f3ebda8c73af3ee7),
167
- [`68d80f8`](https://github.com/Ripple-TS/ripple/commit/68d80f8c7a6398692e00497b90cb3d0ba981aea3),
168
- [`fab49f7`](https://github.com/Ripple-TS/ripple/commit/fab49f7da8ec13c981f1c7b3102703d0c349fc1e)]:
169
- - @tsrx/typescript-plugin@0.3.26
170
- - @tsrx/core@0.0.7
171
-
172
- ## 1.0.1
173
-
174
- ### Patch Changes
175
-
176
- - Updated dependencies []:
177
- - @ripple-ts/typescript-plugin@1.0.1
178
-
179
- ## 1.0.0
180
-
181
- ### Patch Changes
182
-
183
- - Updated dependencies
184
- [[`e9da9cb`](https://github.com/Ripple-TS/ripple/commit/e9da9cbdd42c28f129ee643366c06f8779b8f931)]:
185
- - @tsrx/core@0.0.6
186
- - @ripple-ts/typescript-plugin@1.0.0
187
-
188
- ## 0.3.25
189
-
190
- ### Patch Changes
191
-
192
- - Updated dependencies []:
193
- - @ripple-ts/typescript-plugin@0.3.25
194
-
195
- ## 0.3.24
196
-
197
- ### Patch Changes
198
-
199
- - Updated dependencies []:
200
- - @ripple-ts/typescript-plugin@0.3.24
201
-
202
- ## 0.3.23
203
-
204
- ### Patch Changes
205
-
206
- - Updated dependencies
207
- [[`d027c6c`](https://github.com/Ripple-TS/ripple/commit/d027c6c84fd3ba7c577c52b9fdade77e7ff886e0)]:
208
- - @tsrx/core@0.0.5
209
- - @ripple-ts/typescript-plugin@0.3.23
210
-
211
- ## 0.3.22
212
-
213
- ### Patch Changes
214
-
215
- - Updated dependencies []:
216
- - @ripple-ts/typescript-plugin@0.3.22
217
-
218
- ## 0.3.21
219
-
220
- ### Patch Changes
221
-
222
- - Updated dependencies []:
223
- - @ripple-ts/typescript-plugin@0.3.21
224
-
225
- ## 0.3.20
226
-
227
- ### Patch Changes
228
-
229
- - Updated dependencies []:
230
- - @ripple-ts/typescript-plugin@0.3.20
231
-
232
- ## 0.3.19
233
-
234
- ### Patch Changes
235
-
236
- - [#877](https://github.com/Ripple-TS/ripple/pull/877)
237
- [`7610ef8`](https://github.com/Ripple-TS/ripple/commit/7610ef84847bb77cc83488a902ecb6f96594e113)
238
- Thanks [@leonidaz](https://github.com/leonidaz)! - Convert the Ripple language
239
- server, TypeScript plugin, and VS Code extension codebases from CommonJS source
240
- files to ESM source files, while publishing built dist entrypoints instead of
241
- source files.
242
-
243
- This updates package metadata such as `type: module` and dist-based `main`
244
- paths, replaces `require` and `module.exports` usage with `import` and `export`,
245
- and adds tsdown bundling configs that emit CommonJS dist output plus a
246
- dist/package.json that forces `type: commonjs`.
247
-
248
- Development builds also include sourcemaps.
249
-
250
- - Updated dependencies
251
- [[`7610ef8`](https://github.com/Ripple-TS/ripple/commit/7610ef84847bb77cc83488a902ecb6f96594e113)]:
252
- - @ripple-ts/typescript-plugin@0.3.19
253
-
254
- ## 0.3.18
255
-
256
- ### Patch Changes
257
-
258
- - Updated dependencies []:
259
- - @ripple-ts/typescript-plugin@0.3.18
260
-
261
- ## 0.3.17
262
-
263
- ### Patch Changes
264
-
265
- - Updated dependencies []:
266
- - @ripple-ts/typescript-plugin@0.3.17
267
-
268
- ## 0.3.16
269
-
270
- ### Patch Changes
271
-
272
- - Updated dependencies []:
273
- - @ripple-ts/typescript-plugin@0.3.16
274
-
275
- ## 0.3.15
276
-
277
- ### Patch Changes
278
-
279
- - Updated dependencies []:
280
- - @ripple-ts/typescript-plugin@0.3.15
281
-
282
- ## 0.3.14
283
-
284
- ### Patch Changes
285
-
286
- - Updated dependencies []:
287
- - @ripple-ts/typescript-plugin@0.3.14
288
-
289
- ## 0.3.13
290
-
291
- ### Patch Changes
292
-
293
- - [#862](https://github.com/Ripple-TS/ripple/pull/862)
294
- [`48af856`](https://github.com/Ripple-TS/ripple/commit/48af85678d5e1b32bb1c5e3fbb2fb07498bc88a3)
295
- Thanks [@leonidaz](https://github.com/leonidaz)! - Add a release changeset for
296
- the async tracking work introduced in commit
297
- `4eb4d6851573d771d65f1e85b1b442ad3cdc53d2`.
298
-
299
- This ships async tracking as a first-class feature in Ripple:
300
- - remove and prohibit direct component-level `await`; async component flows now
301
- require using `trackAsync()` (with `trackPending()` for pending state checks)
302
- - add `trackAsync()` and `trackPending()` support so async values can be read
303
- through Ripple's reactive runtime using tracked async values
304
- - update compiler/runtime behavior for `try`/`catch`/`pending` boundaries so
305
- async pending and error states can render and recover correctly in client and
306
- SSR paths
307
- - align `@ripple-ts/compat-react` async boundary behavior with the new Ripple
308
- async tracking semantics
309
- - update editor/tooling integration to match the new async syntax/runtime shape
310
-
311
- - [`6e11177`](https://github.com/Ripple-TS/ripple/commit/6e111778cae4e7d9876e51e293520f0859eb5890)
312
- Thanks [@trueadm](https://github.com/trueadm)! - Add `.rsrx` support across
313
- Ripple tooling and rename the repository's tracked `.ripple` modules to `.rsrx`.
314
- - Updated dependencies
315
- [[`6e11177`](https://github.com/Ripple-TS/ripple/commit/6e111778cae4e7d9876e51e293520f0859eb5890)]:
316
- - @ripple-ts/typescript-plugin@0.3.13
317
-
318
- ## 0.3.12
319
-
320
- ### Patch Changes
321
-
322
- - [#859](https://github.com/Ripple-TS/ripple/pull/859)
323
- [`cdd31ba`](https://github.com/Ripple-TS/ripple/commit/cdd31ba4c07ce504b01d56533e19a6ba37879f5a)
324
- Thanks [@trueadm](https://github.com/trueadm)! - Add first-phase `.tsrx` support
325
- across the core Ripple tooling so Vite, Rollup, TypeScript, the language server,
326
- Prettier, ESLint, and editor integrations accept both `.ripple` and `.tsrx`
327
- files.
328
-
329
- - Updated dependencies
330
- [[`cdd31ba`](https://github.com/Ripple-TS/ripple/commit/cdd31ba4c07ce504b01d56533e19a6ba37879f5a)]:
331
- - @ripple-ts/typescript-plugin@0.3.12
332
-
333
- ## 0.3.11
334
-
335
- ### Patch Changes
336
-
337
- - Updated dependencies []:
338
- - @ripple-ts/typescript-plugin@0.3.11
339
-
340
- ## 0.3.10
341
-
342
- ### Patch Changes
343
-
344
- - Updated dependencies []:
345
- - @ripple-ts/typescript-plugin@0.3.10
346
-
347
- ## 0.3.9
348
-
349
- ### Patch Changes
350
-
351
- - Updated dependencies []:
352
- - @ripple-ts/typescript-plugin@0.3.9
353
-
354
- ## 0.3.8
355
-
356
- ### Patch Changes
357
-
358
- - Updated dependencies []:
359
- - @ripple-ts/typescript-plugin@0.3.8
360
-
361
- ## 0.3.7
362
-
363
- ### Patch Changes
364
-
365
- - Updated dependencies []:
366
- - @ripple-ts/typescript-plugin@0.3.7
367
-
368
- ## 0.3.6
369
-
370
- ### Patch Changes
371
-
372
- - Updated dependencies []:
373
- - @ripple-ts/typescript-plugin@0.3.6
374
-
375
- ## 0.3.5
376
-
377
- ### Patch Changes
378
-
379
- - Updated dependencies []:
380
- - @ripple-ts/typescript-plugin@0.3.5
381
-
382
- ## 0.3.4
383
-
384
- ### Patch Changes
385
-
386
- - Updated dependencies []:
387
- - @ripple-ts/typescript-plugin@0.3.4
388
-
389
- ## 0.3.3
390
-
391
- ### Patch Changes
392
-
393
- - Updated dependencies []:
394
- - @ripple-ts/typescript-plugin@0.3.3
395
-
396
- ## 0.3.2
397
-
398
- ### Patch Changes
399
-
400
- - Updated dependencies []:
401
- - @ripple-ts/typescript-plugin@0.3.2
402
-
403
- ## 0.3.1
404
-
405
- ### Patch Changes
406
-
407
- - Updated dependencies []:
408
- - @ripple-ts/typescript-plugin@0.3.1
409
-
410
- ## 0.3.0
411
-
412
- ### Minor Changes
413
-
414
- - [#779](https://github.com/Ripple-TS/ripple/pull/779)
415
- [`74a10cc`](https://github.com/Ripple-TS/ripple/commit/74a10cc5701962cd7c72b144d59b35ecb76263a3)
416
- Thanks [@leonidaz](https://github.com/leonidaz)! - Introduces #ripple namespace
417
- for creating ripple reactive entities without imports, such as array, object,
418
- map, set, date, url, urlSearchParams, mediaQuery. Adds track, untrack,
419
- trackSplit, effect, context, server, style to the namespace. Deprecates #[] and
420
- #{} in favor of #ripple[] and #ripple{}. Renames types and actual reactive
421
- imports for TrackedX entities, such as TrackedArray, TrackedObject, etc. into
422
- RippleArray, RippleObjec, etc.
423
-
424
- ### Patch Changes
425
-
426
- - Updated dependencies
427
- [[`74a10cc`](https://github.com/Ripple-TS/ripple/commit/74a10cc5701962cd7c72b144d59b35ecb76263a3)]:
428
- - @ripple-ts/typescript-plugin@0.3.0
429
-
430
- ## 0.2.216
431
-
432
- ### Patch Changes
433
-
434
- - [#764](https://github.com/Ripple-TS/ripple/pull/764)
435
- [`95ea864`](https://github.com/Ripple-TS/ripple/commit/95ea8645b2cb27e2610a4ace4c8fb238c92d441a)
436
- Thanks [@leonidaz](https://github.com/leonidaz)! - Fixes syntax color
437
- highlighting for `pending`
438
-
439
- - Updated dependencies
440
- [[`95ea864`](https://github.com/Ripple-TS/ripple/commit/95ea8645b2cb27e2610a4ace4c8fb238c92d441a)]:
441
- - @ripple-ts/typescript-plugin@0.2.216
442
-
443
- ## 0.2.215
444
-
445
- ### Patch Changes
446
-
447
- - Updated dependencies []:
448
- - @ripple-ts/typescript-plugin@0.2.215
449
-
450
- ## 0.2.214
451
-
452
- ### Patch Changes
453
-
454
- - Updated dependencies []:
455
- - @ripple-ts/typescript-plugin@0.2.214
456
-
457
- ## 0.2.213
458
-
459
- ### Patch Changes
460
-
461
- - [#717](https://github.com/Ripple-TS/ripple/pull/717)
462
- [`6c1c21c`](https://github.com/Ripple-TS/ripple/commit/6c1c21ce8225ea7e9820be16626e68b5156c8f5e)
463
- Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Fix
464
- language server not recognizing changes to `.ts` files
465
-
466
- The language server now watches TypeScript and JavaScript files for changes on
467
- disk. Previously, modifications to `.ts` files imported by `.ripple` files would
468
- not be picked up by the language server until it was restarted, causing stale
469
- diagnostics. This was because the `workspace/didChangeWatchedFiles` connection
470
- handler was never registered (it requires calling
471
- `server.fileWatcher.watchFiles()`). The fix adds explicit file watcher
472
- registration for all TypeScript/JavaScript file extensions in the server's
473
- `onInitialized` callback.
474
-
475
- - Updated dependencies []:
476
- - @ripple-ts/typescript-plugin@0.2.213
477
-
478
- ## 0.2.212
479
-
480
- ### Patch Changes
481
-
482
- - Updated dependencies []:
483
- - @ripple-ts/typescript-plugin@0.2.212
484
-
485
- ## 0.2.211
486
-
487
- ### Patch Changes
488
-
489
- - Updated dependencies []:
490
- - @ripple-ts/typescript-plugin@0.2.211
491
-
492
- ## 0.2.210
493
-
494
- ### Patch Changes
495
-
496
- - Updated dependencies []:
497
- - @ripple-ts/typescript-plugin@0.2.210
498
-
499
- ## 0.2.209
500
-
501
- ### Patch Changes
502
-
503
- - Updated dependencies []:
504
- - @ripple-ts/typescript-plugin@0.2.209
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { createRippleLanguageServer } from '../src/server.js';
4
-
5
- createRippleLanguageServer();
@@ -1,163 +0,0 @@
1
- /** @import { LanguageServicePlugin } from '@volar/language-server' */
2
-
3
- import { getVirtualCode, createLogging, is_ripple_document } from './utils.js';
4
-
5
- const { log } = createLogging('[Ripple Auto-Insert Plugin]');
6
-
7
- /**
8
- * List of HTML void/self-closing elements that don't need closing tags
9
- * https://developer.mozilla.org/en-US/docs/Glossary/Void_element
10
- */
11
- const VOID_ELEMENTS = new Set([
12
- 'area',
13
- 'base',
14
- 'br',
15
- 'col',
16
- 'command',
17
- 'embed',
18
- 'hr',
19
- 'img',
20
- 'input',
21
- 'keygen',
22
- 'link',
23
- 'meta',
24
- 'param',
25
- 'source',
26
- 'track',
27
- 'wbr',
28
- ]);
29
-
30
- /**
31
- * Auto-insert plugin for Ripple
32
- * Handles auto-closing tags when typing '>' after a tag name
33
- * @returns {LanguageServicePlugin}
34
- */
35
- export function createAutoInsertPlugin() {
36
- return {
37
- name: 'ripple-auto-insert',
38
- capabilities: {
39
- autoInsertionProvider: {
40
- triggerCharacters: ['>'],
41
- configurationSections: ['ripple.autoClosingTags.enabled'],
42
- },
43
- documentOnTypeFormattingProvider: {
44
- triggerCharacters: ['>'],
45
- },
46
- },
47
- // leaving context for future use
48
- create(context) {
49
- return {
50
- /**
51
- * @param {import('vscode-languageserver-textdocument').TextDocument} document
52
- * @param {import('@volar/language-server').Position} position
53
- * @param {{ rangeOffset: number; rangeLength: number; text: string }} lastChange
54
- * @param {import('@volar/language-server').CancellationToken} _token
55
- * @returns {Promise<string | null>}
56
- */
57
- async provideAutoInsertSnippet(document, position, lastChange, _token) {
58
- if (!is_ripple_document(document.uri)) {
59
- return null;
60
- }
61
-
62
- // Only checking for '>' insertions
63
- if (!lastChange.text.endsWith('>')) {
64
- return null;
65
- }
66
-
67
- const { virtualCode } = getVirtualCode(document, context);
68
-
69
- if (virtualCode.languageId !== 'ripple') {
70
- log(`Skipping auto-insert processing in the '${virtualCode.languageId}' context`);
71
- return null;
72
- }
73
-
74
- // Map position back to source
75
- const offset = document.offsetAt(position);
76
- const mapping = virtualCode.findMappingByGeneratedRange(lastChange.rangeOffset, offset);
77
-
78
- if (!mapping) {
79
- return null;
80
- }
81
-
82
- const sourceOffset = mapping.sourceOffsets[0];
83
-
84
- // search backwards from sourceOffset to find the line tag
85
- const sourceCode = virtualCode.originalCode;
86
- if (sourceCode[sourceOffset - 1] === '/') {
87
- // self-closing tag '/>'
88
- return null;
89
- }
90
-
91
- let attempts = 0;
92
- let found = false;
93
- let i = sourceOffset - 1;
94
- for (; i >= 0; i--) {
95
- const char = sourceCode[i];
96
- if (char === '<') {
97
- attempts++;
98
- // Confirm that it's definitely the start of the tag
99
- // We have `<` and `>` in source maps
100
- if (virtualCode.findMappingBySourceRange(i, i + 1)) {
101
- found = true;
102
- break;
103
- }
104
- }
105
-
106
- if (attempts === 3) {
107
- break;
108
- }
109
- }
110
-
111
- if (!found) {
112
- // This shouldn't happen in reality
113
- log(`No opening tag position found from source position ${sourceOffset}`);
114
- return null;
115
- }
116
-
117
- const line = sourceCode.slice(i, sourceOffset + 1);
118
-
119
- log('Auto-insert triggered at:', {
120
- selection: `${position.line}:${position.character}`,
121
- line,
122
- change: lastChange,
123
- sourceOffset,
124
- });
125
-
126
- // Check if we just typed '>' after a tag name
127
- // Match patterns like: <div> or <Component> but not <div /> or <Component/>
128
- const tagMatch = line.match(/<([@$\w][\w.-]*)[^>]*?(?<!\/)>$/);
129
- if (!tagMatch) {
130
- log('No tag match found');
131
- return null;
132
- }
133
-
134
- const tagName = tagMatch[1];
135
- log('Tag matched:', tagName);
136
-
137
- // Don't auto-close void elements (self-closing HTML tags)
138
- if (VOID_ELEMENTS.has(tagName.toLowerCase())) {
139
- log('Void element, skipping auto-close:', tagName);
140
- return null;
141
- }
142
-
143
- // Check if there's already a closing tag ahead
144
- const restOfLine = document.getText({
145
- start: position,
146
- end: { line: position.line, character: position.character + 100 },
147
- });
148
- if (restOfLine.startsWith(`</${tagName}>`)) {
149
- log('Closing tag already exists, skipping');
150
- return null;
151
- }
152
-
153
- // Insert the closing tag
154
- const closingTag = `</${tagName}>`;
155
- log('Inserting closing tag:', closingTag);
156
-
157
- // Return a snippet with $0 to place cursor between the tags
158
- return `$0${closingTag}`;
159
- },
160
- };
161
- },
162
- };
163
- }