-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed as not planned
Closed as not planned
Copy link
Labels
7.0 LS MigrationBugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do this
Description
Today, you can request "Extract..." refactorings on the left side of a chain of multiplications:
function multiply(a: number, b: number, c: number) {
return [|a * b|] * c;
}Most people consider * to be associative (even if it's not for IEEE-754 numbers). Unfortunately we strictly allow you to refactor expressions as-parsed, so the following doesn't work:
function multiply(a: number, b: number, c: number) {
return a * [|b * c|];
}Expected: Extract constant/function work on b * c
Actual:
{
"name": "Extract Symbol",
"description": "Extract function",
"actions": [
{
"name": "Extract Function",
"description": "Extract function",
"kind": "refactor.extract.function",
"notApplicableReason": "Cannot extract range."
}
]
},
{
"name": "Extract Symbol",
"description": "Extract constant",
"actions": [
{
"name": "Extract Constant",
"description": "Extract constant",
"kind": "refactor.extract.constant",
"notApplicableReason": "Cannot extract range."
}
]
},mjbvz
Metadata
Metadata
Assignees
Labels
7.0 LS MigrationBugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do this