@emnudge/wat-lsp 0.4.0 → 0.5.0

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.
@@ -16,6 +16,11 @@ export class WatLSP {
16
16
  * Provide hover information at the given position (uses tree-sitter based hover)
17
17
  */
18
18
  provideHover(line: number, col: number): any;
19
+ /**
20
+ * Prepare rename: check if position has a renamable symbol and return its range
21
+ * Returns null if the symbol cannot be renamed, otherwise returns { range, placeholder }
22
+ */
23
+ prepareRename(line: number, col: number): any;
19
24
  /**
20
25
  * Provide code completion items at the given position
21
26
  * Returns an array of completion item objects
@@ -42,6 +47,13 @@ export class WatLSP {
42
47
  * Returns an array of folding range objects with startLine, endLine, and kind
43
48
  */
44
49
  provideFoldingRanges(): any;
50
+ /**
51
+ * Provide signature help at the given position
52
+ * Returns null if no signature help available, otherwise returns:
53
+ * { signatures: [{ label, documentation?, parameters: [{ label, documentation? }] }],
54
+ * activeSignature, activeParameter }
55
+ */
56
+ provideSignatureHelp(line: number, col: number): any;
45
57
  /**
46
58
  * Provide semantic tokens for syntax highlighting
47
59
  * Returns a flat array of u32 values in Monaco's delta-encoded format:
@@ -65,6 +77,11 @@ export class WatLSP {
65
77
  * Parse a WAT document and build symbol table using tree-sitter
66
78
  */
67
79
  parse(document: string): void;
80
+ /**
81
+ * Rename a symbol at the given position to a new name
82
+ * Returns null if rename is not possible, otherwise returns { changes: [{ range, newText }] }
83
+ */
84
+ rename(line: number, col: number, new_name: string): any;
68
85
  /**
69
86
  * Check if the LSP is ready
70
87
  */
@@ -87,6 +104,7 @@ export interface InitOutput {
87
104
  readonly watlsp_initialize: (a: number) => any;
88
105
  readonly watlsp_new: () => number;
89
106
  readonly watlsp_parse: (a: number, b: number, c: number) => void;
107
+ readonly watlsp_prepareRename: (a: number, b: number, c: number) => any;
90
108
  readonly watlsp_provideCompletion: (a: number, b: number, c: number) => any;
91
109
  readonly watlsp_provideDefinition: (a: number, b: number, c: number) => any;
92
110
  readonly watlsp_provideDiagnostics: (a: number) => any;
@@ -95,11 +113,13 @@ export interface InitOutput {
95
113
  readonly watlsp_provideHover: (a: number, b: number, c: number) => any;
96
114
  readonly watlsp_provideReferences: (a: number, b: number, c: number, d: number) => any;
97
115
  readonly watlsp_provideSemanticTokens: (a: number) => any;
116
+ readonly watlsp_provideSignatureHelp: (a: number, b: number, c: number) => any;
98
117
  readonly watlsp_ready: (a: number) => number;
118
+ readonly watlsp_rename: (a: number, b: number, c: number, d: number, e: number) => any;
99
119
  readonly init: () => void;
100
- readonly wasm_bindgen__convert__closures_____invoke__hfee0e13a54da0cc9: (a: number, b: number, c: any) => void;
101
- readonly wasm_bindgen__closure__destroy__hdb18b2b625d87f9d: (a: number, b: number) => void;
102
- readonly wasm_bindgen__convert__closures_____invoke__h796f419cb6183d70: (a: number, b: number, c: any, d: any) => void;
120
+ readonly wasm_bindgen__convert__closures_____invoke__h1dcbf0770fc52c58: (a: number, b: number, c: any) => void;
121
+ readonly wasm_bindgen__closure__destroy__hf9f97e092acaa4ab: (a: number, b: number) => void;
122
+ readonly wasm_bindgen__convert__closures_____invoke__h8a37a6dad742f4fb: (a: number, b: number, c: any, d: any) => void;
103
123
  readonly __wbindgen_exn_store: (a: number) => void;
104
124
  readonly __externref_table_alloc: () => number;
105
125
  readonly __wbindgen_externrefs: WebAssembly.Table;
@@ -233,12 +233,12 @@ if (!('encodeInto' in cachedTextEncoder)) {
233
233
 
234
234
  let WASM_VECTOR_LEN = 0;
235
235
 
236
- function wasm_bindgen__convert__closures_____invoke__hfee0e13a54da0cc9(arg0, arg1, arg2) {
237
- wasm.wasm_bindgen__convert__closures_____invoke__hfee0e13a54da0cc9(arg0, arg1, arg2);
236
+ function wasm_bindgen__convert__closures_____invoke__h1dcbf0770fc52c58(arg0, arg1, arg2) {
237
+ wasm.wasm_bindgen__convert__closures_____invoke__h1dcbf0770fc52c58(arg0, arg1, arg2);
238
238
  }
239
239
 
240
- function wasm_bindgen__convert__closures_____invoke__h796f419cb6183d70(arg0, arg1, arg2, arg3) {
241
- wasm.wasm_bindgen__convert__closures_____invoke__h796f419cb6183d70(arg0, arg1, arg2, arg3);
240
+ function wasm_bindgen__convert__closures_____invoke__h8a37a6dad742f4fb(arg0, arg1, arg2, arg3) {
241
+ wasm.wasm_bindgen__convert__closures_____invoke__h8a37a6dad742f4fb(arg0, arg1, arg2, arg3);
242
242
  }
243
243
 
244
244
  const WatLSPFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -287,6 +287,17 @@ export class WatLSP {
287
287
  const ret = wasm.watlsp_provideHover(this.__wbg_ptr, line, col);
288
288
  return ret;
289
289
  }
290
+ /**
291
+ * Prepare rename: check if position has a renamable symbol and return its range
292
+ * Returns null if the symbol cannot be renamed, otherwise returns { range, placeholder }
293
+ * @param {number} line
294
+ * @param {number} col
295
+ * @returns {any}
296
+ */
297
+ prepareRename(line, col) {
298
+ const ret = wasm.watlsp_prepareRename(this.__wbg_ptr, line, col);
299
+ return ret;
300
+ }
290
301
  /**
291
302
  * Provide code completion items at the given position
292
303
  * Returns an array of completion item objects
@@ -352,6 +363,19 @@ export class WatLSP {
352
363
  const ret = wasm.watlsp_provideFoldingRanges(this.__wbg_ptr);
353
364
  return ret;
354
365
  }
366
+ /**
367
+ * Provide signature help at the given position
368
+ * Returns null if no signature help available, otherwise returns:
369
+ * { signatures: [{ label, documentation?, parameters: [{ label, documentation? }] }],
370
+ * activeSignature, activeParameter }
371
+ * @param {number} line
372
+ * @param {number} col
373
+ * @returns {any}
374
+ */
375
+ provideSignatureHelp(line, col) {
376
+ const ret = wasm.watlsp_provideSignatureHelp(this.__wbg_ptr, line, col);
377
+ return ret;
378
+ }
355
379
  /**
356
380
  * Provide semantic tokens for syntax highlighting
357
381
  * Returns a flat array of u32 values in Monaco's delta-encoded format:
@@ -405,6 +429,20 @@ export class WatLSP {
405
429
  const ret = wasm.watlsp_ready(this.__wbg_ptr);
406
430
  return ret !== 0;
407
431
  }
432
+ /**
433
+ * Rename a symbol at the given position to a new name
434
+ * Returns null if rename is not possible, otherwise returns { changes: [{ range, newText }] }
435
+ * @param {number} line
436
+ * @param {number} col
437
+ * @param {string} new_name
438
+ * @returns {any}
439
+ */
440
+ rename(line, col, new_name) {
441
+ const ptr0 = passStringToWasm0(new_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
442
+ const len0 = WASM_VECTOR_LEN;
443
+ const ret = wasm.watlsp_rename(this.__wbg_ptr, line, col, ptr0, len0);
444
+ return ret;
445
+ }
408
446
  }
409
447
  if (Symbol.dispose) WatLSP.prototype[Symbol.dispose] = WatLSP.prototype.free;
410
448
 
@@ -603,7 +641,7 @@ function __wbg_get_imports() {
603
641
  const a = state0.a;
604
642
  state0.a = 0;
605
643
  try {
606
- return wasm_bindgen__convert__closures_____invoke__h796f419cb6183d70(a, state0.b, arg0, arg1);
644
+ return wasm_bindgen__convert__closures_____invoke__h8a37a6dad742f4fb(a, state0.b, arg0, arg1);
607
645
  } finally {
608
646
  state0.a = a;
609
647
  }
@@ -735,9 +773,9 @@ function __wbg_get_imports() {
735
773
  const ret = arg0;
736
774
  return ret;
737
775
  };
738
- imports.wbg.__wbindgen_cast_dd223879213a40a2 = function(arg0, arg1) {
739
- // Cast intrinsic for `Closure(Closure { dtor_idx: 732, function: Function { arguments: [Externref], shim_idx: 733, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
740
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hdb18b2b625d87f9d, wasm_bindgen__convert__closures_____invoke__hfee0e13a54da0cc9);
776
+ imports.wbg.__wbindgen_cast_f2161ef24e95b954 = function(arg0, arg1) {
777
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 733, function: Function { arguments: [Externref], shim_idx: 734, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
778
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf9f97e092acaa4ab, wasm_bindgen__convert__closures_____invoke__h1dcbf0770fc52c58);
741
779
  return ret;
742
780
  };
743
781
  imports.wbg.__wbindgen_init_externref_table = function() {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emnudge/wat-lsp",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "WebAssembly Text Format (WAT) Language Server - WASM build for browser and Node.js",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,9 @@
16
16
  "./wasm": {
17
17
  "types": "./dist/wasm/wat_lsp_rust.d.ts",
18
18
  "import": "./dist/wasm/wat_lsp_rust.js"
19
- }
19
+ },
20
+ "./wasm/tree-sitter.wasm": "./dist/wasm/tree-sitter.wasm",
21
+ "./wasm/wat_lsp_rust_bg.wasm": "./dist/wasm/wat_lsp_rust_bg.wasm"
20
22
  },
21
23
  "files": [
22
24
  "dist",