Major changes: 1) Instead of skipping undesirable scopes, include them and mark them with errors. Constants can be extracted into more scopes. 2) Update the tests to call through the "public" API. This caused some baseline changes. 3) Rename refactoring to "Extract Symbol" for generality. 4) Return a second ApplicableRefactorInfo for constants. Distinguish the two by splitting the action name.
16 lines
410 B
TypeScript
16 lines
410 B
TypeScript
/// <reference path='fourslash.ts' />
|
|
|
|
// Cannot extract globally-declared functions or
|
|
// those with non-selected local references
|
|
|
|
//// /*f1a*/function f() {
|
|
//// /*g1a*/function g() { }
|
|
//// g();/*g1b*/
|
|
//// g();
|
|
//// }/*f1b*/
|
|
|
|
goTo.select('f1a', 'f1b');
|
|
verify.not.refactorAvailable('Extract Symbol');
|
|
goTo.select('g1a', 'g1b');
|
|
verify.not.refactorAvailable('Extract Symbol');
|
|
|