@telorun/ide-support 0.4.13 → 0.4.15
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 +7 -14
- package/dist/completions/build.js +2 -2
- package/dist/completions/detect-context.d.ts.map +1 -1
- package/dist/completions/detect-context.js +23 -9
- package/dist/completions/import-source.d.ts +3 -1
- package/dist/completions/import-source.d.ts.map +1 -1
- package/dist/completions/import-source.js +4 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/completions/build.ts +2 -2
- package/src/completions/detect-context.ts +24 -9
- package/src/completions/import-source.ts +4 -2
- package/src/types.ts +1 -1
package/README.md
CHANGED
|
@@ -54,20 +54,13 @@ metadata:
|
|
|
54
54
|
description: |
|
|
55
55
|
A complete feedback collection REST API — no code, pure YAML.
|
|
56
56
|
Persists entries to SQLite and serves them over HTTP.
|
|
57
|
+
imports:
|
|
58
|
+
Http: std/http-server@0.5.0
|
|
59
|
+
Sql: std/sql@0.3.0
|
|
57
60
|
targets:
|
|
58
61
|
- Migrations
|
|
59
62
|
- Server
|
|
60
63
|
---
|
|
61
|
-
kind: Telo.Import
|
|
62
|
-
metadata:
|
|
63
|
-
name: Http
|
|
64
|
-
source: std/http-server@0.5.0
|
|
65
|
-
---
|
|
66
|
-
kind: Telo.Import
|
|
67
|
-
metadata:
|
|
68
|
-
name: Sql
|
|
69
|
-
source: std/sql@0.3.0
|
|
70
|
-
---
|
|
71
64
|
# SQLite database — swap driver/host/database for PostgreSQL with zero YAML changes
|
|
72
65
|
kind: Sql.Connection
|
|
73
66
|
metadata:
|
|
@@ -127,7 +120,7 @@ routes:
|
|
|
127
120
|
minLength: 1
|
|
128
121
|
source:
|
|
129
122
|
type: string
|
|
130
|
-
required: [text]
|
|
123
|
+
required: [ text ]
|
|
131
124
|
handler:
|
|
132
125
|
kind: Sql.Exec
|
|
133
126
|
connection:
|
|
@@ -157,7 +150,7 @@ routes:
|
|
|
157
150
|
kind: Sql.Connection
|
|
158
151
|
name: Db
|
|
159
152
|
from: feedback
|
|
160
|
-
columns: [id, text, source, score, created_at]
|
|
153
|
+
columns: [ id, text, source, score, created_at ]
|
|
161
154
|
orderBy:
|
|
162
155
|
- { column: created_at, direction: desc }
|
|
163
156
|
response:
|
|
@@ -176,14 +169,14 @@ routes:
|
|
|
176
169
|
properties:
|
|
177
170
|
id:
|
|
178
171
|
type: integer
|
|
179
|
-
required: [id]
|
|
172
|
+
required: [ id ]
|
|
180
173
|
handler:
|
|
181
174
|
kind: Sql.Select
|
|
182
175
|
connection:
|
|
183
176
|
kind: Sql.Connection
|
|
184
177
|
name: Db
|
|
185
178
|
from: feedback
|
|
186
|
-
columns: [id, text, source, score, created_at]
|
|
179
|
+
columns: [ id, text, source, score, created_at ]
|
|
187
180
|
where:
|
|
188
181
|
- { column: id, op: "=", value: "${{ request.params.id }}" }
|
|
189
182
|
response:
|
|
@@ -113,7 +113,7 @@ function kindCompletions(registry, docKind, yamlPath, valueStartColumn) {
|
|
|
113
113
|
kinds = registry.validUserFacingKinds();
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
|
-
kinds = ["Telo.Application", "Telo.Library", "Telo.
|
|
116
|
+
kinds = ["Telo.Application", "Telo.Library", "Telo.Definition"];
|
|
117
117
|
}
|
|
118
118
|
const seen = new Set();
|
|
119
119
|
const results = [];
|
|
@@ -157,7 +157,7 @@ export async function buildCompletions(text, line, character, registry, adapter)
|
|
|
157
157
|
return refNameCompletions(text, ctx.refKind, refConstraint, registry, ctx.valueStartColumn);
|
|
158
158
|
}
|
|
159
159
|
if (ctx.type === "field-value") {
|
|
160
|
-
if (ctx.
|
|
160
|
+
if (ctx.field === "import-source") {
|
|
161
161
|
return importSourceCompletions(ctx.prefix, ctx.valueStartColumn, adapter);
|
|
162
162
|
}
|
|
163
163
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-context.d.ts","sourceRoot":"","sources":["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|
318
318
|
}
|
|
319
319
|
if (!docKind)
|
|
320
320
|
return undefined;
|
|
321
|
-
//
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
321
|
+
// Import-source value completion: entries in the `imports:` map on a module
|
|
322
|
+
// doc. Two shapes are completed against filesystem paths / registry ids:
|
|
323
|
+
// scalar shorthand ` Alias: <src>` → the entry value IS the source
|
|
324
|
+
// object form ` source: <src>` → the `source:` under `imports.<Alias>`
|
|
325
|
+
// Gated on the enclosing path resolving to the `imports:` map so unrelated
|
|
326
|
+
// `source:` fields (e.g. `Assert.Manifest.source`) never trigger it.
|
|
327
|
+
if (docKind === "Telo.Application" || docKind === "Telo.Library") {
|
|
328
|
+
// Require a space after the colon (`key: …`) so a bare object-form header —
|
|
329
|
+
// ` Tiny:` about to carry a nested `source:`/`variables:` — is treated as a
|
|
330
|
+
// key position, not an import-source value. A flow-map (`Alias: { … }`) never
|
|
331
|
+
// matches: `\S*` can't span the spaces inside the braces.
|
|
332
|
+
const entryMatch = currentLine.match(/^(\s+)([A-Za-z_][\w-]*):(\s+)(\S*)$/);
|
|
333
|
+
if (entryMatch) {
|
|
334
|
+
const indent = entryMatch[1].length;
|
|
335
|
+
const key = entryMatch[2];
|
|
336
|
+
const valueStartColumn = indent + key.length + 1 + entryMatch[3].length;
|
|
328
337
|
if (character >= valueStartColumn) {
|
|
329
|
-
const
|
|
330
|
-
|
|
338
|
+
const parentPath = buildYamlPath(lines, line, start, indent);
|
|
339
|
+
const isScalarEntry = parentPath.length === 1 && parentPath[0] === "imports";
|
|
340
|
+
const isObjectSource = key === "source" && parentPath.length === 2 && parentPath[0] === "imports";
|
|
341
|
+
if (isScalarEntry || isObjectSource) {
|
|
342
|
+
const prefix = currentLine.slice(valueStartColumn, character);
|
|
343
|
+
return { type: "field-value", docKind, field: "import-source", prefix, valueStartColumn };
|
|
344
|
+
}
|
|
331
345
|
}
|
|
332
346
|
}
|
|
333
347
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CompletionResult, IdeEnvironmentAdapter } from "../types.js";
|
|
2
2
|
/**
|
|
3
|
-
* Completions for
|
|
3
|
+
* Completions for an import source — an `imports:` map entry on a module doc
|
|
4
|
+
* (either the scalar shorthand `Alias: <src>` or the `source:` under the
|
|
5
|
+
* object form).
|
|
4
6
|
*
|
|
5
7
|
* Branches by prefix shape:
|
|
6
8
|
* "" → relative dirs under the manifest dir, plus `./` / `../` seeds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-source.d.ts","sourceRoot":"","sources":["../../src/completions/import-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAW3E
|
|
1
|
+
{"version":3,"file":"import-source.d.ts","sourceRoot":"","sources":["../../src/completions/import-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAW3E;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,qBAAqB,GAAG,SAAS,GACzC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAuB7B"}
|
|
@@ -6,7 +6,9 @@ const REGISTRY_LIMIT = 50;
|
|
|
6
6
|
* show more than ~50 entries anyway, so probing further only adds latency. */
|
|
7
7
|
const PATH_PROBE_LIMIT = 50;
|
|
8
8
|
/**
|
|
9
|
-
* Completions for
|
|
9
|
+
* Completions for an import source — an `imports:` map entry on a module doc
|
|
10
|
+
* (either the scalar shorthand `Alias: <src>` or the `source:` under the
|
|
11
|
+
* object form).
|
|
10
12
|
*
|
|
11
13
|
* Branches by prefix shape:
|
|
12
14
|
* "" → relative dirs under the manifest dir, plus `./` / `../` seeds.
|
|
@@ -40,7 +42,7 @@ export async function importSourceCompletions(prefix, valueStartColumn, adapter)
|
|
|
40
42
|
async function relativePathCompletions(prefix, valueStartColumn, adapter) {
|
|
41
43
|
// Empty prefix → seed `./` and `../` so the user gets traction; otherwise
|
|
42
44
|
// we'd return an unfiltered dump of the manifest directory which is rarely
|
|
43
|
-
// what the user wants for
|
|
45
|
+
// what the user wants for an import source.
|
|
44
46
|
if (prefix === "") {
|
|
45
47
|
return [
|
|
46
48
|
{
|
package/dist/types.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface IdeEnvironmentAdapter {
|
|
|
34
34
|
* Never throws — hosts swallow ENOENT and similar. */
|
|
35
35
|
listDirectories(relPath: string): Promise<string[]>;
|
|
36
36
|
/** True iff `<relPath>/telo.yaml` exists relative to the manifest dir.
|
|
37
|
-
* Used to mark directories that are valid
|
|
37
|
+
* Used to mark directories that are valid import targets. */
|
|
38
38
|
hasManifest(relPath: string): Promise<boolean>;
|
|
39
39
|
/** Free-text search against the configured module registry. Matches against
|
|
40
40
|
* name, namespace, and description. Empty `query` should return the full
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGzE,YAAY,EACV,QAAQ,EACR,KAAK,EACL,kBAAkB,EAClB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpG,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjG,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,CAAC,EAAE,MA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a,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/ide-support",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"description": "Editor-host-agnostic IDE support (completions, diagnostic normalization) for Telo manifests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telo",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"src/**"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@telorun/analyzer": "0.16.
|
|
39
|
+
"@telorun/analyzer": "0.16.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^20.0.0",
|
package/src/completions/build.ts
CHANGED
|
@@ -138,7 +138,7 @@ function kindCompletions(
|
|
|
138
138
|
} else if (registry) {
|
|
139
139
|
kinds = registry.validUserFacingKinds();
|
|
140
140
|
} else {
|
|
141
|
-
kinds = ["Telo.Application", "Telo.Library", "Telo.
|
|
141
|
+
kinds = ["Telo.Application", "Telo.Library", "Telo.Definition"];
|
|
142
142
|
}
|
|
143
143
|
const seen = new Set<string>();
|
|
144
144
|
const results: CompletionResult[] = [];
|
|
@@ -192,7 +192,7 @@ export async function buildCompletions(
|
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
194
|
if (ctx.type === "field-value") {
|
|
195
|
-
if (ctx.
|
|
195
|
+
if (ctx.field === "import-source") {
|
|
196
196
|
return importSourceCompletions(ctx.prefix, ctx.valueStartColumn, adapter);
|
|
197
197
|
}
|
|
198
198
|
return [];
|
|
@@ -387,16 +387,31 @@ export function detectContext(
|
|
|
387
387
|
|
|
388
388
|
if (!docKind) return undefined;
|
|
389
389
|
|
|
390
|
-
//
|
|
391
|
-
//
|
|
392
|
-
//
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
390
|
+
// Import-source value completion: entries in the `imports:` map on a module
|
|
391
|
+
// doc. Two shapes are completed against filesystem paths / registry ids:
|
|
392
|
+
// scalar shorthand ` Alias: <src>` → the entry value IS the source
|
|
393
|
+
// object form ` source: <src>` → the `source:` under `imports.<Alias>`
|
|
394
|
+
// Gated on the enclosing path resolving to the `imports:` map so unrelated
|
|
395
|
+
// `source:` fields (e.g. `Assert.Manifest.source`) never trigger it.
|
|
396
|
+
if (docKind === "Telo.Application" || docKind === "Telo.Library") {
|
|
397
|
+
// Require a space after the colon (`key: …`) so a bare object-form header —
|
|
398
|
+
// ` Tiny:` about to carry a nested `source:`/`variables:` — is treated as a
|
|
399
|
+
// key position, not an import-source value. A flow-map (`Alias: { … }`) never
|
|
400
|
+
// matches: `\S*` can't span the spaces inside the braces.
|
|
401
|
+
const entryMatch = currentLine.match(/^(\s+)([A-Za-z_][\w-]*):(\s+)(\S*)$/);
|
|
402
|
+
if (entryMatch) {
|
|
403
|
+
const indent = entryMatch[1].length;
|
|
404
|
+
const key = entryMatch[2];
|
|
405
|
+
const valueStartColumn = indent + key.length + 1 + entryMatch[3].length;
|
|
397
406
|
if (character >= valueStartColumn) {
|
|
398
|
-
const
|
|
399
|
-
|
|
407
|
+
const parentPath = buildYamlPath(lines, line, start, indent);
|
|
408
|
+
const isScalarEntry = parentPath.length === 1 && parentPath[0] === "imports";
|
|
409
|
+
const isObjectSource =
|
|
410
|
+
key === "source" && parentPath.length === 2 && parentPath[0] === "imports";
|
|
411
|
+
if (isScalarEntry || isObjectSource) {
|
|
412
|
+
const prefix = currentLine.slice(valueStartColumn, character);
|
|
413
|
+
return { type: "field-value", docKind, field: "import-source", prefix, valueStartColumn };
|
|
414
|
+
}
|
|
400
415
|
}
|
|
401
416
|
}
|
|
402
417
|
}
|
|
@@ -10,7 +10,9 @@ const REGISTRY_LIMIT = 50;
|
|
|
10
10
|
const PATH_PROBE_LIMIT = 50;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Completions for
|
|
13
|
+
* Completions for an import source — an `imports:` map entry on a module doc
|
|
14
|
+
* (either the scalar shorthand `Alias: <src>` or the `source:` under the
|
|
15
|
+
* object form).
|
|
14
16
|
*
|
|
15
17
|
* Branches by prefix shape:
|
|
16
18
|
* "" → relative dirs under the manifest dir, plus `./` / `../` seeds.
|
|
@@ -59,7 +61,7 @@ async function relativePathCompletions(
|
|
|
59
61
|
): Promise<CompletionResult[]> {
|
|
60
62
|
// Empty prefix → seed `./` and `../` so the user gets traction; otherwise
|
|
61
63
|
// we'd return an unfiltered dump of the manifest directory which is rarely
|
|
62
|
-
// what the user wants for
|
|
64
|
+
// what the user wants for an import source.
|
|
63
65
|
if (prefix === "") {
|
|
64
66
|
return [
|
|
65
67
|
{
|
package/src/types.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface IdeEnvironmentAdapter {
|
|
|
48
48
|
* Never throws — hosts swallow ENOENT and similar. */
|
|
49
49
|
listDirectories(relPath: string): Promise<string[]>;
|
|
50
50
|
/** True iff `<relPath>/telo.yaml` exists relative to the manifest dir.
|
|
51
|
-
* Used to mark directories that are valid
|
|
51
|
+
* Used to mark directories that are valid import targets. */
|
|
52
52
|
hasManifest(relPath: string): Promise<boolean>;
|
|
53
53
|
/** Free-text search against the configured module registry. Matches against
|
|
54
54
|
* name, namespace, and description. Empty `query` should return the full
|