Repository navigation
Conversation
tsserver remaps definitions through declaration maps (session mapDefinitionInfoLocations -> documentPositionMapper), and that decoder calls getPositionOfLineAndCharacter(..., allowEdits=true) for EVERY mapping in the map, clamping stale coordinates — real packages ship them (unified@11.0.5's index.d.ts.map has generated 846:313 on a 301-char line). The host-side SourceFile skeletons dropped the allowEdits argument, so stock's clamping call took the strict path, hit Debug.assert, and the whole definition request failed: goto definition on an import of such a package resolved to nothing while quickinfo still worked. Forward (line, character, allowEdits?) in all three skeletons (createSharedLightStub, installLazyLineHelpers, patchLineHelpers), matching the stock SourceFileLike contract; non-allowEdits callers keep the strict behavior. Witness triage-gtd-declmap-allowedits drives the pinned unified@11.0.5 reproduction through both engines (pre-fix TNB fails the request with the Debug assert; post-fix lands at unified/lib/index.js like stock), wired wg5.
The unified@11.0.5 npm install was the witness's only dependency and most of its runtime (~4s of ~6s), and its pass depended on upstream package content staying stale. A synthesized fake-unified package reproduces the three conditions by construction (exports→js resolution leaving the d.ts a light stub, an out-of-range mapping, a sourceMappingURL comment), so the witness needs no npm or network, runs in ~1.5s, and cannot silently degrade if upstream fixes their map.
allowEdits in source-file skeleton line helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tsserver declaration-map remapper decodes every mapping with
getPositionOfLineAndCharacter(..., allowEdits=true). TNB's host-sideSourceFileskeletons dropped that argument, so stale declaration-map coordinates hitDebug.assertand the wholedefinitionrequest failed.This pull request was created with assistance from a code agent.