PowerShell / PowerShell/vscode-powershell

Code refactoring such as inline or extract as function

Open
#5,009 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Code Formatting Feature: VS Code Issue-Enhancement Up for Grabs
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
Summary

Add code refactoring features to improve code maintainability and readability. Specifically, allow users to inline variables or extract code blocks into separate functions.

Proposed Design

Inline Variable Refactoring:
Provide an option to inline variables directly where they are used.
When selecting a variable, the user can trigger the refactoring action to replace all occurrences of that variable with its value.
This helps reduce clutter and makes the code more concise.
Extract as Function Refactoring:
Allow users to select a code block (e.g., a series of statements) and extract it into a separate function.
The user can specify the function name, parameters, and return type.
The extracted function should be added to the script/module, and the original code replaced with a function call.
This promotes code reusability and modularization.

note
there might be possibility to include the module FriedrichWeinmann/Refactor
/
Refactor

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named in the issue. Start by locating the extension's existing refactoring or code-action support, then review the linked FriedrichWeinmann/Refactor module as a possible dependency. Done means both inline-variable and extract-function actions are implemented with the requested selection, naming, parameter, and return-type behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.