@telorun/ide-support 0.4.45 → 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.
- package/dist/diagnostics/graph-diagnostics.d.ts +44 -0
- package/dist/diagnostics/graph-diagnostics.d.ts.map +1 -0
- package/dist/diagnostics/graph-diagnostics.js +71 -0
- package/dist/diagnostics/index.d.ts +1 -0
- package/dist/diagnostics/index.d.ts.map +1 -1
- package/dist/diagnostics/index.js +1 -0
- package/package.json +2 -2
- package/src/diagnostics/graph-diagnostics.ts +79 -0
- package/src/diagnostics/index.ts +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type AnalysisDiagnostic, type LoadedGraph } from "@telorun/analyzer";
|
|
2
|
+
/**
|
|
3
|
+
* Files whose static-analysis output is an unreliable cascade rather than a set
|
|
4
|
+
* of independent defects:
|
|
5
|
+
*
|
|
6
|
+
* - a file that **failed to parse** yields a mangled `toJSON()` tree, so its
|
|
7
|
+
* analyze-derived diagnostics are spurious;
|
|
8
|
+
* - a file whose **import failed to resolve** has broken kind resolution, so it
|
|
9
|
+
* emits a wall of secondary `UNDEFINED_KIND` etc. for every use of the missing
|
|
10
|
+
* alias.
|
|
11
|
+
*
|
|
12
|
+
* Both surface a coded parse / import diagnostic of their own (kept, always);
|
|
13
|
+
* their *analysis* diagnostics are what a host suppresses so the real cause is
|
|
14
|
+
* not buried. Every host computes this set from the one function, so the CLI,
|
|
15
|
+
* VS Code, and telo-editor agree on exactly what is compromised.
|
|
16
|
+
*/
|
|
17
|
+
export declare function compromisedFiles(graph: LoadedGraph): Set<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Assemble the complete diagnostic set for a loaded graph and partition it into
|
|
20
|
+
* what to surface (`diagnostics`) and the compromised-file cascade held back
|
|
21
|
+
* (`suppressed`). The presentation policy lives here — not in the analyzer,
|
|
22
|
+
* which only emits raw channels — so every host applies it identically.
|
|
23
|
+
*
|
|
24
|
+
* `diagnostics` folds parse, version-reconciliation, import-resolution, and the
|
|
25
|
+
* *live* analysis diagnostics (those on non-compromised files) into one list,
|
|
26
|
+
* in that order. `suppressed` carries the analysis cascade dropped from
|
|
27
|
+
* compromised files, still available to a host that wants to render it dimmed /
|
|
28
|
+
* as related information rather than hide it.
|
|
29
|
+
*
|
|
30
|
+
* A diagnostic's owning file is resolved via {@link findPositions} (resource
|
|
31
|
+
* identity first), falling back to the raw `data.filePath` — which
|
|
32
|
+
* `findPositions` cannot resolve for a file absent from `graph.modules` (e.g. a
|
|
33
|
+
* parse-failed file) — then the entry source.
|
|
34
|
+
*
|
|
35
|
+
* Single-closure hosts (CLI, VS Code) call this directly. The multi-closure
|
|
36
|
+
* telo-editor drives analysis per closure with bespoke routing, so it consumes
|
|
37
|
+
* {@link compromisedFiles} and {@link importResolutionDiagnostics} on their own
|
|
38
|
+
* — but through the same shared policy, never a private reimplementation.
|
|
39
|
+
*/
|
|
40
|
+
export declare function assembleGraphDiagnostics(graph: LoadedGraph, analysisDiagnostics: AnalysisDiagnostic[]): {
|
|
41
|
+
diagnostics: AnalysisDiagnostic[];
|
|
42
|
+
suppressed: AnalysisDiagnostic[];
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=graph-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-diagnostics.d.ts","sourceRoot":"","sources":["../../src/diagnostics/graph-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAShE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,WAAW,EAClB,mBAAmB,EAAE,kBAAkB,EAAE,GACxC;IAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAAC,UAAU,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAoBzE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { importResolutionDiagnostics, } from "@telorun/analyzer";
|
|
2
|
+
import { findPositions } from "./find-positions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Files whose static-analysis output is an unreliable cascade rather than a set
|
|
5
|
+
* of independent defects:
|
|
6
|
+
*
|
|
7
|
+
* - a file that **failed to parse** yields a mangled `toJSON()` tree, so its
|
|
8
|
+
* analyze-derived diagnostics are spurious;
|
|
9
|
+
* - a file whose **import failed to resolve** has broken kind resolution, so it
|
|
10
|
+
* emits a wall of secondary `UNDEFINED_KIND` etc. for every use of the missing
|
|
11
|
+
* alias.
|
|
12
|
+
*
|
|
13
|
+
* Both surface a coded parse / import diagnostic of their own (kept, always);
|
|
14
|
+
* their *analysis* diagnostics are what a host suppresses so the real cause is
|
|
15
|
+
* not buried. Every host computes this set from the one function, so the CLI,
|
|
16
|
+
* VS Code, and telo-editor agree on exactly what is compromised.
|
|
17
|
+
*/
|
|
18
|
+
export function compromisedFiles(graph) {
|
|
19
|
+
const entrySource = graph.entry.owner.source;
|
|
20
|
+
const files = new Set();
|
|
21
|
+
for (const d of graph.parseDiagnostics) {
|
|
22
|
+
const f = d.data?.filePath;
|
|
23
|
+
if (f)
|
|
24
|
+
files.add(f);
|
|
25
|
+
}
|
|
26
|
+
for (const e of graph.errors)
|
|
27
|
+
files.add(e.fromSource ?? entrySource);
|
|
28
|
+
return files;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Assemble the complete diagnostic set for a loaded graph and partition it into
|
|
32
|
+
* what to surface (`diagnostics`) and the compromised-file cascade held back
|
|
33
|
+
* (`suppressed`). The presentation policy lives here — not in the analyzer,
|
|
34
|
+
* which only emits raw channels — so every host applies it identically.
|
|
35
|
+
*
|
|
36
|
+
* `diagnostics` folds parse, version-reconciliation, import-resolution, and the
|
|
37
|
+
* *live* analysis diagnostics (those on non-compromised files) into one list,
|
|
38
|
+
* in that order. `suppressed` carries the analysis cascade dropped from
|
|
39
|
+
* compromised files, still available to a host that wants to render it dimmed /
|
|
40
|
+
* as related information rather than hide it.
|
|
41
|
+
*
|
|
42
|
+
* A diagnostic's owning file is resolved via {@link findPositions} (resource
|
|
43
|
+
* identity first), falling back to the raw `data.filePath` — which
|
|
44
|
+
* `findPositions` cannot resolve for a file absent from `graph.modules` (e.g. a
|
|
45
|
+
* parse-failed file) — then the entry source.
|
|
46
|
+
*
|
|
47
|
+
* Single-closure hosts (CLI, VS Code) call this directly. The multi-closure
|
|
48
|
+
* telo-editor drives analysis per closure with bespoke routing, so it consumes
|
|
49
|
+
* {@link compromisedFiles} and {@link importResolutionDiagnostics} on their own
|
|
50
|
+
* — but through the same shared policy, never a private reimplementation.
|
|
51
|
+
*/
|
|
52
|
+
export function assembleGraphDiagnostics(graph, analysisDiagnostics) {
|
|
53
|
+
const compromised = compromisedFiles(graph);
|
|
54
|
+
const entrySource = graph.entry.owner.source;
|
|
55
|
+
const live = [];
|
|
56
|
+
const suppressed = [];
|
|
57
|
+
for (const d of analysisDiagnostics) {
|
|
58
|
+
const rawFilePath = d.data?.filePath;
|
|
59
|
+
const file = findPositions(graph, d.data)?.file ?? rawFilePath ?? entrySource;
|
|
60
|
+
(compromised.has(file) ? suppressed : live).push(d);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
diagnostics: [
|
|
64
|
+
...graph.parseDiagnostics,
|
|
65
|
+
...graph.versionDiagnostics,
|
|
66
|
+
...importResolutionDiagnostics(graph),
|
|
67
|
+
...live,
|
|
68
|
+
],
|
|
69
|
+
suppressed,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { findPositions } from "./find-positions.js";
|
|
2
|
+
export { assembleGraphDiagnostics, compromisedFiles } from "./graph-diagnostics.js";
|
|
2
3
|
export { normalizeDiagnostic } from "./normalize.js";
|
|
3
4
|
export { resolveRange } from "./range-resolver.js";
|
|
4
5
|
export { resolveSeverity } from "./severity.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/diagnostics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/diagnostics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { findPositions } from "./find-positions.js";
|
|
2
|
+
export { assembleGraphDiagnostics, compromisedFiles } from "./graph-diagnostics.js";
|
|
2
3
|
export { normalizeDiagnostic } from "./normalize.js";
|
|
3
4
|
export { resolveRange } from "./range-resolver.js";
|
|
4
5
|
export { resolveSeverity } from "./severity.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/ide-support",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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.
|
|
39
|
+
"@telorun/analyzer": "0.40.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^20.0.0",
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
importResolutionDiagnostics,
|
|
3
|
+
type AnalysisDiagnostic,
|
|
4
|
+
type LoadedGraph,
|
|
5
|
+
} from "@telorun/analyzer";
|
|
6
|
+
import { findPositions } from "./find-positions.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Files whose static-analysis output is an unreliable cascade rather than a set
|
|
10
|
+
* of independent defects:
|
|
11
|
+
*
|
|
12
|
+
* - a file that **failed to parse** yields a mangled `toJSON()` tree, so its
|
|
13
|
+
* analyze-derived diagnostics are spurious;
|
|
14
|
+
* - a file whose **import failed to resolve** has broken kind resolution, so it
|
|
15
|
+
* emits a wall of secondary `UNDEFINED_KIND` etc. for every use of the missing
|
|
16
|
+
* alias.
|
|
17
|
+
*
|
|
18
|
+
* Both surface a coded parse / import diagnostic of their own (kept, always);
|
|
19
|
+
* their *analysis* diagnostics are what a host suppresses so the real cause is
|
|
20
|
+
* not buried. Every host computes this set from the one function, so the CLI,
|
|
21
|
+
* VS Code, and telo-editor agree on exactly what is compromised.
|
|
22
|
+
*/
|
|
23
|
+
export function compromisedFiles(graph: LoadedGraph): Set<string> {
|
|
24
|
+
const entrySource = graph.entry.owner.source;
|
|
25
|
+
const files = new Set<string>();
|
|
26
|
+
for (const d of graph.parseDiagnostics) {
|
|
27
|
+
const f = (d.data as { filePath?: string } | undefined)?.filePath;
|
|
28
|
+
if (f) files.add(f);
|
|
29
|
+
}
|
|
30
|
+
for (const e of graph.errors) files.add(e.fromSource ?? entrySource);
|
|
31
|
+
return files;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Assemble the complete diagnostic set for a loaded graph and partition it into
|
|
36
|
+
* what to surface (`diagnostics`) and the compromised-file cascade held back
|
|
37
|
+
* (`suppressed`). The presentation policy lives here — not in the analyzer,
|
|
38
|
+
* which only emits raw channels — so every host applies it identically.
|
|
39
|
+
*
|
|
40
|
+
* `diagnostics` folds parse, version-reconciliation, import-resolution, and the
|
|
41
|
+
* *live* analysis diagnostics (those on non-compromised files) into one list,
|
|
42
|
+
* in that order. `suppressed` carries the analysis cascade dropped from
|
|
43
|
+
* compromised files, still available to a host that wants to render it dimmed /
|
|
44
|
+
* as related information rather than hide it.
|
|
45
|
+
*
|
|
46
|
+
* A diagnostic's owning file is resolved via {@link findPositions} (resource
|
|
47
|
+
* identity first), falling back to the raw `data.filePath` — which
|
|
48
|
+
* `findPositions` cannot resolve for a file absent from `graph.modules` (e.g. a
|
|
49
|
+
* parse-failed file) — then the entry source.
|
|
50
|
+
*
|
|
51
|
+
* Single-closure hosts (CLI, VS Code) call this directly. The multi-closure
|
|
52
|
+
* telo-editor drives analysis per closure with bespoke routing, so it consumes
|
|
53
|
+
* {@link compromisedFiles} and {@link importResolutionDiagnostics} on their own
|
|
54
|
+
* — but through the same shared policy, never a private reimplementation.
|
|
55
|
+
*/
|
|
56
|
+
export function assembleGraphDiagnostics(
|
|
57
|
+
graph: LoadedGraph,
|
|
58
|
+
analysisDiagnostics: AnalysisDiagnostic[],
|
|
59
|
+
): { diagnostics: AnalysisDiagnostic[]; suppressed: AnalysisDiagnostic[] } {
|
|
60
|
+
const compromised = compromisedFiles(graph);
|
|
61
|
+
const entrySource = graph.entry.owner.source;
|
|
62
|
+
const live: AnalysisDiagnostic[] = [];
|
|
63
|
+
const suppressed: AnalysisDiagnostic[] = [];
|
|
64
|
+
for (const d of analysisDiagnostics) {
|
|
65
|
+
const rawFilePath = (d.data as { filePath?: string } | undefined)?.filePath;
|
|
66
|
+
const file = findPositions(graph, d.data)?.file ?? rawFilePath ?? entrySource;
|
|
67
|
+
(compromised.has(file) ? suppressed : live).push(d);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
diagnostics: [
|
|
72
|
+
...graph.parseDiagnostics,
|
|
73
|
+
...graph.versionDiagnostics,
|
|
74
|
+
...importResolutionDiagnostics(graph),
|
|
75
|
+
...live,
|
|
76
|
+
],
|
|
77
|
+
suppressed,
|
|
78
|
+
};
|
|
79
|
+
}
|
package/src/diagnostics/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { findPositions } from "./find-positions.js";
|
|
2
|
+
export { assembleGraphDiagnostics, compromisedFiles } from "./graph-diagnostics.js";
|
|
2
3
|
export { normalizeDiagnostic } from "./normalize.js";
|
|
3
4
|
export { resolveRange } from "./range-resolver.js";
|
|
4
5
|
export { resolveSeverity } from "./severity.js";
|