### 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
from_selections.write[c].first = get_selection_from_line(c);
		from_selections.write[c].second = get_selection_from_column(c);
		to_selections.write[c].first = get_selection_to_line(c);
		to_selections.write[c].second = get_selection_to_column(c);
	}
	
	const char32_t from_indent_char = indent_using_spaces ? '\t' : ' ';
	int size_diff = indent_using_spaces ? indent_size - 1 : -(indent_size - 1);
	bool changed_indentation = false;
	for (int i = p_from_line; i <= p_to_line; i++) {
		String line = get_line(i);
		if (line.length() <= 0) {
			continue;
		}
		
		int j = 0;
		int space_count = 0;
		bool line_changed = false;
		while (j < line.length() && (line[j] == ' ' || line[j] == '\t')) {
			if (line[j] != from_indent_char) {
				space_count = 0;
				j++;
				continue;
			}
			space_count++;
			if (!indent_using_spaces && space_count != indent_size) {
				j++;
				continue;
			}
			line_changed = true;