Skip to content

getEditsForRefactor debug failure on jsx selection #21772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mjbvz opened this issue Feb 8, 2018 · 2 comments · Fixed by #21777
Closed

getEditsForRefactor debug failure on jsx selection #21772

mjbvz opened this issue Feb 8, 2018 · 2 comments · Fixed by #21777
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 8, 2018

TypeScript Version: 2.8.1-insiders-20180206

Search Terms:

  • JSX
  • Refactor
  • Extract

Code

import * as React from 'react'

class Foo extends React.Component {
    render() {
        return (
            <div>
            <b>bold</b>
            </div>
        )
    }
}

Try running extract method on <b>bold</b>

Bug:

The call to getEditsForRefactor fails:

[Trace  - 12:41:58 PM] Sending request: getEditsForRefactor (377). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/src/index.tsx",
    "startLine": 7,
    "startOffset": 13,
    "endLine": 7,
    "endOffset": 24,
    "refactor": "Extract Symbol",
    "action": "function_scope_1"
}
[Trace  - 12:41:59 PM] Response received: getEditsForRefactor (377). Request took 590 ms. Success: false . Message: Error processing request. Debug Failure. False expression.
Error: Debug Failure. False expression.
    at getPos (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:76906:22)
    at assignPositionsToNodeArray (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77437:29)
    at Object.visitEachChild (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45884:53)
    at assignPositionsToNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77425:30)
    at visitNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45562:23)
    at Object.visitEachChild (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45876:118)
    at assignPositionsToNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77425:30)
    at visitNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45562:23)
    at Object.visitEachChild (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45872:50)
    at assignPositionsToNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77425:30)
    at visitNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45562:23)
    at Object.visitEachChild (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45816:46)
    at assignPositionsToNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77425:30)
    at Object.visitNodes (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45599:48)
    at assignPositionsToNodeArray (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77432:30)
    at Object.visitEachChild (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45794:45)
    at assignPositionsToNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77425:30)
    at visitNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45562:23)
    at visitFunctionBody (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45645:23)
    at Object.visitEachChild (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:45684:510)
    at assignPositionsToNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77425:30)
    at getNonformattedText (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77401:52)
    at ChangeTracker.getFormattedTextOfNode (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77368:40)
    at ChangeTracker.computeNewText (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77362:33)
    at /Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77338:118
    at Map.forEach (native)
    at ChangeTracker.getChanges (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77333:32)
    at extractFunctionInScope (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:81665:43)
    at getFunctionExtractionAtIndex (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:81404:24)
    at Object.getEditsForAction (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:81072:28)
    at Object.getEditsForRefactor (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:77709:41)
    at Object.getEditsForRefactor (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:83928:32)
    at IOSession.Session.getEditsForRefactor (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:90792:59)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:89745:61)
    at /Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:90985:88
    at IOSession.Session.executeWithRequestId (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:90976:28)
    at IOSession.Session.executeCommand (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:90985:33)
    at IOSession.Session.onMessage (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:91005:35)
    at Interface.<anonymous> (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:92206:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)

Playground Link:

Related Issues:

@mhegazy mhegazy added the Bug A bug in TypeScript label Feb 8, 2018
@mhegazy mhegazy assigned ghost Feb 8, 2018
@mhegazy mhegazy added this to the TypeScript 2.8 milestone Feb 8, 2018
@ghost
Copy link

ghost commented Feb 8, 2018

The line numbers don't seem to match up with typescript@2.7.1.

@mjbvz
Copy link
Contributor Author

mjbvz commented Feb 8, 2018

Whoops, this was actually 2.8.1-insiders-20180206

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Feb 12, 2018
@ghost ghost closed this as completed in #21777 Mar 12, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants