-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Test for action description of code actions, and simplify description for extracting method to file #18030
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
Test for action description of code actions, and simplify description for extracting method to file #18030
Changes from 1 commit
a7e7388
613de15
34b46c7
fd78f1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -560,32 +560,32 @@ namespace ts.refactor.extractMethod { | |
return "constructor"; | ||
case SyntaxKind.FunctionExpression: | ||
return scope.name | ||
? `function expression ${scope.name.getText()}` | ||
? `function expression ${scope.name.text}` | ||
: "anonymous function expression"; | ||
case SyntaxKind.FunctionDeclaration: | ||
return `function ${scope.name.getText()}`; | ||
return `function '${scope.name.text}'`; | ||
case SyntaxKind.ArrowFunction: | ||
return "arrow function"; | ||
case SyntaxKind.MethodDeclaration: | ||
return `method ${scope.name.getText()}`; | ||
return `method '${scope.name.getText()}`; | ||
case SyntaxKind.GetAccessor: | ||
return `get ${scope.name.getText()}`; | ||
return `'get ${scope.name.getText()}'`; | ||
case SyntaxKind.SetAccessor: | ||
return `set ${scope.name.getText()}`; | ||
return `'set ${scope.name.getText()}'`; | ||
} | ||
} | ||
else if (isModuleBlock(scope)) { | ||
return `namespace ${scope.parent.name.getText()}`; | ||
return `namespace '${scope.parent.name.getText()}'`; | ||
} | ||
else if (isClassLike(scope)) { | ||
return scope.kind === SyntaxKind.ClassDeclaration | ||
? `class ${scope.name.text}` | ||
? `class '${scope.name.text}'` | ||
: scope.name.text | ||
? `class expression ${scope.name.text}` | ||
? `class expression '${scope.name.text}'` | ||
: "anonymous class expression"; | ||
} | ||
else if (isSourceFile(scope)) { | ||
return `file '${scope.fileName}'`; | ||
return "this file"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about "file scope" or "top-level scope"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this should be "global scope" for a global and "module scope" for a module? @DanielRosenwasser thoughts? |
||
} | ||
else { | ||
return "unknown"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
//// (x => x)(/*1*/x => x/*2*/)(1); | ||
//// (x => x)(/*1*/x => x/*2*/)(1); | ||
|
||
goTo.select('1', '2'); | ||
edit.applyRefactor('Extract Method', 'scope_0'); | ||
edit.applyRefactor({ | ||
refactorName: "Extract Method", | ||
actionName: 'scope_0', | ||
actionDescription: "Extract function into this file", | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the actual number.