hinmil 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +2306 -2
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +338 -0
- package/dist/cli.js.map +1 -0
- package/dist/commentParser.d.ts +384 -0
- package/dist/commentParser.d.ts.map +1 -0
- package/dist/commentParser.js +2487 -0
- package/dist/commentParser.js.map +1 -0
- package/dist/config.d.ts +203 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +375 -0
- package/dist/config.js.map +1 -0
- package/dist/debugLog.d.ts +13 -0
- package/dist/debugLog.d.ts.map +1 -0
- package/dist/debugLog.js +44 -0
- package/dist/debugLog.js.map +1 -0
- package/dist/estree.d.ts +100 -0
- package/dist/estree.d.ts.map +1 -0
- package/dist/estree.js +34 -0
- package/dist/estree.js.map +1 -0
- package/dist/hm/env.d.ts +134 -0
- package/dist/hm/env.d.ts.map +1 -0
- package/dist/hm/env.js +939 -0
- package/dist/hm/env.js.map +1 -0
- package/dist/hm/index.d.ts +7 -0
- package/dist/hm/index.d.ts.map +1 -0
- package/dist/hm/index.js +26 -0
- package/dist/hm/index.js.map +1 -0
- package/dist/hm/substitution.d.ts +57 -0
- package/dist/hm/substitution.d.ts.map +1 -0
- package/dist/hm/substitution.js +546 -0
- package/dist/hm/substitution.js.map +1 -0
- package/dist/hm/typeParser.d.ts +39 -0
- package/dist/hm/typeParser.d.ts.map +1 -0
- package/dist/hm/typeParser.js +1285 -0
- package/dist/hm/typeParser.js.map +1 -0
- package/dist/hm/typeUtils.d.ts +248 -0
- package/dist/hm/typeUtils.d.ts.map +1 -0
- package/dist/hm/typeUtils.js +905 -0
- package/dist/hm/typeUtils.js.map +1 -0
- package/dist/hm/types.d.ts +738 -0
- package/dist/hm/types.d.ts.map +1 -0
- package/dist/hm/types.js +1853 -0
- package/dist/hm/types.js.map +1 -0
- package/dist/hm/unify.d.ts +59 -0
- package/dist/hm/unify.d.ts.map +1 -0
- package/dist/hm/unify.js +1700 -0
- package/dist/hm/unify.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/index.js.map +1 -0
- package/dist/infer/annotation-rigid.d.ts +76 -0
- package/dist/infer/annotation-rigid.d.ts.map +1 -0
- package/dist/infer/annotation-rigid.js +542 -0
- package/dist/infer/annotation-rigid.js.map +1 -0
- package/dist/infer/annotation-validation.d.ts +109 -0
- package/dist/infer/annotation-validation.d.ts.map +1 -0
- package/dist/infer/annotation-validation.js +1078 -0
- package/dist/infer/annotation-validation.js.map +1 -0
- package/dist/infer/annotations.d.ts +277 -0
- package/dist/infer/annotations.d.ts.map +1 -0
- package/dist/infer/annotations.js +1343 -0
- package/dist/infer/annotations.js.map +1 -0
- package/dist/infer/call-overloads.d.ts +24 -0
- package/dist/infer/call-overloads.d.ts.map +1 -0
- package/dist/infer/call-overloads.js +900 -0
- package/dist/infer/call-overloads.js.map +1 -0
- package/dist/infer/call-rows.d.ts +154 -0
- package/dist/infer/call-rows.d.ts.map +1 -0
- package/dist/infer/call-rows.js +2162 -0
- package/dist/infer/call-rows.js.map +1 -0
- package/dist/infer/calls.d.ts +20 -0
- package/dist/infer/calls.d.ts.map +1 -0
- package/dist/infer/calls.js +1468 -0
- package/dist/infer/calls.js.map +1 -0
- package/dist/infer/constraints.d.ts +99 -0
- package/dist/infer/constraints.d.ts.map +1 -0
- package/dist/infer/constraints.js +1208 -0
- package/dist/infer/constraints.js.map +1 -0
- package/dist/infer/expr-assignment.d.ts +20 -0
- package/dist/infer/expr-assignment.d.ts.map +1 -0
- package/dist/infer/expr-assignment.js +620 -0
- package/dist/infer/expr-assignment.js.map +1 -0
- package/dist/infer/expr-constraint-lookup.d.ts +44 -0
- package/dist/infer/expr-constraint-lookup.d.ts.map +1 -0
- package/dist/infer/expr-constraint-lookup.js +207 -0
- package/dist/infer/expr-constraint-lookup.js.map +1 -0
- package/dist/infer/expr-functions.d.ts +20 -0
- package/dist/infer/expr-functions.d.ts.map +1 -0
- package/dist/infer/expr-functions.js +1359 -0
- package/dist/infer/expr-functions.js.map +1 -0
- package/dist/infer/expr-jsx.d.ts +19 -0
- package/dist/infer/expr-jsx.d.ts.map +1 -0
- package/dist/infer/expr-jsx.js +310 -0
- package/dist/infer/expr-jsx.js.map +1 -0
- package/dist/infer/expr-member.d.ts +40 -0
- package/dist/infer/expr-member.d.ts.map +1 -0
- package/dist/infer/expr-member.js +1154 -0
- package/dist/infer/expr-member.js.map +1 -0
- package/dist/infer/expr-prototype.d.ts +11 -0
- package/dist/infer/expr-prototype.d.ts.map +1 -0
- package/dist/infer/expr-prototype.js +202 -0
- package/dist/infer/expr-prototype.js.map +1 -0
- package/dist/infer/expressions.d.ts +40 -0
- package/dist/infer/expressions.d.ts.map +1 -0
- package/dist/infer/expressions.js +1497 -0
- package/dist/infer/expressions.js.map +1 -0
- package/dist/infer/functionPatterns.d.ts +229 -0
- package/dist/infer/functionPatterns.d.ts.map +1 -0
- package/dist/infer/functionPatterns.js +1035 -0
- package/dist/infer/functionPatterns.js.map +1 -0
- package/dist/infer/helpers.d.ts +73 -0
- package/dist/infer/helpers.d.ts.map +1 -0
- package/dist/infer/helpers.js +187 -0
- package/dist/infer/helpers.js.map +1 -0
- package/dist/infer/index.d.ts +551 -0
- package/dist/infer/index.d.ts.map +1 -0
- package/dist/infer/index.js +1127 -0
- package/dist/infer/index.js.map +1 -0
- package/dist/infer/jsx-dom.d.ts +26 -0
- package/dist/infer/jsx-dom.d.ts.map +1 -0
- package/dist/infer/jsx-dom.js +303 -0
- package/dist/infer/jsx-dom.js.map +1 -0
- package/dist/infer/moduleReps.d.ts +7 -0
- package/dist/infer/moduleReps.d.ts.map +1 -0
- package/dist/infer/moduleReps.js +48 -0
- package/dist/infer/moduleReps.js.map +1 -0
- package/dist/infer/modules.d.ts +10 -0
- package/dist/infer/modules.d.ts.map +1 -0
- package/dist/infer/modules.js +775 -0
- package/dist/infer/modules.js.map +1 -0
- package/dist/infer/narrowing.d.ts +199 -0
- package/dist/infer/narrowing.d.ts.map +1 -0
- package/dist/infer/narrowing.js +1428 -0
- package/dist/infer/narrowing.js.map +1 -0
- package/dist/infer/results.d.ts +24 -0
- package/dist/infer/results.d.ts.map +1 -0
- package/dist/infer/results.js +611 -0
- package/dist/infer/results.js.map +1 -0
- package/dist/infer/setupPass.d.ts +11 -0
- package/dist/infer/setupPass.d.ts.map +1 -0
- package/dist/infer/setupPass.js +524 -0
- package/dist/infer/setupPass.js.map +1 -0
- package/dist/infer/statements.d.ts +26 -0
- package/dist/infer/statements.d.ts.map +1 -0
- package/dist/infer/statements.js +750 -0
- package/dist/infer/statements.js.map +1 -0
- package/dist/infer/stmt-bindings.d.ts +22 -0
- package/dist/infer/stmt-bindings.d.ts.map +1 -0
- package/dist/infer/stmt-bindings.js +1482 -0
- package/dist/infer/stmt-bindings.js.map +1 -0
- package/dist/infer/stmt-destructure.d.ts +29 -0
- package/dist/infer/stmt-destructure.d.ts.map +1 -0
- package/dist/infer/stmt-destructure.js +490 -0
- package/dist/infer/stmt-destructure.js.map +1 -0
- package/dist/infer/types.d.ts +220 -0
- package/dist/infer/types.d.ts.map +1 -0
- package/dist/infer/types.js +46 -0
- package/dist/infer/types.js.map +1 -0
- package/dist/infer/unifyDiag.d.ts +46 -0
- package/dist/infer/unifyDiag.d.ts.map +1 -0
- package/dist/infer/unifyDiag.js +642 -0
- package/dist/infer/unifyDiag.js.map +1 -0
- package/dist/parsing-babel.d.ts +3 -0
- package/dist/parsing-babel.d.ts.map +1 -0
- package/dist/parsing-babel.js +353 -0
- package/dist/parsing-babel.js.map +1 -0
- package/dist/parsing.d.ts +69 -0
- package/dist/parsing.d.ts.map +1 -0
- package/dist/parsing.js +288 -0
- package/dist/parsing.js.map +1 -0
- package/dist/registries/constraintRegistry.d.ts +233 -0
- package/dist/registries/constraintRegistry.d.ts.map +1 -0
- package/dist/registries/constraintRegistry.js +803 -0
- package/dist/registries/constraintRegistry.js.map +1 -0
- package/dist/registries/dataTypeRegistry.d.ts +63 -0
- package/dist/registries/dataTypeRegistry.d.ts.map +1 -0
- package/dist/registries/dataTypeRegistry.js +180 -0
- package/dist/registries/dataTypeRegistry.js.map +1 -0
- package/dist/registries/domGlobals.d.ts +33 -0
- package/dist/registries/domGlobals.d.ts.map +1 -0
- package/dist/registries/domGlobals.js +309 -0
- package/dist/registries/domGlobals.js.map +1 -0
- package/dist/registries/methodRegistry.d.ts +277 -0
- package/dist/registries/methodRegistry.d.ts.map +1 -0
- package/dist/registries/methodRegistry.js +2074 -0
- package/dist/registries/methodRegistry.js.map +1 -0
- package/dist/registries/session.d.ts +38 -0
- package/dist/registries/session.d.ts.map +1 -0
- package/dist/registries/session.js +75 -0
- package/dist/registries/session.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1896 -0
- package/dist/server.js.map +1 -0
- package/dist/services/codeActions.d.ts +22 -0
- package/dist/services/codeActions.d.ts.map +1 -0
- package/dist/services/codeActions.js +465 -0
- package/dist/services/codeActions.js.map +1 -0
- package/dist/services/completion.d.ts +259 -0
- package/dist/services/completion.d.ts.map +1 -0
- package/dist/services/completion.js +2794 -0
- package/dist/services/completion.js.map +1 -0
- package/dist/services/definitions.d.ts +37 -0
- package/dist/services/definitions.d.ts.map +1 -0
- package/dist/services/definitions.js +605 -0
- package/dist/services/definitions.js.map +1 -0
- package/dist/services/diagnosticCodes.d.ts +70 -0
- package/dist/services/diagnosticCodes.d.ts.map +1 -0
- package/dist/services/diagnosticCodes.js +239 -0
- package/dist/services/diagnosticCodes.js.map +1 -0
- package/dist/services/diagnostics.d.ts +86 -0
- package/dist/services/diagnostics.d.ts.map +1 -0
- package/dist/services/diagnostics.js +665 -0
- package/dist/services/diagnostics.js.map +1 -0
- package/dist/services/documentCache.d.ts +88 -0
- package/dist/services/documentCache.d.ts.map +1 -0
- package/dist/services/documentCache.js +108 -0
- package/dist/services/documentCache.js.map +1 -0
- package/dist/services/documentSymbols.d.ts +20 -0
- package/dist/services/documentSymbols.d.ts.map +1 -0
- package/dist/services/documentSymbols.js +381 -0
- package/dist/services/documentSymbols.js.map +1 -0
- package/dist/services/fileSelection.d.ts +24 -0
- package/dist/services/fileSelection.d.ts.map +1 -0
- package/dist/services/fileSelection.js +154 -0
- package/dist/services/fileSelection.js.map +1 -0
- package/dist/services/fileSelectionRefresh.d.ts +26 -0
- package/dist/services/fileSelectionRefresh.d.ts.map +1 -0
- package/dist/services/fileSelectionRefresh.js +77 -0
- package/dist/services/fileSelectionRefresh.js.map +1 -0
- package/dist/services/files.d.ts +342 -0
- package/dist/services/files.d.ts.map +1 -0
- package/dist/services/files.js +1712 -0
- package/dist/services/files.js.map +1 -0
- package/dist/services/fsProbe.d.ts +14 -0
- package/dist/services/fsProbe.d.ts.map +1 -0
- package/dist/services/fsProbe.js +112 -0
- package/dist/services/fsProbe.js.map +1 -0
- package/dist/services/globalsLoader.d.ts +20 -0
- package/dist/services/globalsLoader.d.ts.map +1 -0
- package/dist/services/globalsLoader.js +122 -0
- package/dist/services/globalsLoader.js.map +1 -0
- package/dist/services/hmFileServices.d.ts +113 -0
- package/dist/services/hmFileServices.d.ts.map +1 -0
- package/dist/services/hmFileServices.js +686 -0
- package/dist/services/hmFileServices.js.map +1 -0
- package/dist/services/hover.d.ts +280 -0
- package/dist/services/hover.d.ts.map +1 -0
- package/dist/services/hover.js +1687 -0
- package/dist/services/hover.js.map +1 -0
- package/dist/services/importContext.d.ts +396 -0
- package/dist/services/importContext.d.ts.map +1 -0
- package/dist/services/importContext.js +1999 -0
- package/dist/services/importContext.js.map +1 -0
- package/dist/services/projectChecker.d.ts +50 -0
- package/dist/services/projectChecker.d.ts.map +1 -0
- package/dist/services/projectChecker.js +228 -0
- package/dist/services/projectChecker.js.map +1 -0
- package/dist/services/references.d.ts +41 -0
- package/dist/services/references.d.ts.map +1 -0
- package/dist/services/references.js +757 -0
- package/dist/services/references.js.map +1 -0
- package/dist/services/rename.d.ts +22 -0
- package/dist/services/rename.d.ts.map +1 -0
- package/dist/services/rename.js +101 -0
- package/dist/services/rename.js.map +1 -0
- package/dist/services/shortCircuit.d.ts +27 -0
- package/dist/services/shortCircuit.d.ts.map +1 -0
- package/dist/services/shortCircuit.js +28 -0
- package/dist/services/shortCircuit.js.map +1 -0
- package/dist/services/sidecarPerf.d.ts +19 -0
- package/dist/services/sidecarPerf.d.ts.map +1 -0
- package/dist/services/sidecarPerf.js +59 -0
- package/dist/services/sidecarPerf.js.map +1 -0
- package/dist/services/signatureHelp.d.ts +27 -0
- package/dist/services/signatureHelp.d.ts.map +1 -0
- package/dist/services/signatureHelp.js +984 -0
- package/dist/services/signatureHelp.js.map +1 -0
- package/dist/walking.d.ts +25 -0
- package/dist/walking.d.ts.map +1 -0
- package/dist/walking.js +107 -0
- package/dist/walking.js.map +1 -0
- package/hm-types-builtin/assert.hm +20 -0
- package/hm-types-builtin/buffer.hm +8 -0
- package/hm-types-builtin/child_process.hm +16 -0
- package/hm-types-builtin/crypto.hm +17 -0
- package/hm-types-builtin/fs.hm +15 -0
- package/hm-types-builtin/http.hm +14 -0
- package/hm-types-builtin/os.hm +19 -0
- package/hm-types-builtin/path.hm +18 -0
- package/hm-types-builtin/react-dom.hm +27 -0
- package/hm-types-builtin/react.hm +113 -0
- package/hm-types-builtin/url.hm +7 -0
- package/hm-types-builtin/zlib.hm +12 -0
- package/package.json +53 -4
- package/schemas/hinmil.config.schema.json +261 -0
- package/schemas/package-hinmil.schema.json +59 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every diagnostic emitted by hinmil carries a numeric `code` that uniquely
|
|
3
|
+
* identifies its category. These codes are:
|
|
4
|
+
*
|
|
5
|
+
* - Shown in the Problems panel (e.g. `hinmil(1001)`)
|
|
6
|
+
* - Useful for `::ignore` extensions in the future (ignore by code)
|
|
7
|
+
* - Stable across releases so external tooling can rely on them
|
|
8
|
+
*/
|
|
9
|
+
export declare const HM_TYPE_MISMATCH = 1001;
|
|
10
|
+
export declare const HM_INFINITE_TYPE = 1002;
|
|
11
|
+
export declare const HM_ANNOTATION_MISMATCH = 1003;
|
|
12
|
+
export declare const HM_RETURN_TYPE_MISMATCH = 1004;
|
|
13
|
+
export declare const HM_MISSING_PROPERTY = 1005;
|
|
14
|
+
export declare const HM_UNCONSTRAINED_PROP = 1006;
|
|
15
|
+
export declare const HM_UNBOUND_VARIABLE = 1007;
|
|
16
|
+
export declare const HM_MISSING_RECORD_FIELDS = 1008;
|
|
17
|
+
export declare const HM_NOT_CALLABLE = 1009;
|
|
18
|
+
export declare const HM_EXCESS_RECORD_FIELDS = 1010;
|
|
19
|
+
export declare const HM_INVALID_ANNOTATION = 2001;
|
|
20
|
+
export declare const HM_NAME_MISMATCH = 2002;
|
|
21
|
+
export declare const HM_METHOD_NAME_MISMATCH = 2003;
|
|
22
|
+
export declare const HM_UNKNOWN_TYPE = 2004;
|
|
23
|
+
export declare const HM_VARIANT_METHOD = 2005;
|
|
24
|
+
export declare const HM_METHOD_TYPE_MISMATCH = 2006;
|
|
25
|
+
export declare const HM_NAMELESS_ON_NAMED = 2007;
|
|
26
|
+
export declare const HM_TYPE_ARITY_MISMATCH = 2008;
|
|
27
|
+
export declare const HM_UNION_NARROWING = 2009;
|
|
28
|
+
export declare const HM_TYPEREP_MISSING_ARG = 2010;
|
|
29
|
+
export declare const HM_BARE_TVAR_VALUE_ANNOTATION = 2011;
|
|
30
|
+
export declare const HM_METHOD_ON_BARE_VALUE_TYPE = 2012;
|
|
31
|
+
export declare const HM_ORPHAN_INSTANCE_CALLABLE = 2013;
|
|
32
|
+
export declare const HM_ORPHAN_METHOD_ANNOTATION = 2014;
|
|
33
|
+
export declare const HM_INVALID_NARROW = 2015;
|
|
34
|
+
export declare const HM_MISSING_EXPORT = 3001;
|
|
35
|
+
export declare const HM_UNRESOLVED_TYPES_PATH = 3002;
|
|
36
|
+
export declare const HM_UNRESOLVED_IMPORT = 3003;
|
|
37
|
+
export declare const HM_DUPLICATE_IMPORT = 3004;
|
|
38
|
+
export declare const HM_CIRCULAR_IMPORT = 3005;
|
|
39
|
+
export declare const HM_UNKNOWN_CONSTRAINT = 4001;
|
|
40
|
+
export declare const HM_CONSTRAINT_VIOLATION = 4002;
|
|
41
|
+
export declare const HM_INVALID_CONSTRAINT = 4003;
|
|
42
|
+
export declare const HM_CONSTRAINT_KIND_MISMATCH = 4004;
|
|
43
|
+
export declare const HM_CURRY_ARITY = 5001;
|
|
44
|
+
export declare const HM_CURRY_TYPE = 5002;
|
|
45
|
+
export declare const HM_CURRIED_OVER_APPLICATION = 5003;
|
|
46
|
+
export declare const HM_FANOUT_ARITY = 5004;
|
|
47
|
+
export declare const HM_MISSING_SIGNATURE = 6001;
|
|
48
|
+
export declare const HM_MISSING_VARIANT_IMPL = 6002;
|
|
49
|
+
export declare const HM_INVALID_TABLE_RELATION = 7001;
|
|
50
|
+
export declare const HM_PARSE_ERROR = 9001;
|
|
51
|
+
/**
|
|
52
|
+
* Diagnostic categories that can be configured (severity-or-off) through
|
|
53
|
+
* the `hinmil.diagnostics.*` settings. Keys match the corresponding
|
|
54
|
+
* `HinMilSettings['diagnostics']` fields.
|
|
55
|
+
*/
|
|
56
|
+
export type ConfigurableDiagnosticCategory = 'typeErrors' | 'unknownPropertyAccess' | 'missingRecordFields' | 'excessRecordFields' | 'annotationNarrowing';
|
|
57
|
+
/**
|
|
58
|
+
* Map a diagnostic code to its configurable category, or `null` when the
|
|
59
|
+
* code has no user-facing severity setting (those always report as errors,
|
|
60
|
+
* unless the engine attached an explicit severity).
|
|
61
|
+
*/
|
|
62
|
+
export declare function codeToCategory(code: number): ConfigurableDiagnosticCategory | null;
|
|
63
|
+
/**
|
|
64
|
+
* Map a diagnostic message to a numeric code.
|
|
65
|
+
*
|
|
66
|
+
* Uses prefix matching to classify messages into categories. Order matters:
|
|
67
|
+
* more specific patterns are checked before general ones.
|
|
68
|
+
*/
|
|
69
|
+
export declare function classifyDiagnosticCode(message: string): number;
|
|
70
|
+
//# sourceMappingURL=diagnosticCodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticCodes.d.ts","sourceRoot":"","sources":["../../src/services/diagnosticCodes.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAOH,eAAO,MAAM,gBAAgB,OAAkB,CAAC;AAChD,eAAO,MAAM,gBAAgB,OAAkB,CAAC;AAChD,eAAO,MAAM,sBAAsB,OAAY,CAAC;AAChD,eAAO,MAAM,uBAAuB,OAAW,CAAC;AAChD,eAAO,MAAM,mBAAmB,OAAe,CAAC;AAChD,eAAO,MAAM,qBAAqB,OAAa,CAAC;AAChD,eAAO,MAAM,mBAAmB,OAAe,CAAC;AAChD,eAAO,MAAM,wBAAwB,OAAU,CAAC;AAChD,eAAO,MAAM,eAAe,OAAmB,CAAC;AAChD,eAAO,MAAM,uBAAuB,OAAW,CAAC;AAGhD,eAAO,MAAM,qBAAqB,OAAa,CAAC;AAChD,eAAO,MAAM,gBAAgB,OAAkB,CAAC;AAChD,eAAO,MAAM,uBAAuB,OAAW,CAAC;AAChD,eAAO,MAAM,eAAe,OAAmB,CAAC;AAChD,eAAO,MAAM,iBAAiB,OAAiB,CAAC;AAChD,eAAO,MAAM,uBAAuB,OAAW,CAAC;AAChD,eAAO,MAAM,oBAAoB,OAAc,CAAC;AAChD,eAAO,MAAM,sBAAsB,OAAY,CAAC;AAChD,eAAO,MAAM,kBAAkB,OAAiB,CAAC;AACjD,eAAO,MAAM,sBAAsB,OAAY,CAAC;AAChD,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAClD,eAAO,MAAM,4BAA4B,OAAQ,CAAC;AAClD,eAAO,MAAM,2BAA2B,OAAS,CAAC;AAClD,eAAO,MAAM,2BAA2B,OAAS,CAAC;AAClD,eAAO,MAAM,iBAAiB,OAAmB,CAAC;AAGlD,eAAO,MAAM,iBAAiB,OAAiB,CAAC;AAChD,eAAO,MAAM,wBAAwB,OAAU,CAAC;AAChD,eAAO,MAAM,oBAAoB,OAAc,CAAC;AAChD,eAAO,MAAM,mBAAmB,OAAe,CAAC;AAChD,eAAO,MAAM,kBAAkB,OAAgB,CAAC;AAGhD,eAAO,MAAM,qBAAqB,OAAa,CAAC;AAChD,eAAO,MAAM,uBAAuB,OAAW,CAAC;AAChD,eAAO,MAAM,qBAAqB,OAAa,CAAC;AAChD,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAGhD,eAAO,MAAM,cAAc,OAAoB,CAAC;AAChD,eAAO,MAAM,aAAa,OAAqB,CAAC;AAChD,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAChD,eAAO,MAAM,eAAe,OAAmB,CAAC;AAGhD,eAAO,MAAM,oBAAoB,OAAc,CAAC;AAChD,eAAO,MAAM,uBAAuB,OAAW,CAAC;AAGhD,eAAO,MAAM,yBAAyB,OAAS,CAAC;AAGhD,eAAO,MAAM,cAAc,OAAoB,CAAC;AAMhD;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GACtC,YAAY,GACZ,uBAAuB,GACvB,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,CAAC;AAE1B;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,8BAA8B,GAAG,IAAI,CAqBlF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAuH9D"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Diagnostic Codes — stable numeric identifiers for each diagnostic category
|
|
4
|
+
// ============================================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HM_PARSE_ERROR = exports.HM_INVALID_TABLE_RELATION = exports.HM_MISSING_VARIANT_IMPL = exports.HM_MISSING_SIGNATURE = exports.HM_FANOUT_ARITY = exports.HM_CURRIED_OVER_APPLICATION = exports.HM_CURRY_TYPE = exports.HM_CURRY_ARITY = exports.HM_CONSTRAINT_KIND_MISMATCH = exports.HM_INVALID_CONSTRAINT = exports.HM_CONSTRAINT_VIOLATION = exports.HM_UNKNOWN_CONSTRAINT = exports.HM_CIRCULAR_IMPORT = exports.HM_DUPLICATE_IMPORT = exports.HM_UNRESOLVED_IMPORT = exports.HM_UNRESOLVED_TYPES_PATH = exports.HM_MISSING_EXPORT = exports.HM_INVALID_NARROW = exports.HM_ORPHAN_METHOD_ANNOTATION = exports.HM_ORPHAN_INSTANCE_CALLABLE = exports.HM_METHOD_ON_BARE_VALUE_TYPE = exports.HM_BARE_TVAR_VALUE_ANNOTATION = exports.HM_TYPEREP_MISSING_ARG = exports.HM_UNION_NARROWING = exports.HM_TYPE_ARITY_MISMATCH = exports.HM_NAMELESS_ON_NAMED = exports.HM_METHOD_TYPE_MISMATCH = exports.HM_VARIANT_METHOD = exports.HM_UNKNOWN_TYPE = exports.HM_METHOD_NAME_MISMATCH = exports.HM_NAME_MISMATCH = exports.HM_INVALID_ANNOTATION = exports.HM_EXCESS_RECORD_FIELDS = exports.HM_NOT_CALLABLE = exports.HM_MISSING_RECORD_FIELDS = exports.HM_UNBOUND_VARIABLE = exports.HM_UNCONSTRAINED_PROP = exports.HM_MISSING_PROPERTY = exports.HM_RETURN_TYPE_MISMATCH = exports.HM_ANNOTATION_MISMATCH = exports.HM_INFINITE_TYPE = exports.HM_TYPE_MISMATCH = void 0;
|
|
7
|
+
exports.codeToCategory = codeToCategory;
|
|
8
|
+
exports.classifyDiagnosticCode = classifyDiagnosticCode;
|
|
9
|
+
/**
|
|
10
|
+
* Every diagnostic emitted by hinmil carries a numeric `code` that uniquely
|
|
11
|
+
* identifies its category. These codes are:
|
|
12
|
+
*
|
|
13
|
+
* - Shown in the Problems panel (e.g. `hinmil(1001)`)
|
|
14
|
+
* - Useful for `::ignore` extensions in the future (ignore by code)
|
|
15
|
+
* - Stable across releases so external tooling can rely on them
|
|
16
|
+
*/
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Code constants
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// 1xxx — Type errors
|
|
21
|
+
exports.HM_TYPE_MISMATCH = 1001;
|
|
22
|
+
exports.HM_INFINITE_TYPE = 1002;
|
|
23
|
+
exports.HM_ANNOTATION_MISMATCH = 1003;
|
|
24
|
+
exports.HM_RETURN_TYPE_MISMATCH = 1004;
|
|
25
|
+
exports.HM_MISSING_PROPERTY = 1005;
|
|
26
|
+
exports.HM_UNCONSTRAINED_PROP = 1006;
|
|
27
|
+
exports.HM_UNBOUND_VARIABLE = 1007;
|
|
28
|
+
exports.HM_MISSING_RECORD_FIELDS = 1008;
|
|
29
|
+
exports.HM_NOT_CALLABLE = 1009;
|
|
30
|
+
exports.HM_EXCESS_RECORD_FIELDS = 1010;
|
|
31
|
+
// 2xxx — Annotation issues
|
|
32
|
+
exports.HM_INVALID_ANNOTATION = 2001;
|
|
33
|
+
exports.HM_NAME_MISMATCH = 2002;
|
|
34
|
+
exports.HM_METHOD_NAME_MISMATCH = 2003;
|
|
35
|
+
exports.HM_UNKNOWN_TYPE = 2004;
|
|
36
|
+
exports.HM_VARIANT_METHOD = 2005;
|
|
37
|
+
exports.HM_METHOD_TYPE_MISMATCH = 2006;
|
|
38
|
+
exports.HM_NAMELESS_ON_NAMED = 2007;
|
|
39
|
+
exports.HM_TYPE_ARITY_MISMATCH = 2008;
|
|
40
|
+
exports.HM_UNION_NARROWING = 2009;
|
|
41
|
+
exports.HM_TYPEREP_MISSING_ARG = 2010;
|
|
42
|
+
exports.HM_BARE_TVAR_VALUE_ANNOTATION = 2011;
|
|
43
|
+
exports.HM_METHOD_ON_BARE_VALUE_TYPE = 2012;
|
|
44
|
+
exports.HM_ORPHAN_INSTANCE_CALLABLE = 2013;
|
|
45
|
+
exports.HM_ORPHAN_METHOD_ANNOTATION = 2014;
|
|
46
|
+
exports.HM_INVALID_NARROW = 2015;
|
|
47
|
+
// 3xxx — Import / module issues
|
|
48
|
+
exports.HM_MISSING_EXPORT = 3001;
|
|
49
|
+
exports.HM_UNRESOLVED_TYPES_PATH = 3002;
|
|
50
|
+
exports.HM_UNRESOLVED_IMPORT = 3003;
|
|
51
|
+
exports.HM_DUPLICATE_IMPORT = 3004;
|
|
52
|
+
exports.HM_CIRCULAR_IMPORT = 3005;
|
|
53
|
+
// 4xxx — Constraint issues
|
|
54
|
+
exports.HM_UNKNOWN_CONSTRAINT = 4001;
|
|
55
|
+
exports.HM_CONSTRAINT_VIOLATION = 4002;
|
|
56
|
+
exports.HM_INVALID_CONSTRAINT = 4003;
|
|
57
|
+
exports.HM_CONSTRAINT_KIND_MISMATCH = 4004;
|
|
58
|
+
// 5xxx — Curry issues
|
|
59
|
+
exports.HM_CURRY_ARITY = 5001;
|
|
60
|
+
exports.HM_CURRY_TYPE = 5002;
|
|
61
|
+
exports.HM_CURRIED_OVER_APPLICATION = 5003;
|
|
62
|
+
exports.HM_FANOUT_ARITY = 5004;
|
|
63
|
+
// 6xxx — Missing signatures (informational)
|
|
64
|
+
exports.HM_MISSING_SIGNATURE = 6001;
|
|
65
|
+
exports.HM_MISSING_VARIANT_IMPL = 6002;
|
|
66
|
+
// 7xxx — Relation / Picked-projection issues
|
|
67
|
+
exports.HM_INVALID_TABLE_RELATION = 7001;
|
|
68
|
+
// 9xxx — Other / parse errors
|
|
69
|
+
exports.HM_PARSE_ERROR = 9001;
|
|
70
|
+
/**
|
|
71
|
+
* Map a diagnostic code to its configurable category, or `null` when the
|
|
72
|
+
* code has no user-facing severity setting (those always report as errors,
|
|
73
|
+
* unless the engine attached an explicit severity).
|
|
74
|
+
*/
|
|
75
|
+
function codeToCategory(code) {
|
|
76
|
+
switch (code) {
|
|
77
|
+
case exports.HM_TYPE_MISMATCH:
|
|
78
|
+
case exports.HM_INFINITE_TYPE:
|
|
79
|
+
case exports.HM_ANNOTATION_MISMATCH:
|
|
80
|
+
case exports.HM_RETURN_TYPE_MISMATCH:
|
|
81
|
+
case exports.HM_NOT_CALLABLE:
|
|
82
|
+
case exports.HM_INVALID_TABLE_RELATION:
|
|
83
|
+
return 'typeErrors';
|
|
84
|
+
case exports.HM_MISSING_PROPERTY:
|
|
85
|
+
case exports.HM_UNCONSTRAINED_PROP:
|
|
86
|
+
return 'unknownPropertyAccess';
|
|
87
|
+
case exports.HM_MISSING_RECORD_FIELDS:
|
|
88
|
+
return 'missingRecordFields';
|
|
89
|
+
case exports.HM_EXCESS_RECORD_FIELDS:
|
|
90
|
+
return 'excessRecordFields';
|
|
91
|
+
case exports.HM_UNION_NARROWING:
|
|
92
|
+
return 'annotationNarrowing';
|
|
93
|
+
default:
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Map a diagnostic message to a numeric code.
|
|
99
|
+
*
|
|
100
|
+
* Uses prefix matching to classify messages into categories. Order matters:
|
|
101
|
+
* more specific patterns are checked before general ones.
|
|
102
|
+
*/
|
|
103
|
+
function classifyDiagnosticCode(message) {
|
|
104
|
+
// Parse errors (filtered by mapInferenceDiagnostics, but classify anyway)
|
|
105
|
+
if (message.startsWith('Parse error'))
|
|
106
|
+
return exports.HM_PARSE_ERROR;
|
|
107
|
+
// Invalid `::narrow` directive (non-function / non-Boolean target, unmatched
|
|
108
|
+
// label, etc.). Parse-time narrow errors are wrapped in an
|
|
109
|
+
// "Invalid type annotation for 'X': …" prefix, so match anywhere.
|
|
110
|
+
if (message.includes('::narrow '))
|
|
111
|
+
return exports.HM_INVALID_NARROW;
|
|
112
|
+
// Annotation parse errors
|
|
113
|
+
if (message.startsWith('Invalid type annotation'))
|
|
114
|
+
return exports.HM_INVALID_ANNOTATION;
|
|
115
|
+
if (message.startsWith('Invalid ::constraint'))
|
|
116
|
+
return exports.HM_INVALID_CONSTRAINT;
|
|
117
|
+
// Name mismatches
|
|
118
|
+
if (message.startsWith("Declaration name '") && message.includes('does not match annotation name'))
|
|
119
|
+
return exports.HM_NAME_MISMATCH;
|
|
120
|
+
if (message.startsWith("Method name '") && message.includes('does not match annotation'))
|
|
121
|
+
return exports.HM_METHOD_NAME_MISMATCH;
|
|
122
|
+
// Nameless annotation on named declaration
|
|
123
|
+
if (message.startsWith("Nameless annotation"))
|
|
124
|
+
return exports.HM_NAMELESS_ON_NAMED;
|
|
125
|
+
// Type name mismatch in method annotation (e.g. "Type name mismatch in method annotation: ...")
|
|
126
|
+
if (message.startsWith('Type name mismatch in method annotation'))
|
|
127
|
+
return exports.HM_METHOD_TYPE_MISMATCH;
|
|
128
|
+
// Variant method annotation misuse (e.g. "'Left' is a variant of 'Either'. Use ...")
|
|
129
|
+
if (message.includes('is a variant of') && message.includes('Use '))
|
|
130
|
+
return exports.HM_VARIANT_METHOD;
|
|
131
|
+
// Unknown type constructor
|
|
132
|
+
if (message.startsWith("Unknown type constructor '"))
|
|
133
|
+
return exports.HM_UNKNOWN_TYPE;
|
|
134
|
+
// Type constructor arity mismatch
|
|
135
|
+
if (message.startsWith("Type constructor '") && message.includes('expects'))
|
|
136
|
+
return exports.HM_TYPE_ARITY_MISMATCH;
|
|
137
|
+
// Bare type variable value annotation (e.g. `Tag :: a`)
|
|
138
|
+
if (message.includes('annotated as an unconstrained type variable'))
|
|
139
|
+
return exports.HM_BARE_TVAR_VALUE_ANNOTATION;
|
|
140
|
+
// Instance method declared on a type whose value annotation is a bare TVar
|
|
141
|
+
if (message.includes('annotates') && message.includes('as a plain type variable rather than a type constructor'))
|
|
142
|
+
return exports.HM_METHOD_ON_BARE_VALUE_TYPE;
|
|
143
|
+
// Orphan instance-callable: `Name()` declared without a constructor `Name :: ...`
|
|
144
|
+
if (message.startsWith("Instance-callable annotation '") && message.includes('has no constructor'))
|
|
145
|
+
return exports.HM_ORPHAN_INSTANCE_CALLABLE;
|
|
146
|
+
// Orphan method/static annotation: `Name#m` / `Name.m` without a constructor / class / sumtype `Name`
|
|
147
|
+
if ((message.startsWith("Method annotation '") || message.startsWith("Static annotation '")) && message.includes('has no constructor'))
|
|
148
|
+
return exports.HM_ORPHAN_METHOD_ANNOTATION;
|
|
149
|
+
// Union narrowing
|
|
150
|
+
if (message.startsWith('Annotation narrows'))
|
|
151
|
+
return exports.HM_UNION_NARROWING;
|
|
152
|
+
// Unresolvable ::types path
|
|
153
|
+
if (message.startsWith('Cannot resolve ::types path'))
|
|
154
|
+
return exports.HM_UNRESOLVED_TYPES_PATH;
|
|
155
|
+
// Missing export
|
|
156
|
+
if (message.includes('is not exported from') || message.includes('has no default export'))
|
|
157
|
+
return exports.HM_MISSING_EXPORT;
|
|
158
|
+
// Unresolved import
|
|
159
|
+
if (message.startsWith('Cannot resolve module'))
|
|
160
|
+
return exports.HM_UNRESOLVED_IMPORT;
|
|
161
|
+
// Duplicate import
|
|
162
|
+
if (message.startsWith('Duplicate import'))
|
|
163
|
+
return exports.HM_DUPLICATE_IMPORT;
|
|
164
|
+
// Circular import
|
|
165
|
+
if (message.startsWith('Circular import'))
|
|
166
|
+
return exports.HM_CIRCULAR_IMPORT;
|
|
167
|
+
// Constraint issues
|
|
168
|
+
if (message.startsWith("Unknown constraint '"))
|
|
169
|
+
return exports.HM_UNKNOWN_CONSTRAINT;
|
|
170
|
+
if (message.includes('cannot satisfy constraint'))
|
|
171
|
+
return exports.HM_CONSTRAINT_VIOLATION;
|
|
172
|
+
if (message.includes('does not satisfy constraint'))
|
|
173
|
+
return exports.HM_CONSTRAINT_VIOLATION;
|
|
174
|
+
if (message.includes('kind mismatch'))
|
|
175
|
+
return exports.HM_CONSTRAINT_KIND_MISMATCH;
|
|
176
|
+
if (message.includes('Inconsistent kind'))
|
|
177
|
+
return exports.HM_CONSTRAINT_KIND_MISMATCH;
|
|
178
|
+
if (message.includes('is not used in any method signature'))
|
|
179
|
+
return exports.HM_INVALID_CONSTRAINT;
|
|
180
|
+
// Curry issues
|
|
181
|
+
if (message.startsWith('Curry wrapper expects exactly'))
|
|
182
|
+
return exports.HM_CURRY_ARITY;
|
|
183
|
+
if (message === 'Curry wrapper expects a function argument')
|
|
184
|
+
return exports.HM_CURRY_TYPE;
|
|
185
|
+
if (message.startsWith('::curried only works in .hm files'))
|
|
186
|
+
return exports.HM_CURRY_TYPE;
|
|
187
|
+
if (message.includes('Curried function called with'))
|
|
188
|
+
return exports.HM_CURRIED_OVER_APPLICATION;
|
|
189
|
+
// Fan-out combinator (converge/combine): branch count vs combiner arity
|
|
190
|
+
if (message.includes('fan-out combiner'))
|
|
191
|
+
return exports.HM_FANOUT_ARITY;
|
|
192
|
+
// Annotation mismatch (rigid check / unified format)
|
|
193
|
+
if (message === 'Type mismatch: implementation does not match annotation')
|
|
194
|
+
return exports.HM_ANNOTATION_MISMATCH;
|
|
195
|
+
if (/^Type mismatch: ('[^']+'|value) has (return )?type /.test(message))
|
|
196
|
+
return exports.HM_ANNOTATION_MISMATCH;
|
|
197
|
+
// Return type mismatch (legacy union-return wording)
|
|
198
|
+
if (message.startsWith('Type mismatch: function returns'))
|
|
199
|
+
return exports.HM_RETURN_TYPE_MISMATCH;
|
|
200
|
+
// Property access
|
|
201
|
+
if (message.startsWith("Property '") && message.includes('does not exist on type'))
|
|
202
|
+
return exports.HM_MISSING_PROPERTY;
|
|
203
|
+
if (message.startsWith("Property '") && message.includes('accessed on unconstrained'))
|
|
204
|
+
return exports.HM_UNCONSTRAINED_PROP;
|
|
205
|
+
// Missing record fields
|
|
206
|
+
if (message.startsWith('Missing record field'))
|
|
207
|
+
return exports.HM_MISSING_RECORD_FIELDS;
|
|
208
|
+
if (message.startsWith('Missing required field'))
|
|
209
|
+
return exports.HM_MISSING_RECORD_FIELDS;
|
|
210
|
+
if (message.startsWith('Unknown field'))
|
|
211
|
+
return exports.HM_EXCESS_RECORD_FIELDS;
|
|
212
|
+
// Unbound variable
|
|
213
|
+
if (message.startsWith('Unbound variable:'))
|
|
214
|
+
return exports.HM_UNBOUND_VARIABLE;
|
|
215
|
+
// Infinite type
|
|
216
|
+
if (message.startsWith('Infinite type'))
|
|
217
|
+
return exports.HM_INFINITE_TYPE;
|
|
218
|
+
if (message.includes('has an infinite type'))
|
|
219
|
+
return exports.HM_INFINITE_TYPE;
|
|
220
|
+
// Picked-union mismatch — emitted when a value's projected record's row
|
|
221
|
+
// (`pickedFrom`) does not match any `Picked R …` branch in the expected
|
|
222
|
+
// union (typical query-builder / DSL-style "X is not a relation of Y" case).
|
|
223
|
+
if (/ is not a valid relation here\b/.test(message))
|
|
224
|
+
return exports.HM_INVALID_TABLE_RELATION;
|
|
225
|
+
if (/ has no relation with /.test(message))
|
|
226
|
+
return exports.HM_INVALID_TABLE_RELATION;
|
|
227
|
+
// General unification error (fallback)
|
|
228
|
+
if (message.startsWith('Type mismatch: Cannot unify') || message.startsWith('Cannot unify'))
|
|
229
|
+
return exports.HM_TYPE_MISMATCH;
|
|
230
|
+
// Missing signature (generated by detectMissingSignatures, not inference)
|
|
231
|
+
if (message.includes('has no HM annotation'))
|
|
232
|
+
return exports.HM_MISSING_SIGNATURE;
|
|
233
|
+
// Missing variant method implementation
|
|
234
|
+
if (message.includes('does not implement'))
|
|
235
|
+
return exports.HM_MISSING_VARIANT_IMPL;
|
|
236
|
+
// Default fallback
|
|
237
|
+
return exports.HM_TYPE_MISMATCH;
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=diagnosticCodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticCodes.js","sourceRoot":"","sources":["../../src/services/diagnosticCodes.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;;;AA8F/E,wCAqBC;AAQD,wDAuHC;AAhPD;;;;;;;GAOG;AAEH,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,qBAAqB;AACR,QAAA,gBAAgB,GAAc,IAAI,CAAC;AACnC,QAAA,gBAAgB,GAAc,IAAI,CAAC;AACnC,QAAA,sBAAsB,GA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AAO,+BAAuB,CAAC;IAExE,mBAAmB;IACnB,IAAI,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC;QAAE,OAAO,2BAAmB,CAAC;IAExE,gBAAgB;IAChB,IAAI,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC;QAAE,OAAO,wBAAgB,CAAC;IACjE,IAAI,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QAAE,OAAO,wBAAgB,CAAC;IAEtE,wEAAwE;IACxE,wEAAwE;IACxE,6EAA6E;IAC7E,IAAI,iCAAiC,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,iCAAyB,CAAC;IACtF,IAAI,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,iCAAyB,CAAC;IAE7E,uCAAuC;IACvC,IAAI,OAAO,CAAC,UAAU,CAAC,6BAA6B,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,OAAO,wBAAgB,CAAC;IAErH,0EAA0E;IAC1E,IAAI,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QAAE,OAAO,4BAAoB,CAAC;IAE1E,wCAAwC;IACxC,IAAI,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAAE,OAAO,+BAAuB,CAAC;IAE3E,mBAAmB;IACnB,OAAO,wBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver/node';
|
|
2
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
+
import { InferenceDiagnostic, InferenceResult } from '../infer';
|
|
4
|
+
import { DiagnosticLevel } from '../config';
|
|
5
|
+
import { TypeAnnotation } from '../commentParser';
|
|
6
|
+
/**
|
|
7
|
+
* Convert a {@link DiagnosticLevel} to the corresponding LSP
|
|
8
|
+
* `DiagnosticSeverity` enum value, or `null` for `'off'` (the diagnostic
|
|
9
|
+
* should be dropped entirely).
|
|
10
|
+
*/
|
|
11
|
+
export declare function levelToSeverity(level: DiagnosticLevel): DiagnosticSeverity | null;
|
|
12
|
+
/**
|
|
13
|
+
* Convert inference-level diagnostics (offset-based) to LSP `Diagnostic`
|
|
14
|
+
* objects. Parse errors are filtered out (they are too noisy while the
|
|
15
|
+
* user is still typing).
|
|
16
|
+
*
|
|
17
|
+
* @param inferDiags Raw diagnostics produced by the inference engine.
|
|
18
|
+
* @param textDocument The LSP text document (used for offset → position conversion).
|
|
19
|
+
* @param insertions Insertion offsets from `normalizeArrayLiteralASI` — used
|
|
20
|
+
* to map patched offsets back to the original source.
|
|
21
|
+
* @param severityFor Maps a diagnostic code to its configured LSP severity;
|
|
22
|
+
* `null` drops the diagnostic (its category is `'off'`).
|
|
23
|
+
* An engine-attached severity takes precedence over the
|
|
24
|
+
* returned severity, but `null` still drops.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mapInferenceDiagnostics(inferDiags: InferenceDiagnostic[], textDocument: TextDocument, insertions: number[], severityFor: (code: number) => DiagnosticSeverity | null, unmapOffset: (patchedOffset: number, insertions: number[]) => number): Diagnostic[];
|
|
27
|
+
/**
|
|
28
|
+
* Detect top-level function declarations and arrow/function-expression
|
|
29
|
+
* bindings that lack an HM type annotation and produce an informational
|
|
30
|
+
* diagnostic for each one.
|
|
31
|
+
*
|
|
32
|
+
* @param source Original (un-patched) source code of the file.
|
|
33
|
+
* @param textDocument LSP text document for offset → position mapping.
|
|
34
|
+
* @param annotations Map of declaration names that *do* have an HM annotation.
|
|
35
|
+
* @param fnSeverity Severity for function/method diagnostics (null to skip).
|
|
36
|
+
* @param varSeverity Severity for non-function variable diagnostics (null to skip).
|
|
37
|
+
*/
|
|
38
|
+
export declare function detectMissingSignatures(source: string, textDocument: TextDocument, annotations: Map<string, TypeAnnotation>, fnSeverity: DiagnosticSeverity | null, varSeverity?: DiagnosticSeverity | null, isFunctionValuedAt?: (bindingStart: number) => boolean): Diagnostic[];
|
|
39
|
+
/**
|
|
40
|
+
* Remove diagnostics whose start line appears in the set of ignored lines
|
|
41
|
+
* (from `::ignore` / `::ignore-function` directives).
|
|
42
|
+
*/
|
|
43
|
+
export declare function filterIgnoredDiagnostics(diagnostics: Diagnostic[], ignoredLines: Set<number>): Diagnostic[];
|
|
44
|
+
/**
|
|
45
|
+
* Filter out diagnostics that are caused by a mismatch between the
|
|
46
|
+
* user-written annotation and the inferred type. Used when the
|
|
47
|
+
* `trustAnnotations` setting is enabled.
|
|
48
|
+
*/
|
|
49
|
+
export declare function filterAnnotationMismatchDiagnostics(diagnostics: InferenceDiagnostic[]): InferenceDiagnostic[];
|
|
50
|
+
/**
|
|
51
|
+
* Drop any diagnostic whose `[start, end]` source range lies entirely
|
|
52
|
+
* inside one of the supplied intervals.
|
|
53
|
+
*
|
|
54
|
+
* Pure / knowledge-free: callers decide which intervals to pass. The
|
|
55
|
+
* comparison is inclusive at both ends so a diagnostic that exactly
|
|
56
|
+
* coincides with a binding's extent is treated as inside that binding.
|
|
57
|
+
*/
|
|
58
|
+
export declare function filterDiagnosticsInsideBindings(diagnostics: InferenceDiagnostic[], intervals: ReadonlyArray<readonly [number, number]>): InferenceDiagnostic[];
|
|
59
|
+
/**
|
|
60
|
+
* Collect `[start, end]` source ranges of bindings from an
|
|
61
|
+
* {@link InferenceResult} for use with
|
|
62
|
+
* {@link filterDiagnosticsInsideBindings}.
|
|
63
|
+
*
|
|
64
|
+
* Reads `result.bindingExtents` (populated by the inference engine):
|
|
65
|
+
* - `'annotated'`: only extents flagged `annotated: true`.
|
|
66
|
+
* - `'all'`: every extent regardless of annotation.
|
|
67
|
+
*
|
|
68
|
+
* Returns an empty array when the engine did not publish extents
|
|
69
|
+
* (older results / non-default code paths) — conservative: never
|
|
70
|
+
* suppress diagnostics in code we cannot bound.
|
|
71
|
+
*/
|
|
72
|
+
export declare function collectBindingIntervals(result: InferenceResult, mode: 'annotated' | 'all'): Array<[number, number]>;
|
|
73
|
+
/**
|
|
74
|
+
* Scan the source for `import` statements that bind a name which was
|
|
75
|
+
* already imported earlier in the file, and produce one warning per
|
|
76
|
+
* duplicate binding.
|
|
77
|
+
*/
|
|
78
|
+
export declare function detectDuplicateImports(source: string, textDocument: TextDocument): Diagnostic[];
|
|
79
|
+
/**
|
|
80
|
+
* Produce a warning for every `import ... from '<spec>'` whose resolved
|
|
81
|
+
* target participates in a circular dependency chain with this file.
|
|
82
|
+
* `circularDeps` is the set of URIs on a cycle through `textDocument.uri`
|
|
83
|
+
* (as reported by the import context).
|
|
84
|
+
*/
|
|
85
|
+
export declare function detectCircularImports(source: string, textDocument: TextDocument, circularDeps: Set<string>): Diagnostic[];
|
|
86
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/services/diagnostics.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,UAAU,EACV,kBAAkB,EAInB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAI5C,OAAO,EAAE,cAAc,EAA8C,MAAM,kBAAkB,CAAC;AAU9F;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,GAAG,IAAI,CAQjF;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,mBAAmB,EAAE,EACjC,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,kBAAkB,GAAG,IAAI,EACxD,WAAW,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,MAAM,GACnE,UAAU,EAAE,CAk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