qlue-ls 0.5.8 → 0.6.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.
- package/README.md +96 -6
- package/package.json +1 -1
- package/qlue_ls.d.ts +6 -6
- package/qlue_ls.js +42 -18
- package/qlue_ls_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Qlue-ls is available on [crate.io](https://crates.io/crates/qlue-ls):
|
|
|
19
19
|
cargo install --bin qlue-ls qlue-ls
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
And on [
|
|
22
|
+
And on [PyPI](https://pypi.org/project/qlue-ls/):
|
|
23
23
|
|
|
24
24
|
```shell
|
|
25
25
|
pipx install qlue-ls
|
|
@@ -109,8 +109,9 @@ I split auto-completion into 3 stages:
|
|
|
109
109
|
2. Dynamic offline (local defined variables)
|
|
110
110
|
3. Dynamic online (with data from a knowledge-graph)
|
|
111
111
|
|
|
112
|
-
The implementation is in Stage
|
|
113
|
-
|
|
112
|
+
The implementation is in Stage 2.8.
|
|
113
|
+
Dynamic online completion works!
|
|
114
|
+
At the moment the context is limited to the Tripple the completion is requested from. Next step is to introduce full context sensitivity.
|
|
114
115
|
|
|
115
116
|
## 🛠️ Code Actions
|
|
116
117
|
|
|
@@ -132,13 +133,17 @@ Here is the full default configuration
|
|
|
132
133
|
```toml
|
|
133
134
|
[format]
|
|
134
135
|
align_predicates = true
|
|
135
|
-
align_prefixes =
|
|
136
|
+
align_prefixes = true
|
|
136
137
|
separate_prolouge = false
|
|
137
138
|
capitalize_keywords = true
|
|
138
139
|
insert_spaces = true
|
|
139
|
-
tab_size =
|
|
140
|
-
where_new_line =
|
|
140
|
+
tab_size = 10
|
|
141
|
+
where_new_line = true
|
|
141
142
|
filter_same_line = true
|
|
143
|
+
|
|
144
|
+
[completion]
|
|
145
|
+
timeout_ms = 5000
|
|
146
|
+
result_size_limit = 42
|
|
142
147
|
```
|
|
143
148
|
|
|
144
149
|
# 🌐 use in web
|
|
@@ -154,6 +159,91 @@ npm i qlue-ls
|
|
|
154
159
|
You will have to wrap this in a Web Worker and provide a language server client.
|
|
155
160
|
There will be more documentation on this in the future...
|
|
156
161
|
|
|
162
|
+
Until then you can check out the demo in ./editor/
|
|
163
|
+
|
|
164
|
+
# 🏗 Development Setup
|
|
165
|
+
|
|
166
|
+
Here is a quick guide to set this project up for development.
|
|
167
|
+
|
|
168
|
+
## Requirements
|
|
169
|
+
|
|
170
|
+
- [rust](https://www.rust-lang.org/tools/install) >= 1.83.0
|
|
171
|
+
- [wasm-pack](https://rustwasm.github.io/wasm-pack/) >= 0.13.1
|
|
172
|
+
- [node & npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) >= 22.14.0 & >= 11.3.0
|
|
173
|
+
- \[Optional\] [just](https://github.com/casey/just)
|
|
174
|
+
- \[Optional\] [watchexec](https://github.com/watchexec/watchexec)
|
|
175
|
+
|
|
176
|
+
## Initial Setup
|
|
177
|
+
|
|
178
|
+
You will only have to do this once.
|
|
179
|
+
|
|
180
|
+
### install node dependencies
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
cd editor
|
|
184
|
+
npm install
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### build wasm & bindings
|
|
188
|
+
|
|
189
|
+
If you have [just](https://github.com/casey/just) installed:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
just build-wasm
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
If you have [make](https://wiki.ubuntuusers.de/Makefile/) installed:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
make wasm
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
If you don't have [just](https://github.com/casey/just) or [make](https://wiki.ubuntuusers.de/Makefile/) installed:
|
|
202
|
+
|
|
203
|
+
**Install [just](https://github.com/casey/just)**
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
### link against local package
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
cd pkg
|
|
210
|
+
npm link
|
|
211
|
+
cd ../editor
|
|
212
|
+
npm link qlue-ls
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Run application
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
cd editor
|
|
219
|
+
npm run dev
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Now the webapp should be running, open the browser on `localhost:5173`.
|
|
223
|
+
|
|
224
|
+
## Automatically rebuild on change
|
|
225
|
+
|
|
226
|
+
When developping the cycle is:
|
|
227
|
+
|
|
228
|
+
- Change the code
|
|
229
|
+
- Compile to wasm (or run tests)
|
|
230
|
+
- Evaluate
|
|
231
|
+
|
|
232
|
+
To avoid having to run a command each time to Compile I strongly recommend setting up a
|
|
233
|
+
auto runner like [watchexec](https://github.com/watchexec/watchexec).
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
watchexec --restart --exts rs --exts toml just build-wasm
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
or just:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
just watch-and-run build-wasm
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
have fun!
|
|
246
|
+
|
|
157
247
|
# 🙏 Special Thanks
|
|
158
248
|
|
|
159
249
|
* [TJ DeVries](https://github.com/tjdevries) for the inspiration and great tutorials
|
package/package.json
CHANGED
package/qlue_ls.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function init_language_server(writer: WritableStreamDefaultWriter): Server;
|
|
4
|
+
export function listen(server: Server, reader: ReadableStreamDefaultReader): Promise<void>;
|
|
4
5
|
export function format_raw(text: string): string;
|
|
5
6
|
export function determine_operation_type(text: string): string;
|
|
6
7
|
export function get_parse_tree(input: string, offset: number): any;
|
|
7
8
|
export class Server {
|
|
8
9
|
private constructor();
|
|
9
10
|
free(): void;
|
|
10
|
-
listen(reader: ReadableStreamDefaultReader): Promise<void>;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
14
14
|
|
|
15
15
|
export interface InitOutput {
|
|
16
16
|
readonly memory: WebAssembly.Memory;
|
|
17
|
-
readonly __wbg_server_free: (a: number, b: number) => void;
|
|
18
|
-
readonly init_language_server: (a: any) => number;
|
|
19
|
-
readonly server_listen: (a: number, b: any) => any;
|
|
20
17
|
readonly ts_query_cursor_next_capture: (a: number, b: number, c: number) => number;
|
|
21
18
|
readonly ts_query_cursor_exec: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
22
19
|
readonly ts_parser_parse_with_options: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
20
|
+
readonly init_language_server: (a: any) => number;
|
|
21
|
+
readonly listen: (a: number, b: any) => any;
|
|
22
|
+
readonly __wbg_server_free: (a: number, b: number) => void;
|
|
23
23
|
readonly format_raw: (a: number, b: number) => [number, number, number, number];
|
|
24
24
|
readonly determine_operation_type: (a: number, b: number) => [number, number, number, number];
|
|
25
25
|
readonly get_parse_tree: (a: number, b: number, c: number) => any;
|
|
@@ -280,8 +280,8 @@ export interface InitOutput {
|
|
|
280
280
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
281
281
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
282
282
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
283
|
-
readonly
|
|
284
|
-
readonly
|
|
283
|
+
readonly closure583_externref_shim: (a: number, b: number, c: any) => void;
|
|
284
|
+
readonly closure595_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
285
285
|
readonly __wbindgen_start: () => void;
|
|
286
286
|
}
|
|
287
287
|
|
package/qlue_ls.js
CHANGED
|
@@ -33,6 +33,10 @@ function getStringFromWasm0(ptr, len) {
|
|
|
33
33
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
function isLikeNone(x) {
|
|
37
|
+
return x === undefined || x === null;
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
let WASM_VECTOR_LEN = 0;
|
|
37
41
|
|
|
38
42
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -98,10 +102,6 @@ function getDataViewMemory0() {
|
|
|
98
102
|
return cachedDataViewMemory0;
|
|
99
103
|
}
|
|
100
104
|
|
|
101
|
-
function isLikeNone(x) {
|
|
102
|
-
return x === undefined || x === null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
105
|
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
106
106
|
? { register: () => {}, unregister: () => {} }
|
|
107
107
|
: new FinalizationRegistry(state => {
|
|
@@ -206,6 +206,23 @@ export function init_language_server(writer) {
|
|
|
206
206
|
return Server.__wrap(ret);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
function _assertClass(instance, klass) {
|
|
210
|
+
if (!(instance instanceof klass)) {
|
|
211
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @param {Server} server
|
|
216
|
+
* @param {ReadableStreamDefaultReader} reader
|
|
217
|
+
* @returns {Promise<void>}
|
|
218
|
+
*/
|
|
219
|
+
export function listen(server, reader) {
|
|
220
|
+
_assertClass(server, Server);
|
|
221
|
+
var ptr0 = server.__destroy_into_raw();
|
|
222
|
+
const ret = wasm.listen(ptr0, reader);
|
|
223
|
+
return ret;
|
|
224
|
+
}
|
|
225
|
+
|
|
209
226
|
function takeFromExternrefTable0(idx) {
|
|
210
227
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
211
228
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -274,11 +291,11 @@ export function get_parse_tree(input, offset) {
|
|
|
274
291
|
}
|
|
275
292
|
|
|
276
293
|
function __wbg_adapter_24(arg0, arg1, arg2) {
|
|
277
|
-
wasm.
|
|
294
|
+
wasm.closure583_externref_shim(arg0, arg1, arg2);
|
|
278
295
|
}
|
|
279
296
|
|
|
280
|
-
function
|
|
281
|
-
wasm.
|
|
297
|
+
function __wbg_adapter_100(arg0, arg1, arg2, arg3) {
|
|
298
|
+
wasm.closure595_externref_shim(arg0, arg1, arg2, arg3);
|
|
282
299
|
}
|
|
283
300
|
|
|
284
301
|
const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
|
|
@@ -308,14 +325,6 @@ export class Server {
|
|
|
308
325
|
const ptr = this.__destroy_into_raw();
|
|
309
326
|
wasm.__wbg_server_free(ptr, 0);
|
|
310
327
|
}
|
|
311
|
-
/**
|
|
312
|
-
* @param {ReadableStreamDefaultReader} reader
|
|
313
|
-
* @returns {Promise<void>}
|
|
314
|
-
*/
|
|
315
|
-
listen(reader) {
|
|
316
|
-
const ret = wasm.server_listen(this.__wbg_ptr, reader);
|
|
317
|
-
return ret;
|
|
318
|
-
}
|
|
319
328
|
}
|
|
320
329
|
|
|
321
330
|
async function __wbg_load(module, imports) {
|
|
@@ -415,7 +424,7 @@ function __wbg_get_imports() {
|
|
|
415
424
|
const a = state0.a;
|
|
416
425
|
state0.a = 0;
|
|
417
426
|
try {
|
|
418
|
-
return
|
|
427
|
+
return __wbg_adapter_100(a, state0.b, arg0, arg1);
|
|
419
428
|
} finally {
|
|
420
429
|
state0.a = a;
|
|
421
430
|
}
|
|
@@ -446,10 +455,18 @@ function __wbg_get_imports() {
|
|
|
446
455
|
const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
|
|
447
456
|
return ret;
|
|
448
457
|
}, arguments) };
|
|
458
|
+
imports.wbg.__wbg_now_d18023d54d4e5500 = function(arg0) {
|
|
459
|
+
const ret = arg0.now();
|
|
460
|
+
return ret;
|
|
461
|
+
};
|
|
449
462
|
imports.wbg.__wbg_ok_3aaf32d069979723 = function(arg0) {
|
|
450
463
|
const ret = arg0.ok;
|
|
451
464
|
return ret;
|
|
452
465
|
};
|
|
466
|
+
imports.wbg.__wbg_performance_704644393c4d3310 = function(arg0) {
|
|
467
|
+
const ret = arg0.performance;
|
|
468
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
469
|
+
};
|
|
453
470
|
imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
|
|
454
471
|
const ret = arg0.push(arg1);
|
|
455
472
|
return ret;
|
|
@@ -485,6 +502,9 @@ function __wbg_get_imports() {
|
|
|
485
502
|
imports.wbg.__wbg_setmode_5dc300b865044b65 = function(arg0, arg1) {
|
|
486
503
|
arg0.mode = __wbindgen_enum_RequestMode[arg1];
|
|
487
504
|
};
|
|
505
|
+
imports.wbg.__wbg_setsignal_75b21ef3a81de905 = function(arg0, arg1) {
|
|
506
|
+
arg0.signal = arg1;
|
|
507
|
+
};
|
|
488
508
|
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
489
509
|
const ret = arg1.stack;
|
|
490
510
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -531,6 +551,10 @@ function __wbg_get_imports() {
|
|
|
531
551
|
const ret = arg0.then(arg1, arg2);
|
|
532
552
|
return ret;
|
|
533
553
|
};
|
|
554
|
+
imports.wbg.__wbg_timeout_b622f4968ad3d733 = function(arg0) {
|
|
555
|
+
const ret = AbortSignal.timeout(arg0 >>> 0);
|
|
556
|
+
return ret;
|
|
557
|
+
};
|
|
534
558
|
imports.wbg.__wbg_warn_aaf1f4664a035bd6 = function(arg0, arg1, arg2, arg3) {
|
|
535
559
|
console.warn(arg0, arg1, arg2, arg3);
|
|
536
560
|
};
|
|
@@ -552,8 +576,8 @@ function __wbg_get_imports() {
|
|
|
552
576
|
const ret = false;
|
|
553
577
|
return ret;
|
|
554
578
|
};
|
|
555
|
-
imports.wbg.
|
|
556
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
579
|
+
imports.wbg.__wbindgen_closure_wrapper5537 = function(arg0, arg1, arg2) {
|
|
580
|
+
const ret = makeMutClosure(arg0, arg1, 584, __wbg_adapter_24);
|
|
557
581
|
return ret;
|
|
558
582
|
};
|
|
559
583
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
package/qlue_ls_bg.wasm
CHANGED
|
Binary file
|