@fluixi/ts-plugin 0.1.0-alpha.9 → 1.0.0-alpha.99

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Fluixi
3
+ Copyright (c) 2026 Ibrahima Touré
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,34 +1,49 @@
1
1
  # @fluixi/ts-plugin
2
2
 
3
- A TypeScript language-service plugin that teaches `tsserver` about Fluixi
4
- `` html`...` `` templates.
3
+ A TypeScript language-service plugin that gives `` html`...` `` templates the same editor
4
+ support JSX gets.
5
5
 
6
6
  ## The problem
7
7
 
8
- TypeScript sees a tagged template as an opaque string. A component referenced
9
- only by tag inside a template —
8
+ TypeScript sees a tagged template as an opaque string. Everything inside it falls off the
9
+ map: a component referenced only by tag is reported "declared but never used", a callback
10
+ param is an implicit `any`, nothing completes, hover says nothing, and go-to-definition
11
+ lands on the template literal instead of the component.
10
12
 
11
13
  ```ts
12
14
  function UserCard() { /* … */ }
13
15
 
14
16
  const app = html`<main><UserCard /></main>`;
17
+ // ^ greyed out — TypeScript never counted this as a reference
15
18
  ```
16
19
 
17
- — is never counted as a reference, so `UserCard` is reported as **"declared but
18
- never used"** and greyed out, even though it's used.
20
+ Authoring in `` html`` `` shouldn't cost you the editor.
19
21
 
20
- ## The fix
22
+ ## What you get
21
23
 
22
- This plugin proxies the language service, reparses each `` html`` ``/`` svg`` ``
23
- template with [`@fluixi/template-parser`](../template-parser), collects the
24
- component tag names, and drops the "unused" diagnostics for those bindings — for
25
- both local declarations and imports.
24
+ Reparse the template with [`@fluixi/template-parser`](../template-parser), map every tag and
25
+ hole back to a real source position, and ask the program's own checker about it:
26
+
27
+ - **Hover** — a component tag shows its signature, a prop shows its declared type, an
28
+ element attribute shows what it takes, and an inferred callback param (`each`, `event`,
29
+ `ref`, `use`, `Show`) shows the type it was inferred to.
30
+ - **Completion** — component prop names inside a tag, element attributes on an intrinsic
31
+ tag, and members of an inferred param (`it.`, `el.`, `e.`).
32
+ - **Navigation** — go-to-definition, find-all-references and rename work through tags.
33
+ Rename only adds tags when TypeScript's own rename succeeded, so you never get a
34
+ rewritten `<Tag>` with a stale `</Tag>`.
35
+ - **Diagnostics** — a bare accessor in a template (`` html`<p>${count}</p>` ``) is flagged,
36
+ since it renders the function once and never updates; a property that doesn't exist on an
37
+ inferred param is reported.
38
+ - **Quiet where it should be** — unused-component reports and implicit-`any` noise on params
39
+ the template can infer are dropped.
40
+ - **Quick fixes** — "Call `count`" for a bare accessor, with a fix-all for the file.
26
41
 
27
42
  ## Enable it
28
43
 
29
- Add it to your project's `tsconfig.json` and use the **workspace** TypeScript
30
- version (VS Code: `TypeScript: Select TypeScript Version → Use Workspace
31
- Version`, since tsconfig plugins only load under the workspace TS):
44
+ Add it to your project's `tsconfig.json` and use the **workspace** TypeScript version
45
+ (VS Code: `TypeScript: Select TypeScript Version → Use Workspace Version` — tsconfig plugins
46
+ only load under the workspace TS):
32
47
 
33
48
  ```jsonc
34
49
  {
@@ -38,6 +53,22 @@ Version`, since tsconfig plugins only load under the workspace TS):
38
53
  }
