- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 23.5k
 
[GDScript] Add refactor rename symbol functionality #102380
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
base: master
Are you sure you want to change the base?
Conversation
96f6d0b    to
    85aed63      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really hoping this becomes a thing! I'm terrible with naming things correctly on my first pass.
1ce9d14    to
    d093dcb      
    Compare
  
    9a7d2b6    to
    fa91b69      
    Compare
  
    
          
 class Test:
	pass
var with_type: Test
 # a.gd
extends Node
class_name Test1
const SIZE_EXPAND = 1
static var USUAL = 2# b.gd
extends Node
func ready(delta: float) -> void:
	Test1.SIZE_EXPAND # Renaming SIZE_EXPAND will modify b.gd but not a.gd
	Test1.USUAL # Renaming USUAL will modify a.gd but not b.gd
	passWithout having looked at the implementation: Collecting all usages and replacing them needs to happen in two passes, or the change might destroy references that can not be found anymore. 
 extends Node
var delta: float # Renaming delta will rename the parameter name as well but not the usages
func test(delta: float): # Renaming delta will change the occurence in print but not the standalone occurence
	print(delta) # Renaming delta will change the parameter name but not the standalone occurence
	delta # Renaming delta will change the parameter name and the occurence in print but not the standalone occurence
 | 
    
| 
           Could a 'Match Case' functionality be considered for this? Something like renaming   | 
    
          
 I don't understand.  | 
    
          
 See IntelliJ IDEA for example. If you rename the class  Beforeclass_name MyClass
[...]
var my_class = MyClass.new()Afterclass_name YourClass
[...]
var your_class = YourClass.new() | 
    
- Add `GDScriptTokenizer::CodeArea` - Add `GDScriptParser::get_token(int p_line, int p_column)`
…specific()` Add check for `refactor_rename_context.node == nullptr`
- This add granular overlap checks for start or end
4ebaae9    to
    533d479      
    Compare
  
    
Warning
For this moment, this PR is public for testing purposes. Work is still done to it to iron out issues.Use at your own risk AND always backup before trying out new features.This PR adds the refactor rename symbol functionality to the GDScript code editor inside the Godot editor.
To use this feature, just click on the desired symbol to rename and press F2 on your keyboard. You can also use the contextual menu (right click) or use the entry in the Edit menu.
Fixes godotengine/godot-proposals#899