### 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
int offset = theme_cache.font->get_string_size(code_hint_lines[0].substr(0, code_hint_lines[0].find(String::chr(0xFFFF))), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).x;
				if (code_hint_xpos == -0xFFFF) {
					code_hint_xpos = get_caret_draw_pos().x - offset;
				}
				Point2 hint_ofs = Vector2(code_hint_xpos, get_caret_draw_pos().y);
				if (code_hint_draw_below) {
					hint_ofs.y += theme_cache.line_spacing / 2.0f;
				} else {
					hint_ofs.y -= (minsize.y + row_height) - theme_cache.line_spacing;
				}
				draw_style_box(theme_cache.code_hint_style, Rect2(hint_ofs, minsize));
				int yofs = 0;
				for (int i = 0; i < line_count; i++) {
					const String &line = code_hint_lines[i];
					int begin = 0;
					int end = 0;
					if (line.contains(String::chr(0xFFFF))) {
						begin = theme_cache.font->get_string_size(line.substr(0, line.find(String::chr(0xFFFF))), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).x;
						end = theme_cache.font->get_string_size(line.substr(0, line.rfind(String::chr(0xFFFF))), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).x;
					}
					Point2 round_ofs = hint_ofs + theme_cache.code_hint_style->get_offset() + Vector2(0, theme_cache.font->get_ascent(theme_cache.font_size) + font_height * i + yofs);
					round_ofs = round_ofs.round();
					draw_string(theme_cache.font, round_ofs, line.replace(String::chr(0xFFFF), ""), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size, theme_cache.code_hint_color);
					if (end > 0) {
						
						const Vector2 b = hint_ofs + theme_cache.code_hint_style->get_offset() + Vector2(begin, font_height + font_height * i + yofs);
						draw_line(b, b + Vector2(end - begin, 0), theme_cache.code_hint_color, 2);
						
						const Rect2 highlight_rect = Rect2(
								b - Vector2(0, font_height),