Repository navigation
Error in 'setTextPos' during 'getCodeFixes' #49310
Description
Activity
- addedBugA bug in TypeScriptA bug in TypeScriptSource: TelemetryThe issue relates to the telemetry in editorsThe issue relates to the telemetry in editors
on May 30, 2022 typescript-bot commented
on Jun 6, 2022 ContributorAuthorMore actionsThis issue reproduced in the following context:
TypeScript version prefix: 4.7.3
VSCode version: 1.68.0-insider
Command requested: getCodeFixes
Hitting sessions: 178
Five line hash: 8bf0402bbe40ec04bbb0073872731305
Stack:at setTextPos (tsserver.js:12103:22) at skipToEndOf (tsserver.js:145431:25) at processChildNodes (tsserver.js:146926:47) at <anonymous> (tsserver.js:146843:21) at visitNodes (tsserver.js:30474:24) at forEachChild (tsserver.js:30665:21) at processNode (tsserver.js:146840:20) at processChildNode (tsserver.js:146911:21) at <anonymous> (tsserver.js:146841:21) at visitNode (tsserver.js:30469:24) at forEachChild (tsserver.js:30628:21) at processNode (tsserver.js:146840:20) at formatSpanWorker (tsserver.js:146640:17) at <anonymous> (tsserver.js:146603:140) at getFormattingScanner (tsserver.js:145230:23) at formatNodeGivenIndentation (tsserver.js:146603:31) at getFormattedTextOfNode (tsserver.js:149034:45) at format (tsserver.js:149005:52) at computeNewText (tsserver.js:149008:23) at <anonymous> (tsserver.js:148972:39) at mapDefined (tsserver.js:605:30) at <anonymous> (tsserver.js:148970:42) at mapDefined (tsserver.js:605:30) at getTextChangesFromChanges (tsserver.js:148956:27) at ChangeTracker.getChanges (tsserver.js:148895:45) at ChangeTracker.with (tsserver.js:148315:32) at getCodeActions (tsserver.js:154025:68) at <anonymous> (tsserver.js:149562:77) at flatMap (tsserver.js:508:25) at getFixes (tsserver.js:149562:23) at <anonymous> (tsserver.js:164962:35) at flatMap (tsserver.js:508:25) at getCodeFixesAtPosition (tsserver.js:164960:23) at Session.getCodeFixes (tsserver.js:176859:64) at _a.<computed> (tsserver.js:175242:61) at <anonymous> (tsserver.js:177172:88) at Session.executeWithRequestId (tsserver.js:177163:28) at Session.executeCommand (tsserver.js:177172:33) at Session.onMessage (tsserver.js:177198:35) at <anonymous> (tsserver.js:179833:31)typescript-bot commented
on Jun 27, 2022 ContributorAuthorMore actionsThis issue reproduced in the following context:
TypeScript version prefix: 4.7.4
VSCode version: 1.64.2
Command requested: getCodeFixes
Hitting sessions: 744
Five line hash: 8bf0402bbe40ec04bbb0073872731305
Stack:at setTextPos (tsserver.js:12103:22) at skipToEndOf (tsserver.js:145432:25) at processChildNodes (tsserver.js:146927:47) at <anonymous> (tsserver.js:146844:21) at visitNodes (tsserver.js:30474:24) at forEachChild (tsserver.js:30665:21) at processNode (tsserver.js:146841:20) at processChildNode (tsserver.js:146912:21) at processChildNodes (tsserver.js:146966:48) at <anonymous> (tsserver.js:146844:21) at visitNodes (tsserver.js:30474:24) at forEachChild (tsserver.js:30653:24) at processNode (tsserver.js:146841:20) at processChildNode (tsserver.js:146912:21) at <anonymous> (tsserver.js:146842:21) at visitNode (tsserver.js:30469:24) at forEachChild (tsserver.js:30565:21) at processNode (tsserver.js:146841:20) at processChildNode (tsserver.js:146912:21) at processChildNodes (tsserver.js:146966:48) at <anonymous> (tsserver.js:146844:21) at visitNodes (tsserver.js:30474:24) at forEachChild (tsserver.js:30627:21) at processNode (tsserver.js:146841:20) at formatSpanWorker (tsserver.js:146641:17) at <anonymous> (tsserver.js:146604:140) at getFormattingScanner (tsserver.js:145231:23) at formatNodeGivenIndentation (tsserver.js:146604:31) at getFormattedTextOfNode (tsserver.js:149035:45) at format (tsserver.js:149006:52) at computeNewText (tsserver.js:149009:23) at <anonymous> (tsserver.js:148973:39) at mapDefined (tsserver.js:605:30) at <anonymous> (tsserver.js:148971:42) at mapDefined (tsserver.js:605:30) at getTextChangesFromChanges (tsserver.js:148957:27) at ChangeTracker.getChanges (tsserver.js:148896:45) at ChangeTracker.with (tsserver.js:148316:32) at getCodeActions (tsserver.js:154048:68) at <anonymous> (tsserver.js:149563:77) at flatMap (tsserver.js:508:25) at getFixes (tsserver.js:149563:23) at <anonymous> (tsserver.js:164985:35) at flatMap (tsserver.js:508:25) at getCodeFixesAtPosition (tsserver.js:164983:23) at unknown (suppressed.js:182:34) at unknown (suppressed.js:79:25) at Session.getCodeFixes (tsserver.js:176882:64) at _a.<computed> (tsserver.js:175265:61) at <anonymous> (tsserver.js:177195:88) at Session.executeWithRequestId (tsserver.js:177186:28) at Session.executeCommand (tsserver.js:177195:33) at Session.onMessage (tsserver.js:177221:35) at <anonymous> (tsserver.js:179856:31) at unknown (suppressed.js:315:20) at unknown (suppressed.js:903:12) at unknown (suppressed.js:81:21)Redused-ish repro:
/// <reference path="fourslash.ts" /> // @filename: index.esm.d.ts //// export declare class Chart { //// constructor(config: ChartConfiguration); //// } //// //// export interface ChartConfiguration { //// options?: Partial<TickOptions>; //// } //// //// export interface TickOptions { //// callback: (this: Scale, tickValue: number | string) => string | string[] | number | number[] | null | undefined; //// } //// //// export interface CoreScaleOptions { //// opt: boolean; //// } //// //// export interface Scale<O extends CoreScaleOptions = CoreScaleOptions> { //// opts: O; //// getLabelForValue(value: number): string; //// } // @filename: options.ts //// import { Chart } from './index.esm'; //// //// const chart = new Chart({ //// options: { //// callback(tickValue) { //// /*a*/const value = this.getLabelForValue(tickValue as number);/*b*/ //// return '$' + value; //// } //// } //// }); goTo.file("options.ts"); verify.noErrors(); goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "function_scope_0", actionDescription: "Extract to inner function in method 'callback'", newContent: `TODO` });
Feels like another node reuse problem, kinda like I fixed in #48490.
No, different problem. The formatter doesn't seem to like synthesized nodes/arrays, which can happen since code fixes and refactors generate code (which means we may create import nodes, for example), which is then formatted before being returned.
- addedFix AvailableA PR has been opened for this issueA PR has been opened for this issue
on Jul 21, 2022 - locked as resolved and limited conversation to collaborators
on Oct 22, 2025
This issue comes from crash dumps in telemetry. We've tried to de-duplicate issues on a best-effort basis, comparing the sequence of methods called and the command requested while ignoring line numbers.
TypeScript version prefix: 4.7.2
VSCode version: 1.68.0-insider
Command requested: getCodeFixes
Hitting sessions: 847
Five line hash: 8bf0402bbe40ec04bbb0073872731305
Stack: