microsoft / microsoft/TypeScript
Extract Constant Refactoring: Add way to extract all instances of selected expression
オープン
まだ誰も着手していません。
Awaiting More Feedback
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
From https://github.com/microsoft/vscode/issues/85507
Search Terms
- refactor
- extract
- extract constant / extract function
Suggestion
For the code:
function doStuff() {
console.log('hello')
console.log('hi')
console.log('hello')
}
If I run extract constant on the string 'hello'`, it'd be nice if we offered a way to extract all instances of that expression in the current scope. This would turn the code into:
function doStuff() {
const text = 'hello'
console.log(text)
console.log('hi')
console.log(text)
}
Use Cases
- Help reducing duplicated code
- Speed up code cleanup
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、元の VS Code issue #85507 と TypeScript のリファクタリング実装を確認します。payload にはソースファイルもテストのエントリポイントも記載されていません。現在のスコープ内にある一致するすべての式を抽出する動作を定義し、その後、例によって 1 つの定数が生成され、一致する両方の出現箇所が置き換えられることを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- developer-experience, tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100