godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.54k stars 163 forks source link

Renaming a variable doesn't Rename othe instances #577

Closed mifth closed 8 months ago

mifth commented 8 months ago

Godot version

4.2

VS Code version

1.85.2

Godot Tools VS Code extension version

1.3.1

System information

Windows 11

Issue description

I have this function:

func _check_default_live_text(node_to_check: NodeData, live_node_js):
    if node_to_check.node_class_key in DCGUtils.live_nodes_types and node_to_check.to_node_conns:
        for port_id in node_to_check.to_node_conns.keys():
            var port_type = get_input_port_type(live_node_js, port_id)

            if port_type == 1:
                var port_conns = node_to_check.to_node_conns[port_id]

                for conn_ids in port_conns:
                    var conn = get_connections_js()[conn_ids]
                    var from_node = self.nodes_by_name[conn["from_node"]] as NodeData

                    if from_node.node_class_key == DCGUtils.TextNode:
                        var from_node_js = get_node_js(from_node) 
                        var from_text_slot = get_text_slot_by_port(from_node, from_node_js, conn["from_port"], false)

                        var to_text_slot = get_text_slot_by_port(node_to_check, live_node_js, port_id, true)

                        if from_text_slot and to_text_slot:
                            to_text_slot["LiveText"] = from_text_slot["Text"]

                        break

                    elif from_node.node_class_key == DCGUtils.RerouteTextNode:
                        if from_node.to_node_conns:
                            var prev_con_id = from_node.to_node_conns[0][0]
                            get_connections_js()[prev_con_id]

If I try to rename(F2) a variable "prev_con_id" then only one variable instance will be renamed.

image

image

image

Steps to reproduce

Try to rename "prev_con_id" variable.

DaelonSuzuka commented 8 months ago

This extension doesn't provide that feature, it comes from the Language Server that's running in the Godot Engine. You need to open an issue in the Godot Engine repo.

FWIW I did get the same problem you're reporting. Interestingly, F2 rename does successfully work on several other symbols in your example.

mifth commented 8 months ago

@DaelonSuzuka thanks. Should I report here? https://github.com/godotengine/godot/issues

DaelonSuzuka commented 8 months ago

Yeah.