39
54
  ```
40
55
 
56
+ Nothing else. JSX needs no plugin, and neither do the `$signal`-style intrinsics — those are
57
+ typed by the `fluixi.d.ts` the compiler generates.
58
+
59
+ ## How it stays out of the way
60
+
61
+ Everything is computed on the **existing** program's checker. The plugin creates no language
62
+ service, adds no files, and never touches the host — it wraps the service it's handed, and
63
+ every addition is wrapped so a failure costs the extra information, never the real answer.
64
+
65
+ That restraint is deliberate. Two earlier designs for deep type-checking inside `${…}` holes
66
+ both had to go: a second `ts.LanguageService` meant a second document registry, so lib.d.ts
67
+ and node_modules were parsed twice; and shadow files added via `getScriptFileNames` re-entered
68
+ host machinery on every project sync and crashed the language service outright. Hole
69
+ diagnostics weren't worth either — a `${…}` hole is a real expression, so TypeScript already
70
+ checks it.
71
+
41
72
  ## License
42
73
 
43
74
  MIT
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Components the compiler auto-imports.
3
+ *
4
+ * `<Show>`, `<Portal>`, `<Suspense>`, `<Outlet>` and friends work in a template
5
+ * with no import: the compiler injects one. That's good ergonomics and bad for
6
+ * tooling: there is no binding in the file, so `getSymbolsInScope` finds nothing
7
+ * and every symbol-driven feature (definition, references, rename, hover) goes
8
+ * quiet on exactly the components used most.
9
+ *
10
+ * So resolve them the way the compiler would: find the module it would import
11
+ * from, and look the name up there.
12
+ *
13
+ * The names come from `@fluixi/compiler/builtins`, which exists so this list is not
14
+ * copied. It used to be duplicated here: the plugin is an esbuild bundle and pulling
15
+ * in the compiler would dwarf it: with a spec reading the compiler source to pin the
16
+ * two together. That subpath is pure data with no compiler code behind it, so the
17
+ * bundle stays small and the copy is gone.
18
+ */
19
+ import type * as TS from 'typescript';
20
+ /** Tag name → the module the compiler injects an import from. */
21
+ export declare const AUTO_IMPORTED: Readonly<Record<string, string>>;
22
+ /** Where a name is declared: enough for a jump, without needing the checker. */
23
+ export interface DeclarationSite {
24
+ fileName: string;
25
+ start: number;
26
+ length: number;
27
+ }
28
+ /**
29
+ * Find where a module declares a name, reading from disk.
30
+ *
31
+ * Needed because an auto-imported component means nothing imports its module, so
32
+ * the module's declarations are usually NOT in the program and the checker can say
33
+ * nothing about them. Definition only needs a file and a span, so it can be
34
+ * answered without the program: following `export *` re-exports through the
35
+ * barrels these packages are built from.
36
+ */
37
+ export declare function declarationSite(ts: typeof TS, program: TS.Program, host: TS.ModuleResolutionHost, from: TS.SourceFile, name: string): DeclarationSite | undefined;
38
+ /**
39
+ * The symbol for an auto-imported component tag, or undefined when the name isn't
40
+ * one or the module can't be resolved.
41
+ */
42
+ export declare function autoImportedSymbol(ts: typeof TS, program: TS.Program, host: TS.ModuleResolutionHost, from: TS.SourceFile, name: string): TS.Symbol | undefined;
43
+ //# sourceMappingURL=auto-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-import.d.ts","sourceRoot":"","sources":["../src/auto-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAGtC,iEAAiE;AACjE,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAyB,CAAC;AAkCrF,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAID;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,OAAO,EAAE,EACb,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAC7B,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,IAAI,EAAE,MAAM,GACX,eAAe,GAAG,SAAS,CAuB7B;AAoFD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,OAAO,EAAE,EACb,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAC7B,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,IAAI,EAAE,MAAM,GACX,EAAE,CAAC,MAAM,GAAG,SAAS,CAevB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Per-file caches for work that would otherwise repeat on every keystroke.
3
+ *
4
+ * Everything is keyed on the `SourceFile` object, which TypeScript replaces
5
+ * whenever the file changes: so a `WeakMap` gives exact invalidation for free,
6
+ * with no version bookkeeping and no way to serve a stale parse.
7
+ *
8
+ * This matters because the editor calls completion/hover/diagnostics several
9
+ * times per keystroke, and each entry point needs the same parsed template.
10
+ */
11
+ import type * as TS from 'typescript';
12
+ import { type ParseResult } from '@fluixi/template-parser';
13
+ /** Parse a template, reusing the result for as long as the file is unchanged. */
14
+ export declare function parseCached(ts: typeof TS, sf: TS.SourceFile, tpl: TS.TemplateLiteral): ParseResult;
15
+ /**
16
+ * Every `html`/`svg` template in the file, collected in one AST walk instead of
17
+ * one walk per lookup. Sorted by start so a position lookup is a binary search.
18
+ *
19
+ * A file that cannot contain a template skips the walk entirely. The plugin is loaded
20
+ * by tsserver in every project, so most files it sees have no `` html`` `` at all, and
21
+ * scanning the text for the tag is far cheaper than traversing the AST to prove it.
22
+ */
23
+ export declare function templatesIn(ts: typeof TS, sf: TS.SourceFile): TS.TaggedTemplateExpression[];
24
+ /**
25
+ * The innermost template containing `pos`. Templates nest (a template can appear
26
+ * inside a `${…}` hole), so the last match wins.
27
+ */
28
+ export declare function templateAtCached(ts: typeof TS, sf: TS.SourceFile, pos: number): TS.TaggedTemplateExpression | undefined;
29
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAK1E,iFAAiF;AACjF,wBAAgB,WAAW,CACzB,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,UAAU,EACjB,GAAG,EAAE,EAAE,CAAC,eAAe,GACtB,WAAW,CAab;AAgBD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,wBAAwB,EAAE,CAwB3F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,UAAU,EACjB,GAAG,EAAE,MAAM,GACV,EAAE,CAAC,wBAAwB,GAAG,SAAS,CAQzC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The pure logic behind the plugin: which identifiers a file references ONLY
3
+ * through `` html`` `` component tags (so TypeScript can't see them), and whether
4
+ * a given "unused" diagnostic should therefore be suppressed.
5
+ *
6
+ * A `<UserCard/>` inside a template is plain text to TypeScript, it never
7
+ * counts as a reference, so the binding gets flagged "declared but never used".
8
+ * We reparse each template with `@fluixi/template-parser`, collect the component
9
+ * tag roots, and treat those names as used.
10
+ *
11
+ * The `typescript` module is passed in (the instance tsserver hands the plugin
12
+ * via `init({ typescript })`) rather than imported, so the plugin uses the exact
13
+ * TS the editor is running: never a second copy resolved from node_modules.
14
+ */
15
+ import type * as TS from 'typescript';
16
+ export declare function isUnusedCode(code: number): boolean;
17
+ /**
18
+ * Component tag roots referenced inside html``/svg`` templates in the file.
19
+ *
20
+ * Cached on the `SourceFile`, which TypeScript replaces on edit. It has to be: the
21
+ * editor asks for semantic AND suggestion diagnostics on every keystroke, so an
22
+ * uncached walk here cost two full traversals of every open file per keypress ,
23
+ * including files with no templates at all, in any project the extension activates
24
+ * for. Reuses `templatesIn` and `parseCached` so a file with no `` html`` `` costs
25
+ * one cached lookup and nothing else.
26
+ */
27
+ export declare function usedComponentTags(ts: typeof TS, sourceFile: TS.SourceFile): Set<string>;
28
+ /**
29
+ * Whether `diagnostic` is an "unused" report for a binding that IS used through
30
+ * a template component tag: and should therefore be dropped.
31
+ */
32
+ export declare function shouldSuppress(ts: typeof TS, sourceFile: TS.SourceFile, diagnostic: TS.Diagnostic, used: ReadonlySet<string>): boolean;
33
+ //# sourceMappingURL=collect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../src/collect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAOtC,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAID;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAUvF;AAYD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,OAAO,EAAE,EACb,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GACxB,OAAO,CAmBT"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Member completion for inferred callback params inside html`` templates.
3
+ *
4
+ * At `${(it) => it.|}` TypeScript sees `it` as implicit `any`, so its own
5
+ * completion offers nothing useful. We infer `it`'s type from the template
6
+ * (each item, event, ref/use element, …) and return that type's members, the
7
+ * same list JSX would show. Runs entirely on the main language service.
8
+ */
9
+ import type * as TS from 'typescript';
10
+ export declare function paramMemberCompletions(ts: typeof TS, ls: TS.LanguageService, fileName: string, position: number): TS.CompletionEntry[] | undefined;
11
+ //# sourceMappingURL=completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../src/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAGtC,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,eAAe,EACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,EAAE,CAAC,eAAe,EAAE,GAAG,SAAS,CA6BlC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Type errors inside `${…}` holes, checked against the MAIN program.
3
+ *
4
+ * A `${(it) => it.nope}` is a real expression in a real file, TypeScript has
5
+ * already parsed and bound it. The only thing it lacks is a contextual type for
6
+ * `it`, which is why the mistake goes unreported: `it` is implicitly `any`, and
7
+ * every property access on `any` is allowed.
8
+ *
9
+ * So rather than building a parallel document to make the checker see the
10
+ * template, we supply the missing type ourselves (the same inference hover uses)
11
+ * and ask the checker whether each property access holds. Spans are real source
12
+ * positions, so nothing needs mapping: and nothing is added to the program, no
13
+ * second service exists, and the host is never touched.
14
+ *
15
+ * The trade-off is honest: this catches property access on an inferred parameter,
16
+ * which is the mistake templates actually produce. It is not a general type-check
17
+ * of hole contents.
18
+ */
19
+ import type * as TS from 'typescript';
20
+ /** The plugin's own diagnostic code for a bare accessor, shared with its fix. */
21
+ export declare const ACCESSOR_NOT_CALLED = 9001;
22
+ export declare function templateDiagnostics(ts: typeof TS, ls: TS.LanguageService, fileName: string): TS.Diagnostic[];
23
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAKtC,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAyGxC,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,eAAe,EACtB,QAAQ,EAAE,MAAM,GACf,EAAE,CAAC,UAAU,EAAE,CAiDjB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Element attribute support inside html`` templates.
3
+ *
4
+ * Everything here is driven by `IntrinsicElements` from `@fluixi/dom/attributes`
5
+ *: the same tag → attributes map JSX type-checks against, so html`` and JSX
6
+ * agree on what an element accepts, and neither needs the other's package.
7
+ *
8
+ * The editor's HTML language service already offers the standard HTML attribute
9
+ * names from MDN data. What it cannot know is the framework's surface: `classList`,
10
+ * `onClick`, the `Reactive<T>` value types, `prop:`/`attr:`/`bool:`. That comes
11
+ * from the type, which is what this adds.
12
+ *
13
+ * Performance: the resolved type is cached per Program, and the attribute list per
14
+ * tag, so a keystroke costs a map lookup rather than a module resolution.
15
+ */
16
+ import type * as TS from 'typescript';
17
+ /** Attribute-name completion for a native element inside a template. */
18
+ export declare function elementAttributeCompletions(ts: typeof TS, ls: TS.LanguageService, host: TS.ModuleResolutionHost, fileName: string, position: number): TS.CompletionEntry[] | undefined;
19
+ /** Hover over an element attribute name: its declared type, from the same map. */
20
+ export declare function elementAttributeHover(ts: typeof TS, ls: TS.LanguageService, host: TS.ModuleResolutionHost, fileName: string, position: number): TS.QuickInfo | undefined;
21
+ //# sourceMappingURL=elements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAkJtC,wEAAwE;AACxE,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,eAAe,EACtB,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,EAAE,CAAC,eAAe,EAAE,GAAG,SAAS,CA0BlC;AAsCD,kFAAkF;AAClF,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,eAAe,EACtB,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,EAAE,CAAC,SAAS,GAAG,SAAS,CAqC1B"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Quick fixes for the plugin's own diagnostics.
3
+ *
4
+ * A diagnostic you can't act on is half a feature: the editor shows a squiggle,
5
+ * and the fix: which the rule already knows exactly, is left to be typed by
6
+ * hand. Every rule that can name its remedy should offer it.
7
+ *
8
+ * These are keyed to the plugin's diagnostic codes, so they appear alongside
9
+ * TypeScript's own fixes rather than replacing them.
10
+ */
11
+ import type * as TS from 'typescript';
12
+ /**
13
+ * Fixes for a span. Returns only fixes for the plugin's codes; TypeScript's are
14
+ * added by the caller, which leaves its own list untouched.
15
+ */
16
+ export declare function templateCodeFixes(ts: typeof TS, ls: TS.LanguageService, fileName: string, start: number, end: number, errorCodes: readonly number[]): TS.CodeFixAction[];
17
+ /** The same edit applied to every occurrence in the file. */
18
+ export declare function templateFixAll(ts: typeof TS, ls: TS.LanguageService, fileName: string, errorCodes: readonly number[]): TS.CombinedCodeActions | undefined;
19
+ //# sourceMappingURL=fixes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixes.d.ts","sourceRoot":"","sources":["../src/fixes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAGtC;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,eAAe,EACtB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,EAAE,CAAC,aAAa,EAAE,CA0BpB;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAC5B,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,eAAe,EACtB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,EAAE,CAAC,mBAAmB,GAAG,SAAS,CAcpC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Hover for component tags inside `` html`` `` templates.
3
+ *
4
+ * TypeScript sees `<AsyncName …>` as text in a string, so hovering the tag shows
5
+ * nothing. We map the tag to the binding it names, then return the SAME quick
6
+ * info TypeScript would show for that binding (its signature/type), remapped so
7
+ * the hover highlights the tag in the template. Same idea as ts-lit-plugin.
8
+ */
9
+ import type * as TS from 'typescript';
10
+ export declare function componentQuickInfo(ts: typeof TS, ls: TS.LanguageService, host: TS.ModuleResolutionHost, fileName: string, position: number): TS.QuickInfo | undefined;
11
+ //# sourceMappingURL=hover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../src/hover.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAKtC,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,OAAO,EAAE,EACb,EAAE,EAAE,EAAE,CAAC,eAAe,EACtB,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,EAAE,CAAC,SAAS,GAAG,SAAS,CAgC1B"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Fluixi TypeScript language-service plugin.
3
+ *
4
+ * Gives html`` templates real TypeScript support: hovering a callback param shows
5
+ * its inferred type, element and component attributes complete and hover, a wrong
6
+ * property on an inferred param is reported, the implicit-any noise on those params
7
+ * is dropped, and a component used only through a tag isn't reported unused.
8
+ *
9
+ * Everything is computed on the EXISTING program's checker. The plugin creates no
10
+ * language service, adds no files, and does not touch the host, it only wraps
11
+ * the service it is handed.
12
+ *
13
+ * That restraint is deliberate. Two earlier designs for deep type-checking inside
14
+ * `${…}` holes both had to go: a second `ts.LanguageService` (a second document
15
+ * registry, so lib.d.ts and node_modules were parsed twice), and shadow files
16
+ * added to the program by patching `getScriptFileNames`, which tsserver calls on
17
+ * every project sync, so building shadows there re-entered host machinery and
18
+ * crashed the language service outright. Hole diagnostics are not worth either.
19
+ *
20
+ * Enable it in a project's tsconfig (using the workspace TypeScript version):
21
+ * { "compilerOptions": { "plugins": [{ "name": "@fluixi/ts-plugin" }] } }
22
+ */
23
+ import type * as ts from 'typescript';
24
+ interface PluginCreateInfo {
25
+ languageService: ts.LanguageService;
26
+ languageServiceHost: ts.LanguageServiceHost;
27
+ project?: {
28
+ projectService?: {
29
+ logger?: {
30
+ info(message: string): void;
31
+ };
32
+ };
33
+ };
34
+ }
35
+ interface PluginModule {
36
+ create(info: PluginCreateInfo): ts.LanguageService;
37
+ }
38
+ /** tsserver calls this with the TS module instance the editor is running. */
39
+ declare function init(modules: {
40
+ typescript: typeof import('typescript');
41
+ }): PluginModule;
42
+ export = init;
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAatC,UAAU,gBAAgB;IACxB,eAAe,EAAE,EAAE,CAAC,eAAe,CAAC;IACpC,mBAAmB,EAAE,EAAE,CAAC,mBAAmB,CAAC;IAC5C,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE;gBAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;aAAE,CAAA;SAAE,CAAA;KAAE,CAAC;CAC7E;AACD,UAAU,YAAY;IACpB,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,EAAE,CAAC,eAAe,CAAC;CACpD;AAED,6EAA6E;AAG7E,iBAAS,IAAI,CAAC,OAAO,EAAE;IAAE,UAAU,EAAE,cAAc,YAAY,CAAC,CAAA;CAAE,GAAG,YAAY,CAwOhF;AAED,SAAS,IAAI,CAAC"}