### Godot version

4.0.2

### System information

Windows 11

### Issue description

Double clicking on `$MyNode` in the script editor will select the whole name including the "$".

But double clicking on `%MyNode` (unique name) will select the name but will not include the "%".

Dragging a node from the scene tree into the script editor brings up the property/method hint list, even though a "." has not been typed. Pressing enter appends "new()" even though this makes no sense as there is no period so it is just appending it directly to the node name: `$MyNodenew()`


### Steps to reproduce

Type `%MyNode` in a script and double click on it.

Type `@onready var x =` in a script, drag a node from the scene tree, then press enter.


### Minimal reproduction project

N/A
}
			if (is_in_string(i) == -1 && is_in_comment(i) == -1) {
				break;
			}
		}
	}
	for (int i = p_line + 1; i <= end_line; i++) {
		_set_line_as_hidden(i, true);
	}
	for (int i = 0; i < get_caret_count(); i++) {
		
		if (has_selection(i)) {
			if (_is_line_hidden(get_selection_from_line(i)) && _is_line_hidden(get_selection_to_line(i))) {
				deselect(i);
			} else if (_is_line_hidden(get_selection_from_line(i))) {
				select(p_line, 9999, get_selection_to_line(i), get_selection_to_column(i), i);
			} else if (_is_line_hidden(get_selection_to_line(i))) {
				select(get_selection_from_line(i), get_selection_from_column(i), p_line, 9999, i);
			}
		}
		
		if (_is_line_hidden(get_caret_line(i))) {
			set_caret_line(p_line, false, false, 0, i);
			set_caret_column(get_line(p_line).length(), false, i);
		}
	}
	merge_overlapping_carets();
	queue_redraw();
}
void CodeEdit::unfold_line(int p_line) {