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
Implemtation of VSCode RenameProvider for variable/function renaming #2152
Open
Razmo99
wants to merge
116
commits into
PowerShell:main
Choose a base branch
from
Razmo99:rename-function-customvisitor
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…zmo99/PowerShellEditorServices into rename-function-customvisitor
…zmo99/PowerShellEditorServices into rename-function-customvisitor
3 tasks
Razmo99
changed the title
WIP: Implemtation of VSCode RenameProvider for variable/function renaming
Implemtation of VSCode RenameProvider for variable/function renaming
Mar 25, 2024
andyleejordan
force-pushed
the
main
branch
2 times, most recently
from
May 3, 2024 23:07
caa9e27
to
677f42c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
This is a sister pull request to pr #4950 and issue Smart Variable Rename. It implements the server side component to allow refactoring of Powershell functions and variables.
It does this by implementing two new handlers
RenameSymbolHandler
andPrepareRenameSymbolHandler
which is just plumbing to receive the incoming requests from the client.PrepareRenameSymbolHandler
is used to determine if the rename is possible andRenameSymbolHandler
is what actually returns the edits to the client.All the action to decide what is renamed is done within two classes
IterativeFunctionRename
andIterativeVariableRename
to boil it down the Abstract Syntax Tree(AST) of the script file is analyzed, then the symbol at the target line and column is retrieved. It then loops through the AST following rules to determine scope and what to rename. This is then passed back to the client to action.Below are the current features
Below are the current limitations
Tests to cover as many scenarios as I could think of and to ensure the features described above function have been written
PR Context
This pull request should be helpful as its implementing a feature that I think has been desired for some time among Powershell developers. It should improve coding efficiency and allow code to be refactored with ease.