@fossil-lang/wasm 0.3.0-alpha.19 → 0.3.0-alpha.20
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 +0 -1
- package/dist/client.d.ts +9 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -12
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +23 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/load.d.ts +1 -1
- package/dist/load.js +1 -1
- package/dist/program.d.ts +4 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +6 -2
- package/dist/program.js.map +1 -1
- package/package.json +4 -4
- package/pkg/fossil_wasm.d.ts +15 -21
- package/pkg/fossil_wasm.js +23 -27
- package/pkg/fossil_wasm_bg.wasm +0 -0
- package/pkg/fossil_wasm_bg.wasm.d.ts +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,6 @@ JS/TS wrapper around the `fossil-wasm` Rust crate's wasm-bindgen artefacts. Prov
|
|
|
9
9
|
package and the host's bundler emits it as an asset; the host copies nothing.
|
|
10
10
|
- `tokenize(text)` — calls the Rust lexer, returns `TokenRow[]`. The Rust lexer
|
|
11
11
|
is the only lexer: no host reimplements one and drifts from the grammar.
|
|
12
|
-
- `semanticLegend()` — returns the LSP semantic-tokens legend.
|
|
13
12
|
- `FossilWorkspace` — the Workspace API class for LSP + compile. `fossil-lsp`
|
|
14
13
|
itself is native-only (stdio over crossbeam), so the browser gets this
|
|
15
14
|
equivalent dispatch surface over the same `fossil-ide` functions.
|
package/dist/client.d.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* Mirrors `@fossil-lang/corpus`'s `client.ts` split, the known-good shape.
|
|
13
13
|
*/
|
|
14
14
|
import { FileHandle as RawFileHandle } from '../pkg/fossil_wasm.js';
|
|
15
|
-
import type { DocumentWorkspace, MissingDocument, ProgramSource,
|
|
16
|
-
import type { CheckRow, CompletionRow, DefinitionRow, HoverRow, InferredDescriptorJson, SourceRefInfo, ProviderInfo } from './index.js';
|
|
15
|
+
import type { DocumentWorkspace, MissingDocument, ProgramSource, TokenKindLegend, TokenRow } from '@fossil-lang/types';
|
|
16
|
+
import type { CheckRow, CompletionRow, DefinitionRow, HoverRow, InferredDescriptorJson, SemanticTokenRow, SourceRefInfo, ProviderInfo } from './index.js';
|
|
17
17
|
/**
|
|
18
18
|
* Opaque file-handle returned by {@link FossilWorkspace.openFile}. Pass it
|
|
19
19
|
* back into the matching `updateFile` / `closeFile` / `diagnosticsFor`
|
|
@@ -50,15 +50,6 @@ export declare function tokenize(text: string): TokenRow[];
|
|
|
50
50
|
* MUST be called after {@link initFossilWasm} has resolved.
|
|
51
51
|
*/
|
|
52
52
|
export declare function tokenKinds(): TokenKindLegend;
|
|
53
|
-
/**
|
|
54
|
-
* Returns the LSP `SemanticTokensLegend` (token types + modifiers list) the
|
|
55
|
-
* editor uses to map LSP `semanticTokens/full` response indices to highlight
|
|
56
|
-
* categories. Re-export of `fossil_ide::semantic_legend` over the wasm-bindgen
|
|
57
|
-
* boundary — NO duplicate legend definition lives here.
|
|
58
|
-
*
|
|
59
|
-
* MUST be called after {@link initFossilWasm} has resolved.
|
|
60
|
-
*/
|
|
61
|
-
export declare function semanticLegend(): SemanticTokensLegend;
|
|
62
53
|
/**
|
|
63
54
|
* Parse a Fossil program and return its external references — the typed lineage
|
|
64
55
|
* (every data URI + `schema =` argument, each tagged with its `@conn` alias and
|
|
@@ -190,6 +181,13 @@ export declare class FossilWorkspace {
|
|
|
190
181
|
* host with a single editor pane has to read `uri` before it moves a cursor.
|
|
191
182
|
*/
|
|
192
183
|
gotoDefinition(handle: FileHandle, line: number, character: number): DefinitionRow[];
|
|
184
|
+
/**
|
|
185
|
+
* Every classified span of the file at `handle`, in source order — the
|
|
186
|
+
* semantic layer an editor lays over {@link tokenize}'s lexical one. Ranges
|
|
187
|
+
* are LSP (UTF-16), like {@link hover}'s, and the same staleness note
|
|
188
|
+
* applies: push the buffer before you ask.
|
|
189
|
+
*/
|
|
190
|
+
semanticTokens(handle: FileHandle): SemanticTokenRow[];
|
|
193
191
|
/**
|
|
194
192
|
* Register an {@link InferredDescriptorJson} under the source URI the program
|
|
195
193
|
* wrote, BEFORE invoking {@link check}. The Rust compiler reads from this
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,UAAU,IAAI,aAAa,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,UAAU,IAAI,aAAa,EAK5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,aAAa,EACb,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC;AAEvC;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CAMjD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,IAAI,eAAe,CAE5C;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAErD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,IAAI,YAAY,EAAE,CAE1C;AAED;;;;;;;;;;GAUG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,C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U,GAAG,gBAAgB,EAAE;IAItD;;;;;;;;;;;;OAYG;IACH,0BAA0B,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI;CAKrE"}
|
package/dist/client.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* seen when the codemirror tokenizer calls `tokenize` on the main thread).
|
|
12
12
|
* Mirrors `@fossil-lang/corpus`'s `client.ts` split, the known-good shape.
|
|
13
13
|
*/
|
|
14
|
-
import { FossilWorkspace as RawFossilWorkspace, FileHandle as RawFileHandle, tokenize as rawTokenize,
|
|
14
|
+
import { FossilWorkspace as RawFossilWorkspace, FileHandle as RawFileHandle, tokenize as rawTokenize, tokenKinds as rawTokenKinds, refs as rawRefs, providers as rawProviders, } from '../pkg/fossil_wasm.js';
|
|
15
15
|
/**
|
|
16
16
|
* Tokenize a Fossil source string. Returns the byte-range tokens from the
|
|
17
17
|
* canonical Rust lexer (`fossil_syntax::lexer::raw_lex`) — the single grammar
|
|
@@ -48,17 +48,6 @@ export function tokenize(text) {
|
|
|
48
48
|
export function tokenKinds() {
|
|
49
49
|
return rawTokenKinds();
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Returns the LSP `SemanticTokensLegend` (token types + modifiers list) the
|
|
53
|
-
* editor uses to map LSP `semanticTokens/full` response indices to highlight
|
|
54
|
-
* categories. Re-export of `fossil_ide::semantic_legend` over the wasm-bindgen
|
|
55
|
-
* boundary — NO duplicate legend definition lives here.
|
|
56
|
-
*
|
|
57
|
-
* MUST be called after {@link initFossilWasm} has resolved.
|
|
58
|
-
*/
|
|
59
|
-
export function semanticLegend() {
|
|
60
|
-
return rawSemanticLegend();
|
|
61
|
-
}
|
|
62
51
|
/**
|
|
63
52
|
* Parse a Fossil program and return its external references — the typed lineage
|
|
64
53
|
* (every data URI + `schema =` argument, each tagged with its `@conn` alias and
|
|
@@ -230,6 +219,15 @@ export class FossilWorkspace {
|
|
|
230
219
|
gotoDefinition(handle, line, character) {
|
|
231
220
|
return this._inner.gotoDefinition(handle, line, character);
|
|
232
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Every classified span of the file at `handle`, in source order — the
|
|
224
|
+
* semantic layer an editor lays over {@link tokenize}'s lexical one. Ranges
|
|
225
|
+
* are LSP (UTF-16), like {@link hover}'s, and the same staleness note
|
|
226
|
+
* applies: push the buffer before you ask.
|
|
227
|
+
*/
|
|
228
|
+
semanticTokens(handle) {
|
|
229
|
+
return this._inner.semanticTokens(handle);
|
|
230
|
+
}
|
|
233
231
|
/**
|
|
234
232
|
* Register an {@link InferredDescriptorJson} under the source URI the program
|
|
235
233
|
* wrote, BEFORE invoking {@link check}. The Rust compiler reads from this
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,eAAe,IAAI,kBAAkB,EACrC,UAAU,IAAI,aAAa,EAC3B,QAAQ,IAAI,WAAW,EACvB,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,eAAe,IAAI,kBAAkB,EACrC,UAAU,IAAI,aAAa,EAC3B,QAAQ,IAAI,WAAW,EACvB,UAAU,IAAI,aAAa,EAC3B,IAAI,IAAI,OAAO,EACf,SAAS,IAAI,YAAY,GAC1B,MAAM,uBAAuB,CAAC;AA4B/B;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,6EAA6E;IAC7E,sEAAsE;IACtE,8EAA8E;IAC9E,6EAA6E;IAC7E,OAAO,WAAW,CAAC,IAAI,CAAe,CAAC;AACzC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,aAAa,EAAc,CAAC;AACrC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU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AC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAuB,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,0BAA0B,CAAC,UAAkC;QAC3D,4EAA4E;QAC5E,uBAAuB;QACvB,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACrE,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
* forgotten, so the next call tries again.
|
|
8
8
|
* - {@link tokenize} — calls the Rust lexer, returns TokenRow[].
|
|
9
9
|
* - {@link tokenKinds} — the legend for TokenRow.kind: variant names by index.
|
|
10
|
-
* - {@link semanticLegend} — returns the LSP SemanticTokensLegend.
|
|
11
10
|
* - {@link openProgram} — one program open for an editor: the workspace, the push-before-ask
|
|
12
11
|
* discipline and the document resolution a host would otherwise write, shaped to spread into
|
|
13
12
|
* `@fossil-lang/codemirror-fossil`'s `fossil()`. What a host with one editor calls.
|
|
14
13
|
* - {@link FossilWorkspace} — Workspace API class: open / update / close,
|
|
15
14
|
* `check`, the three position queries (`hover`, `completions`,
|
|
16
|
-
* `gotoDefinition`) an editor draws its IDE surface from, and the documents
|
|
15
|
+
* `gotoDefinition`) and `semanticTokens` an editor draws its IDE surface from, and the documents
|
|
17
16
|
* and sources a program reads (`missingDocuments`, `registerDocument`,
|
|
18
17
|
* `sources`) that a host resolves through its `Host`.
|
|
19
18
|
*
|
|
@@ -27,7 +26,7 @@
|
|
|
27
26
|
*/
|
|
28
27
|
export { initFossilWasm } from './load.js';
|
|
29
28
|
export type { InitInput } from './load.js';
|
|
30
|
-
export { tokenize, tokenKinds,
|
|
29
|
+
export { tokenize, tokenKinds, FossilWorkspace, refs, providers, } from './client.js';
|
|
31
30
|
export type { FileHandle } from './client.js';
|
|
32
31
|
export { openProgram } from './program.js';
|
|
33
32
|
export type { FossilProgram, OpenProgramOptions } from './program.js';
|
|
@@ -91,6 +90,10 @@ export interface CompletionRow {
|
|
|
91
90
|
label: string;
|
|
92
91
|
kind: string;
|
|
93
92
|
detail: string;
|
|
93
|
+
/** What picking the row writes: the label's one spelling — the label itself,
|
|
94
|
+
* or `"Person.id"` for a column whose name is not an identifier. Never
|
|
95
|
+
* empty. */
|
|
96
|
+
insert: string;
|
|
94
97
|
}
|
|
95
98
|
/** One place {@link FossilWorkspace.gotoDefinition} found a definition.
|
|
96
99
|
*
|
|
@@ -103,6 +106,22 @@ export interface DefinitionRow {
|
|
|
103
106
|
uri: string;
|
|
104
107
|
range: LspRange;
|
|
105
108
|
}
|
|
109
|
+
/** One classified span from {@link FossilWorkspace.semanticTokens} — what the
|
|
110
|
+
* compiler knows about a stretch of the program that the lexer cannot: that
|
|
111
|
+
* `Person` is a shape, `users` a binding being declared, `@warehouse` a
|
|
112
|
+
* connection inside a string.
|
|
113
|
+
*
|
|
114
|
+
* `kind` is the semantic-token type by legend NAME (`"type"`, `"namespace"`,
|
|
115
|
+
* `"function"`, `"property"`, `"parameter"`, `"variable"`, `"keyword"`,
|
|
116
|
+
* `"string"`, `"number"`, `"operator"`, `"comment"`); `modifiers` likewise
|
|
117
|
+
* (`"declaration"`), empty when there are none. Names and not indices, for the
|
|
118
|
+
* reason {@link CompletionRow.kind} is one. Rows are in source order and never
|
|
119
|
+
* overlap; a range may cross a line. */
|
|
120
|
+
export interface SemanticTokenRow {
|
|
121
|
+
range: LspRange;
|
|
122
|
+
kind: string;
|
|
123
|
+
modifiers: string[];
|
|
124
|
+
}
|
|
106
125
|
/**
|
|
107
126
|
* The primitive lattice, as `fossil-graph-schema` serialises it — the same enum
|
|
108
127
|
* the checker types against, not a set of names it looks up.
|
|
@@ -152,5 +171,5 @@ export interface InferredDescriptorJson {
|
|
|
152
171
|
*/
|
|
153
172
|
freshness_token: string;
|
|
154
173
|
}
|
|
155
|
-
export type { TokenRow,
|
|
174
|
+
export type { TokenRow, Host, MissingDocument, UnreadDocument, DocumentWorkspace, ProgramSource, } from '@fossil-lang/types';
|
|
156
175
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAUH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,IAAI,EACJ,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEtE;;;4EAG4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;CACzB;AAED;;oEAEoE;AACpE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;CAClC;AAED;2FAC2F;AAC3F,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;8EAE8E;AAC9E,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CA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
|
|
|
7
7
|
* forgotten, so the next call tries again.
|
|
8
8
|
* - {@link tokenize} — calls the Rust lexer, returns TokenRow[].
|
|
9
9
|
* - {@link tokenKinds} — the legend for TokenRow.kind: variant names by index.
|
|
10
|
-
* - {@link semanticLegend} — returns the LSP SemanticTokensLegend.
|
|
11
10
|
* - {@link openProgram} — one program open for an editor: the workspace, the push-before-ask
|
|
12
11
|
* discipline and the document resolution a host would otherwise write, shaped to spread into
|
|
13
12
|
* `@fossil-lang/codemirror-fossil`'s `fossil()`. What a host with one editor calls.
|
|
14
13
|
* - {@link FossilWorkspace} — Workspace API class: open / update / close,
|
|
15
14
|
* `check`, the three position queries (`hover`, `completions`,
|
|
16
|
-
* `gotoDefinition`) an editor draws its IDE surface from, and the documents
|
|
15
|
+
* `gotoDefinition`) and `semanticTokens` an editor draws its IDE surface from, and the documents
|
|
17
16
|
* and sources a program reads (`missingDocuments`, `registerDocument`,
|
|
18
17
|
* `sources`) that a host resolves through its `Host`.
|
|
19
18
|
*
|
|
@@ -26,6 +25,6 @@
|
|
|
26
25
|
* const extensions = fossil({ ...program, onNavigate });
|
|
27
26
|
*/
|
|
28
27
|
export { initFossilWasm } from './load.js';
|
|
29
|
-
export { tokenize, tokenKinds,
|
|
28
|
+
export { tokenize, tokenKinds, FossilWorkspace, refs, providers, } from './client.js';
|
|
30
29
|
export { openProgram } from './program.js';
|
|
31
30
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAUH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,IAAI,EACJ,SAAS,GACV,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/load.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { InitInput } from '../pkg/fossil_wasm.js';
|
|
|
2
2
|
export type { InitInput };
|
|
3
3
|
/**
|
|
4
4
|
* Boot the fossil-wasm module. MUST be awaited before calling any of
|
|
5
|
-
* {@link tokenize}, {@link
|
|
5
|
+
* {@link tokenize}, {@link tokenKinds}, or instantiating
|
|
6
6
|
* {@link FossilWorkspace}. A boot that succeeded is kept; one that failed is
|
|
7
7
|
* not, so the next call tries again — `module/unreachable` for a module that could not be
|
|
8
8
|
* fetched within 60 s, `internal/bug` for one that would not instantiate.
|
package/dist/load.js
CHANGED
|
@@ -6,7 +6,7 @@ import { boot } from '@fossil-lang/types';
|
|
|
6
6
|
let _initPromise = null;
|
|
7
7
|
/**
|
|
8
8
|
* Boot the fossil-wasm module. MUST be awaited before calling any of
|
|
9
|
-
* {@link tokenize}, {@link
|
|
9
|
+
* {@link tokenize}, {@link tokenKinds}, or instantiating
|
|
10
10
|
* {@link FossilWorkspace}. A boot that succeeded is kept; one that failed is
|
|
11
11
|
* not, so the next call tries again — `module/unreachable` for a module that could not be
|
|
12
12
|
* fetched within 60 s, `internal/bug` for one that would not instantiate.
|
package/dist/program.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Host, type ProgramSource } from '@fossil-lang/types';
|
|
2
2
|
import { FossilWorkspace, tokenize, tokenKinds } from './client.js';
|
|
3
|
-
import type { CheckRow, CompletionRow, DefinitionRow, HoverRow, InferredDescriptorJson } from './index.js';
|
|
3
|
+
import type { CheckRow, CompletionRow, DefinitionRow, HoverRow, InferredDescriptorJson, SemanticTokenRow } from './index.js';
|
|
4
4
|
import { type InitInput } from './load.js';
|
|
5
5
|
/** What {@link openProgram} takes beside the key. */
|
|
6
6
|
export interface OpenProgramOptions {
|
|
@@ -24,6 +24,9 @@ export interface FossilProgram {
|
|
|
24
24
|
readonly tokenize: typeof tokenize;
|
|
25
25
|
/** The legend for a token's `kind`. */
|
|
26
26
|
readonly tokenKinds: typeof tokenKinds;
|
|
27
|
+
/** What the compiler knows about each name and reference — shapes, declarations, connections —
|
|
28
|
+
* laid over {@link tokenize}'s lexical highlighting. */
|
|
29
|
+
semanticTokens(text: string): SemanticTokenRow[];
|
|
27
30
|
/**
|
|
28
31
|
* Push the text, read every document it names that the workspace lacks, and check. No debounce:
|
|
29
32
|
* `fossil()`'s linter waits out its own delay AND waits for this to return before it schedules
|
package/dist/program.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAS,KAAK,IAAI,EAAE,KAAK,aAAa,EAAuB,MAAM,oBAAoB,CAAC;AAE/F,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,aAAa,EACb,QAAQ,EACR,sBAAsB,
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAS,KAAK,IAAI,EAAE,KAAK,aAAa,EAAuB,MAAM,oBAAoB,CAAC;AAE/F,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,aAAa,EACb,QAAQ,EACR,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3D,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,yFAAyF;IACzF,IAAI,EAAE,IAAI,CAAC;IACX,6FAA6F;IAC7F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd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kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CA6ElG"}
|
package/dist/program.js
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* missing.
|
|
19
19
|
*
|
|
20
20
|
* The result is shaped for `@fossil-lang/codemirror-fossil`'s `fossil()`: `tokenize`,
|
|
21
|
-
* `tokenKinds`, `uri`, `check`, `hover`, `complete` and `definition` are exactly
|
|
22
|
-
* names, so a host spreads it and adds what is its own to decide:
|
|
21
|
+
* `tokenKinds`, `semanticTokens`, `uri`, `check`, `hover`, `complete` and `definition` are exactly
|
|
22
|
+
* its option names, so a host spreads it and adds what is its own to decide:
|
|
23
23
|
*
|
|
24
24
|
* ```ts
|
|
25
25
|
* const program = await openProgram('job.fossil', { host, text });
|
|
@@ -85,6 +85,10 @@ export async function openProgram(uri, options) {
|
|
|
85
85
|
}));
|
|
86
86
|
return [...failed, ...rows];
|
|
87
87
|
},
|
|
88
|
+
semanticTokens(next) {
|
|
89
|
+
sync(next);
|
|
90
|
+
return workspace.semanticTokens(handle);
|
|
91
|
+
},
|
|
88
92
|
hover(next, line, character) {
|
|
89
93
|
sync(next);
|
|
90
94
|
return workspace.hover(handle, line, character);
|
package/dist/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAsD,MAAM,oBAAoB,CAAC;AAE/F,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,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C,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAClD,CAAC;QACD,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS;YAC5B,IAAI,CAAC,IAAI,CAAC,CAAC;YACX,OAAO,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACxD,CAAC;QACD,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS;YAC9B,IAAI,CAAC,IAAI,CAAC,CAAC;YACX,OAAO,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAC3D,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,IAAI;YAChB,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;QACD,kBAAkB,CAAC,UAAU;YAC3B,SAAS,CAAC,0BAA0B,CAAC,UAAU,CAAC,CAAC;QACnD,CAAC;QACD,SAAS;QACT,KAAK;YACH,SAAS,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fossil-lang/wasm",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
4
|
-
"description": "JS/TS wrapper around the fossil-wasm wasm-bindgen artifacts (--target web). Exposes initFossilWasm + tokenize +
|
|
3
|
+
"version": "0.3.0-alpha.20",
|
|
4
|
+
"description": "JS/TS wrapper around the fossil-wasm wasm-bindgen artifacts (--target web). Exposes initFossilWasm + tokenize + openProgram + FossilWorkspace class for downstream @fossil-lang/* packages.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"sideEffects": false,
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fossil-lang/storage": "0.3.0-alpha.
|
|
37
|
-
"@fossil-lang/types": "0.3.0-alpha.
|
|
36
|
+
"@fossil-lang/storage": "0.3.0-alpha.20",
|
|
37
|
+
"@fossil-lang/types": "0.3.0-alpha.20"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "^5.6.0",
|
package/pkg/fossil_wasm.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export class FossilWorkspace {
|
|
|
100
100
|
*/
|
|
101
101
|
close_file(handle: FileHandle): void;
|
|
102
102
|
/**
|
|
103
|
-
* The completion candidates at a position: `{ label, kind, detail }` rows,
|
|
103
|
+
* The completion candidates at a position: `{ label, kind, detail, insert }` rows,
|
|
104
104
|
* already narrowed by the receiver — `str.` offers string members and no
|
|
105
105
|
* reader, a property key position offers the target shape's predicates and
|
|
106
106
|
* no catalogue row.
|
|
@@ -215,6 +215,17 @@ export class FossilWorkspace {
|
|
|
215
215
|
* - The workspace is busy.
|
|
216
216
|
*/
|
|
217
217
|
registerInferredDescriptor(descriptor_json: string): void;
|
|
218
|
+
/**
|
|
219
|
+
* Every classified span of the file: `{ range, kind, modifiers }` rows in
|
|
220
|
+
* source order, `kind` and `modifiers` by legend NAME. An editor lays these
|
|
221
|
+
* over its lexical highlighting — see [`ide::SemanticTokenRow`].
|
|
222
|
+
*
|
|
223
|
+
* # Errors
|
|
224
|
+
*
|
|
225
|
+
* Returns a JS error if the workspace is busy, or if the result fails to
|
|
226
|
+
* serialize to `JsValue`. An unknown handle is an empty array.
|
|
227
|
+
*/
|
|
228
|
+
semanticTokens(handle: FileHandle): any;
|
|
218
229
|
/**
|
|
219
230
|
* Replace the connection map `@name/…` expands against, as
|
|
220
231
|
* `Host.connections()` answers it.
|
|
@@ -278,23 +289,6 @@ export function providers(): any;
|
|
|
278
289
|
*/
|
|
279
290
|
export function refs(program: string): any;
|
|
280
291
|
|
|
281
|
-
/**
|
|
282
|
-
* `JS`-facing re-export of the semantic-token legend.
|
|
283
|
-
*
|
|
284
|
-
* Returns `{ tokenTypes: string[], tokenModifiers: string[] }` — the exact
|
|
285
|
-
* LSP `SemanticTokensLegend` shape, which is what turns the indices in a
|
|
286
|
-
* `semanticTokens/full` response into names a host can style.
|
|
287
|
-
*
|
|
288
|
-
* Delegates to [`fossil_ide::semantic_legend`], the one definition — a second
|
|
289
|
-
* legend here would desynchronise the indices the native LSP already emits.
|
|
290
|
-
*
|
|
291
|
-
* # Errors
|
|
292
|
-
*
|
|
293
|
-
* Returns a JS error only if `serde_wasm_bindgen` fails (impossible in
|
|
294
|
-
* practice for the legend shape).
|
|
295
|
-
*/
|
|
296
|
-
export function semantic_legend(): any;
|
|
297
|
-
|
|
298
292
|
/**
|
|
299
293
|
* The name of every [`TokenRow::kind`], indexed BY that kind.
|
|
300
294
|
*
|
|
@@ -303,8 +297,8 @@ export function semantic_legend(): any;
|
|
|
303
297
|
* discriminant down, which is the only version of this contract that survives
|
|
304
298
|
* a reorder of the lexer.
|
|
305
299
|
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
300
|
+
* Semantic tokens make the same move one step further: `semanticTokens()`
|
|
301
|
+
* sends the legend's names themselves, so no index crosses at all.
|
|
308
302
|
*
|
|
309
303
|
* A kind past the end of the array is a variant appended by a newer compiler
|
|
310
304
|
* than the host was built against. That is BACKWARDS-COMPATIBLE by
|
|
@@ -335,7 +329,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
335
329
|
export interface InitOutput {
|
|
336
330
|
readonly memory: WebAssembly.Memory;
|
|
337
331
|
readonly tokenize: (a: number, b: number) => [number, number, number];
|
|
338
|
-
readonly semantic_legend: () => [number, number, number];
|
|
339
332
|
readonly tokenKinds: () => [number, number, number];
|
|
340
333
|
readonly __wbg_filehandle_free: (a: number, b: number) => void;
|
|
341
334
|
readonly __wbg_fossilworkspace_free: (a: number, b: number) => void;
|
|
@@ -352,6 +345,7 @@ export interface InitOutput {
|
|
|
352
345
|
readonly fossilworkspace_hover: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
353
346
|
readonly fossilworkspace_completions: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
354
347
|
readonly fossilworkspace_gotoDefinition: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
348
|
+
readonly fossilworkspace_semanticTokens: (a: number, b: number) => [number, number, number];
|
|
355
349
|
readonly fossilworkspace_registerInferredDescriptor: (a: number, b: number, c: number) => [number, number];
|
|
356
350
|
readonly providers: () => [number, number, number];
|
|
357
351
|
readonly refs: (a: number, b: number) => [number, number, number];
|
package/pkg/fossil_wasm.js
CHANGED
|
@@ -135,7 +135,7 @@ export class FossilWorkspace {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
* The completion candidates at a position: `{ label, kind, detail }` rows,
|
|
138
|
+
* The completion candidates at a position: `{ label, kind, detail, insert }` rows,
|
|
139
139
|
* already narrowed by the receiver — `str.` offers string members and no
|
|
140
140
|
* reader, a property key position offers the target shape's predicates and
|
|
141
141
|
* no catalogue row.
|
|
@@ -338,6 +338,26 @@ export class FossilWorkspace {
|
|
|
338
338
|
throw takeFromExternrefTable0(ret[0]);
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Every classified span of the file: `{ range, kind, modifiers }` rows in
|
|
343
|
+
* source order, `kind` and `modifiers` by legend NAME. An editor lays these
|
|
344
|
+
* over its lexical highlighting — see [`ide::SemanticTokenRow`].
|
|
345
|
+
*
|
|
346
|
+
* # Errors
|
|
347
|
+
*
|
|
348
|
+
* Returns a JS error if the workspace is busy, or if the result fails to
|
|
349
|
+
* serialize to `JsValue`. An unknown handle is an empty array.
|
|
350
|
+
* @param {FileHandle} handle
|
|
351
|
+
* @returns {any}
|
|
352
|
+
*/
|
|
353
|
+
semanticTokens(handle) {
|
|
354
|
+
_assertClass(handle, FileHandle);
|
|
355
|
+
const ret = wasm.fossilworkspace_semanticTokens(this.__wbg_ptr, handle.__wbg_ptr);
|
|
356
|
+
if (ret[2]) {
|
|
357
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
358
|
+
}
|
|
359
|
+
return takeFromExternrefTable0(ret[0]);
|
|
360
|
+
}
|
|
341
361
|
/**
|
|
342
362
|
* Replace the connection map `@name/…` expands against, as
|
|
343
363
|
* `Host.connections()` answers it.
|
|
@@ -444,30 +464,6 @@ export function refs(program) {
|
|
|
444
464
|
return takeFromExternrefTable0(ret[0]);
|
|
445
465
|
}
|
|
446
466
|
|
|
447
|
-
/**
|
|
448
|
-
* `JS`-facing re-export of the semantic-token legend.
|
|
449
|
-
*
|
|
450
|
-
* Returns `{ tokenTypes: string[], tokenModifiers: string[] }` — the exact
|
|
451
|
-
* LSP `SemanticTokensLegend` shape, which is what turns the indices in a
|
|
452
|
-
* `semanticTokens/full` response into names a host can style.
|
|
453
|
-
*
|
|
454
|
-
* Delegates to [`fossil_ide::semantic_legend`], the one definition — a second
|
|
455
|
-
* legend here would desynchronise the indices the native LSP already emits.
|
|
456
|
-
*
|
|
457
|
-
* # Errors
|
|
458
|
-
*
|
|
459
|
-
* Returns a JS error only if `serde_wasm_bindgen` fails (impossible in
|
|
460
|
-
* practice for the legend shape).
|
|
461
|
-
* @returns {any}
|
|
462
|
-
*/
|
|
463
|
-
export function semantic_legend() {
|
|
464
|
-
const ret = wasm.semantic_legend();
|
|
465
|
-
if (ret[2]) {
|
|
466
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
467
|
-
}
|
|
468
|
-
return takeFromExternrefTable0(ret[0]);
|
|
469
|
-
}
|
|
470
|
-
|
|
471
467
|
/**
|
|
472
468
|
* The name of every [`TokenRow::kind`], indexed BY that kind.
|
|
473
469
|
*
|
|
@@ -476,8 +472,8 @@ export function semantic_legend() {
|
|
|
476
472
|
* discriminant down, which is the only version of this contract that survives
|
|
477
473
|
* a reorder of the lexer.
|
|
478
474
|
*
|
|
479
|
-
*
|
|
480
|
-
*
|
|
475
|
+
* Semantic tokens make the same move one step further: `semanticTokens()`
|
|
476
|
+
* sends the legend's names themselves, so no index crosses at all.
|
|
481
477
|
*
|
|
482
478
|
* A kind past the end of the array is a variant appended by a newer compiler
|
|
483
479
|
* than the host was built against. That is BACKWARDS-COMPATIBLE by
|
package/pkg/fossil_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const tokenize: (a: number, b: number) => [number, number, number];
|
|
5
|
-
export const semantic_legend: () => [number, number, number];
|
|
6
5
|
export const tokenKinds: () => [number, number, number];
|
|
7
6
|
export const __wbg_filehandle_free: (a: number, b: number) => void;
|
|
8
7
|
export const __wbg_fossilworkspace_free: (a: number, b: number) => void;
|
|
@@ -19,6 +18,7 @@ export const fossilworkspace_sources: (a: number, b: number) => [number, number,
|
|
|
19
18
|
export const fossilworkspace_hover: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
20
19
|
export const fossilworkspace_completions: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
21
20
|
export const fossilworkspace_gotoDefinition: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
21
|
+
export const fossilworkspace_semanticTokens: (a: number, b: number) => [number, number, number];
|
|
22
22
|
export const fossilworkspace_registerInferredDescriptor: (a: number, b: number, c: number) => [number, number];
|
|
23
23
|
export const providers: () => [number, number, number];
|
|
24
24
|
export const refs: (a: number, b: number) => [number, number, number];
|