TypeScript/tests/cases/fourslash/extract-const4.ts
Jack Works 7ec467e270
fix: extract const in jsx (#37912)
* fix: extract const in jsx

* Update src/services/refactors/extractSymbol.ts

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* Update src/services/refactors/extractSymbol.ts

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-05-19 14:29:49 -07:00

22 lines
484 B
TypeScript

/// <reference path='fourslash.ts' />
// GH#35372
// @jsx: preserve
// @filename: main.tsx
////function foo() {
//// return <div>/*a*/<a>content</a>/*b*/</div>;
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent:
`function foo() {
const /*RENAME*/newLocal = <a>content</a>;
return <div>{newLocal}</div>;
}`
});