### Godot version

v4.0.beta.custom_build [0abd60b95]

### System information

Windows 10, Vulkan

### Issue description

Autocomplete doesn't work when trying to access a scene node that isn't a direct child of the scene root script, using $NodePath (Shorthand for get_node("NodePath") as per docs).

Example:
![image](https://user-images.githubusercontent.com/115422160/212197922-10e73c9f-de10-475e-ac6e-4163fc5b8013.png)

It worked in Godot 3.5:
![3.5](https://user-images.githubusercontent.com/115422160/212197992-61b67a42-86c6-4650-bab4-c7dfa5a67975.PNG)

I should mention that it works if you start by typing the name of a direct child:
![image](https://user-images.githubusercontent.com/115422160/212198641-6d8e6fca-a2d2-47a7-b627-2df95268daf5.png)

But when you have many nodes in the scene and longer names it's a pain to access the last children like that.


### Steps to reproduce

See above or MRP.

### Minimal reproduction project

[autocomplete bug.zip](https://github.com/godotengine/godot/files/10406695/autocomplete.bug.zip)

int match_offset = font->get_string_size(code_completion_options[l].display.substr(0, match.first), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).width;
						int match_len = font->get_string_size(code_completion_options[l].display.substr(match.first, match.second), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).width;
						draw_rect(Rect2(match_pos + Point2(match_offset, 0), Size2(match_len, row_height)), code_completion_existing_color);
					}
					tl->draw(ci, title_pos, code_completion_options[l].font_color);
				}
				
				if (scroll_width) {
					Color scroll_color = is_code_completion_scroll_hovered || is_code_completion_scroll_pressed ? code_completion_scroll_hovered_color : code_completion_scroll_color;
					float r = (float)code_completion_max_lines / code_completion_options_count;
					float o = (float)code_completion_line_ofs / code_completion_options_count;
					draw_rect(Rect2(code_completion_rect.position.x + code_completion_rect.size.width, code_completion_rect.position.y + o * code_completion_rect.size.y, scroll_width, code_completion_rect.size.y * r), scroll_color);
				}
			}
			
			if (caret_visible && !code_hint.is_empty() && (!code_completion_active || (code_completion_below != code_hint_draw_below))) {
				const int font_height = font->get_height(font_size);
				Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel"));
				Color color = get_theme_color(SNAME("font_color"), SNAME("TooltipLabel"));
				Vector<String> code_hint_lines = code_hint.split("\n");
				int line_count = code_hint_lines.size();
				int max_width = 0;
				for (int i = 0; i < line_count; i++) {
					max_width = MAX(max_width, font->get_string_size(code_hint_lines[i], HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x);
				}
				Size2 minsize = sb->get_minimum_size() + Size2(max_width, line_count * font_height + (line_spacing * line_count - 1));
				int offset = font->get_string_size(code_hint_lines[0].substr(0, code_hint_lines[0].find(String::chr(0xFFFF))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x;
				if (code_hint_xpos == -0xFFFF) {
					code_hint_xpos = get_caret_draw_pos().x - offset;
				}