Skip to content

Fix VS Code extract function refactoring#171

Merged
adamdriscoll merged 1 commit into
mainfrom
adamdriscoll-fix-vscode-refactoring
Jul 21, 2026
Merged

Fix VS Code extract function refactoring#171
adamdriscoll merged 1 commit into
mainfrom
adamdriscoll-fix-vscode-refactoring

Conversation

@adamdriscoll

Copy link
Copy Markdown
Member

The VS Code extract-function refactor produced poorly formatted functions and duplicate or missing parameters for selected PowerShell blocks. This updates extraction to preserve the selected block's base indentation, indent the generated function body consistently, and derive parameters from variables that are read before being assigned within the selection.

The parameter generation now de-duplicates variables, ignores common automatic variables, includes read-before-write assignment cases, and adds simple type hints when the AST makes them clear, such as string comparisons, casts, and path arguments. Regression tests cover the reported indented selection scenario and update the existing extract-function expectations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@adamdriscoll
adamdriscoll merged commit a55c3b2 into main Jul 21, 2026
1 check passed
@adamdriscoll
adamdriscoll deleted the adamdriscoll-fix-vscode-refactoring branch July 21, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant