Skip to content

Feature/tsdefinition short names - #3

Merged
windischb merged 4 commits into
developfrom
feature/tsdefinition-short-names
Apr 20, 2026
Merged

windischb merged 4 commits into
developfrom
feature/tsdefinition-short-names

Conversation

@windischb

Copy link
Copy Markdown
Collaborator

No description provided.

windischb and others added 4 commits April 19, 2026 12:58
…s auto-emission

v3.1.4 lands the "Monaco hovers show the short name instead of the 80-char
namespace path" story, with one config that works for .d.ts AND NewObject:

- New IJsTsDefinitionContributor extension point; AddLinq auto-registers
  a contributor so linq.d.ts surfaces in GetTsDefinitions() output —
  closes the "linq.* is invisible in Monaco" gap from the FR
- AddTypeAlias<T>() / MapNamespace(prefix, target) on JsEvalBuilder —
  aliases emit at root scope in the .d.ts AND resolve via NewObject(...);
  single source of truth lives on JsEngineOptions so the two layers
  cannot drift apart
- DefinitionBuilder.AddType(type, alias) / MapNamespace(source, target)
  for standalone (non-DI) consumers
- Collision detection fires only when a user rule is involved;
  natural same-name collisions (Span.Enumerator vs ReadOnlySpan.Enumerator)
  keep the v3.1.3 interface-merging behavior so unconfigured consumers
  don't regress
- System.* excluded from namespace mapping by default
- 8 new regression tests, 314/314 suite green

Pure additive release. No breaking changes to any existing API.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… more hand-written files

AddLinq()'s TypeScript surface had drifted from reality: linq.d.ts referenced
undeclared types (Guid, Decimal, Long), cocoar-jseval-linq.d.ts was a hand-
maintained mirror of the translator's method-map. Both are now derived from
real C# metadata by LinqTsContributor:

- LinqGlobal: POCO bound to Jint as the `linq` runtime object. Its public
  instance methods become the JS API (linq.guid('...'), linq.today(), ...)
  AND the reflection source for generating linq.d.ts with matching return
  types (System.Guid, number, Date).
- IJsStringAliases / IJsArrayAliases<T>: metadata-only interfaces describing
  the PascalCase aliases (Contains, StartsWith, Any, All, Where, ...). Not
  registered at runtime — pure reflection targets so LinqTsContributor can
  emit `interface String { ... }` / `interface Array<T> { ... }` / `ReadonlyArray<T>`
  augmentations that TypeScript merges with the built-in lib.es5 declarations.

LinqTypeScriptDefinition.Read/WriteTo helpers are removed (TsDefinitionService
surfaces the content automatically via the contributor). Both embedded .d.ts
resources are gone — single source of truth lives in C# code. Adding a new
alias = adding a method on the C# class, no second edit needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@windischb
windischb merged commit d67ae18 into develop Apr 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant