qlue-ls 0.9.1 → 0.11.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.
package/README.md CHANGED
@@ -2,109 +2,29 @@
2
2
  🦀 Qlue-ls 🦀
3
3
  </h1>
4
4
 
5
- ⚡Qlue-ls (pronounced "clueless") is a *blazingly fast* [language server](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification) for [SPARQL](https://de.wikipedia.org/wiki/SPARQL), written in Rust 🦀.
5
+ ⚡Qlue-ls (pronounced "clueless") is a *blazingly fast* [language server](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification) for [SPARQL](https://de.wikipedia.org/wiki/SPARQL),
6
+ written in Rust 🦀, build for the web.
6
7
 
8
+ If you want to use Qlue-ls, check out the [documentation](https://docs.qlue-ls.com).
7
9
  To learn more about the origin story of this project, read the [blog post](https://ad-blog.cs.uni-freiburg.de/post/qlue-ls-a-sparql-language-server/).
8
10
 
9
- # 🚀 Getting Started
10
-
11
- ## 📦 Installation
12
-
13
- Qlue-ls is available on [crate.io](https://crates.io/crates/qlue-ls):
14
-
15
- ```shell
16
- cargo install qlue-ls
17
- ```
18
-
19
- And on [PyPI](https://pypi.org/project/qlue-ls/):
20
-
21
- ```shell
22
- pipx install qlue-ls
23
- ```
24
-
25
- You can also build it from source:
26
-
27
- ```shell
28
- git clone https://github.com/IoannisNezis/Qlue-ls.git
29
- cd Qlue-ls
30
- cargo build --release --bin qlue-ls
31
- ```
32
-
33
- ## CLI Usage
34
-
35
- To run Qlue-ls as **formatter** run:
36
-
37
- ```shell
38
- qlue-ls format <PATH>
39
- ```
40
-
41
- To run Qlue-ls as **language server** run:
42
-
43
- ```shell
44
- qlue-ls server
45
- ```
46
-
47
- This will create a language server listening on stdio.
48
-
49
- ## with Neovim
50
-
51
- After you installed the language server, add this to your `init.lua`:
52
-
53
- ```lua
54
- vim.api.nvim_create_autocmd({ 'FileType' }, {
55
- desc = 'Connect to Qlue-ls',
56
- pattern = { 'sparql' },
57
- callback = function()
58
- vim.lsp.start {
59
- name = 'qlue-ls',
60
- cmd = { 'qlue-ls', 'server' },
61
- root_dir = vim.fn.getcwd(),
62
- on_attach = function(client, bufnr)
63
- vim.keymap.set('n', '<leader>f', vim.lsp.buf.format, { buffer = bufnr, desc = 'LSP: ' .. '[F]ormat' })
64
- end,
65
- }
66
- end,
67
- })
68
- ```
69
-
70
- Open a `.rq` file and check that the buffer is attached to th server:
71
-
72
- ```
73
- :checkhealth lsp
74
- ```
75
-
76
- Configure keymaps in `on_attach` function.
77
-
78
11
  # 🚀 Capabilities
79
12
 
80
- ## 📐 Formatting
13
+ Here is a quick overview what Qlue-ls can do.
14
+ A more detailed list can be found in the [documentation](https://docs.qlue-ls.com/03_capabilities/).
81
15
 
82
- **Status**: Full support
16
+ ## 📐 Formatting
83
17
 
84
18
  Formats SPARQL queries to ensure consistent and readable syntax.
85
19
  Customizable options to align with preferred query styles are also implemented.
86
20
 
87
21
  ## 🩺 Diagnostics
88
22
 
89
- **Status**: Partial support
90
-
91
23
  Diagnostics provide feadback on the query.
92
24
  Diagnostics come in severity: error, warning and info
93
25
 
94
- ** provided diagnostics**:
95
-
96
- | Type | Name | Description |
97
- |:------------|:----------------------------|:---------------------------------|
98
- | ❌ error | undefined prefix | a used prefix is not declared |
99
- | ❌ error | ungrouped select variable | selected variable is not grouped |
100
- | ❌ error | invalid projection variable | projection variable is taken |
101
- | ⚠️ warning | unused prefix | a declared prefix is not used |
102
- | ℹ️ info | uncompacted uri | a raw uncompacted uri is used |
103
-
104
26
  ## ✨ Completion
105
27
 
106
- **Status**: Full support
107
-
108
28
  Completion provides suggestions how the query could continue.
109
29
 
110
30
  For completion of subjects, predicates or objects the language server sends
@@ -114,20 +34,27 @@ completion-queries to the backend and gets the completions from the knowledge-gr
114
34
 
115
35
  ## 🛠️ Code Actions
116
36
 
117
- **Status**: Partial support
37
+ Code action suggest complex changes to your input.
38
+ Often in the form of a *quickfix*, to fix a diagnostic.
39
+
40
+ ## ℹ️ Hover
41
+
42
+ Get information about a token on hover.
43
+
44
+ ## 🕳 Jump
45
+
46
+ Quickly jump to the next or previous important location in the query.
118
47
 
119
- | name | description | diagnostic |
120
- |:------------------|:--------------------------------------|:------------------|
121
- | shorten uri | shorten uri into compacted form | uncompacted uri |
122
- | declare prefix | declares undeclared prefix (if known) | undeclared prefix |
123
- | shorten all uri's | shorten all uri's into compacted form | |
124
- | add to result | add variable to selected result | |
125
- | filter variable | add filter for this variable | |
48
+ ## operation identification
49
+
50
+ Determine if a operation is a query or update.
126
51
 
127
52
  # ⚙️ Configuration
128
53
 
129
54
  Qlue-ls can be configured through a `qlue-ls.toml` or `qlue-ls.yml` file.
130
55
 
56
+ Detailed exmplanations can be found in the [documentation](https://docs.qlue-ls.com/04_configuration/).
57
+
131
58
  Here is the full default configuration
132
59
  ```toml
133
60
  [format]
@@ -136,93 +63,21 @@ align_prefixes = true
136
63
  separate_prolouge = false
137
64
  capitalize_keywords = true
138
65
  insert_spaces = true
139
- tab_size = 10
66
+ tab_size = 2
140
67
  where_new_line = true
141
68
  filter_same_line = true
142
69
 
143
70
  [completion]
144
71
  timeout_ms = 5000
145
- result_size_limit = 42
146
- ```
147
-
148
- # 🌐 use in web
149
-
150
- If you want to connect from a web-based-editor, you can use this package as well.
151
- For this purpose this can be compiled to wasm and is available on [npm](https://www.npmjs.com/package/@ioannisnezis/sparql-language-server):
152
-
153
-
154
- ```shell
155
- npm i qlue-ls
156
- ```
157
-
158
- You will have to wrap this in a Web Worker and provide a language server client.
159
- There will be more documentation on this in the future...
160
-
161
- Until then you can check out the demo in ./editor/
162
-
163
- # 🏗 Development Setup
164
-
165
- Here is a quick guide to set this project up for development.
166
-
167
- ## Requirements
168
-
169
- - [rust](https://www.rust-lang.org/tools/install) >= 1.83.0
170
- - [wasm-pack](https://rustwasm.github.io/wasm-pack/) >= 0.13.1
171
- - [node & npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) >= 22.14.0 & >= 11.3.0
172
- - \[Optional\] [just](https://github.com/casey/just)
173
- - \[Optional\] [watchexec](https://github.com/watchexec/watchexec)
174
-
175
- ## Initial Setup
176
-
177
- You will only have to do this once.
178
-
179
- In the `justfile` and `Makefile` you will find the target `init_dev`, run it:
72
+ result_size_limit = 100
180
73
 
181
- ```bash
182
- just init_dev
74
+ [prefixes]
75
+ add_missing = true
76
+ remove_unused = true
183
77
  ```
184
78
 
185
- or
186
-
187
- ```bash
188
- make init_dev
189
- ```
190
-
191
- It will:
192
- - install node dependencies
193
- - build wasm binaries
194
- - link against local packages
195
- - run the vite dev server
196
-
197
- If you don't have [just](https://github.com/casey/just) or [make](https://wiki.ubuntuusers.de/Makefile/) installed:
198
-
199
- **Install [just](https://github.com/casey/just)**
200
-
201
-
202
- ## Automatically rebuild on change
203
-
204
- When developping the cycle is:
205
-
206
- - Change the code
207
- - Compile to wasm (or run tests)
208
- - Evaluate
209
-
210
- To avoid having to run a command each time to Compile I strongly recommend setting up a
211
- auto runner like [watchexec](https://github.com/watchexec/watchexec).
212
-
213
- ```bash
214
- watchexec --restart --exts rs --exts toml just build-wasm
215
- ```
216
-
217
- or just:
218
-
219
- ```bash
220
- just watch-and-run build-wasm
221
- ```
222
-
223
- have fun!
224
-
225
79
  # 🙏 Special Thanks
226
80
 
227
81
  * [TJ DeVries](https://github.com/tjdevries) for the inspiration and great tutorials
228
82
  * [Chris Biscardi](https://github.com/christopherbiscardi) for teaching me Rust
83
+ * [Hannah Bast](https://ad.informatik.uni-freiburg.de/staff/bast) for the guidance.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Ioannis Nezis <ioannis@nezis.de>"
6
6
  ],
7
7
  "description": "A language server for SPARQL",
8
- "version": "0.9.1",
8
+ "version": "0.11.0",
9
9
  "license": "SEE LICENSE IN LICENSE",
10
10
  "repository": {
11
11
  "type": "git",
package/qlue_ls.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function format_raw(text: string): string;
4
3
  export function init_language_server(writer: WritableStreamDefaultWriter): Server;
5
4
  export function listen(server: Server, reader: ReadableStreamDefaultReader): Promise<void>;
6
- export function determine_operation_type(input: string): string;
7
5
  export function get_parse_tree(input: string, offset: number): any;
8
6
  export class Server {
9
7
  private constructor();
@@ -14,11 +12,9 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
14
12
 
15
13
  export interface InitOutput {
16
14
  readonly memory: WebAssembly.Memory;
17
- readonly format_raw: (a: number, b: number) => [number, number, number, number];
15
+ readonly __wbg_server_free: (a: number, b: number) => void;
18
16
  readonly init_language_server: (a: any) => number;
19
17
  readonly listen: (a: number, b: any) => any;
20
- readonly determine_operation_type: (a: number, b: number) => [number, number];
21
- readonly __wbg_server_free: (a: number, b: number) => void;
22
18
  readonly get_parse_tree: (a: number, b: number, c: number) => any;
23
19
  readonly __wbindgen_exn_store: (a: number) => void;
24
20
  readonly __externref_table_alloc: () => number;
@@ -27,9 +23,8 @@ export interface InitOutput {
27
23
  readonly __wbindgen_malloc: (a: number, b: number) => number;
28
24
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
29
25
  readonly __wbindgen_export_6: WebAssembly.Table;
30
- readonly __externref_table_dealloc: (a: number) => void;
31
- readonly closure1210_externref_shim: (a: number, b: number, c: any) => void;
32
- readonly closure1579_externref_shim: (a: number, b: number, c: any, d: any) => void;
26
+ readonly closure1218_externref_shim: (a: number, b: number, c: any) => void;
27
+ readonly closure1588_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
28
  readonly __wbindgen_start: () => void;
34
29
  }
35
30
 
package/qlue_ls.js CHANGED
@@ -197,37 +197,6 @@ function debugString(val) {
197
197
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
198
  return className;
199
199
  }
200
-
201
- function takeFromExternrefTable0(idx) {
202
- const value = wasm.__wbindgen_export_2.get(idx);
203
- wasm.__externref_table_dealloc(idx);
204
- return value;
205
- }
206
- /**
207
- * @param {string} text
208
- * @returns {string}
209
- */
210
- export function format_raw(text) {
211
- let deferred3_0;
212
- let deferred3_1;
213
- try {
214
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
215
- const len0 = WASM_VECTOR_LEN;
216
- const ret = wasm.format_raw(ptr0, len0);
217
- var ptr2 = ret[0];
218
- var len2 = ret[1];
219
- if (ret[3]) {
220
- ptr2 = 0; len2 = 0;
221
- throw takeFromExternrefTable0(ret[2]);
222
- }
223
- deferred3_0 = ptr2;
224
- deferred3_1 = len2;
225
- return getStringFromWasm0(ptr2, len2);
226
- } finally {
227
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
228
- }
229
- }
230
-
231
200
  /**
232
201
  * @param {WritableStreamDefaultWriter} writer
233
202
  * @returns {Server}
@@ -254,25 +223,6 @@ export function listen(server, reader) {
254
223
  return ret;
255
224
  }
256
225
 
257
- /**
258
- * @param {string} input
259
- * @returns {string}
260
- */
261
- export function determine_operation_type(input) {
262
- let deferred2_0;
263
- let deferred2_1;
264
- try {
265
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
266
- const len0 = WASM_VECTOR_LEN;
267
- const ret = wasm.determine_operation_type(ptr0, len0);
268
- deferred2_0 = ret[0];
269
- deferred2_1 = ret[1];
270
- return getStringFromWasm0(ret[0], ret[1]);
271
- } finally {
272
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
273
- }
274
- }
275
-
276
226
  /**
277
227
  * @param {string} input
278
228
  * @param {number} offset
@@ -286,11 +236,11 @@ export function get_parse_tree(input, offset) {
286
236
  }
287
237
 
288
238
  function __wbg_adapter_24(arg0, arg1, arg2) {
289
- wasm.closure1210_externref_shim(arg0, arg1, arg2);
239
+ wasm.closure1218_externref_shim(arg0, arg1, arg2);
290
240
  }
291
241
 
292
- function __wbg_adapter_100(arg0, arg1, arg2, arg3) {
293
- wasm.closure1579_externref_shim(arg0, arg1, arg2, arg3);
242
+ function __wbg_adapter_98(arg0, arg1, arg2, arg3) {
243
+ wasm.closure1588_externref_shim(arg0, arg1, arg2, arg3);
294
244
  }
295
245
 
296
246
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
@@ -419,7 +369,7 @@ function __wbg_get_imports() {
419
369
  const a = state0.a;
420
370
  state0.a = 0;
421
371
  try {
422
- return __wbg_adapter_100(a, state0.b, arg0, arg1);
372
+ return __wbg_adapter_98(a, state0.b, arg0, arg1);
423
373
  } finally {
424
374
  state0.a = a;
425
375
  }
@@ -571,8 +521,8 @@ function __wbg_get_imports() {
571
521
  const ret = false;
572
522
  return ret;
573
523
  };
574
- imports.wbg.__wbindgen_closure_wrapper5403 = function(arg0, arg1, arg2) {
575
- const ret = makeMutClosure(arg0, arg1, 1211, __wbg_adapter_24);
524
+ imports.wbg.__wbindgen_closure_wrapper5519 = function(arg0, arg1, arg2) {
525
+ const ret = makeMutClosure(arg0, arg1, 1219, __wbg_adapter_24);
576
526
  return ret;
577
527
  };
578
528
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
package/qlue_ls_bg.wasm CHANGED
Binary file