### 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)

set_gutter_draw(line_number_gutter, p_draw);
}
bool CodeEdit::is_draw_line_numbers_enabled() const {
	return is_gutter_drawn(line_number_gutter);
}
void CodeEdit::set_line_numbers_zero_padded(bool p_zero_padded) {
	p_zero_padded ? line_number_padding = "0" : line_number_padding = " ";
	queue_redraw();
}
bool CodeEdit::is_line_numbers_zero_padded() const {
	return line_number_padding == "0";
}
void CodeEdit::_line_number_draw_callback(int p_line, int p_gutter, const Rect2 &p_region) {
	String fc = String::num(p_line + 1).lpad(line_number_digits, line_number_padding);
	if (is_localizing_numeral_system()) {
		fc = TS->format_number(fc);
	}
	Ref<TextLine> tl;
	tl.instantiate();
	tl->add_string(fc, font, font_size);
	int yofs = p_region.position.y + (get_line_height() - tl->get_size().y) / 2;
	Color number_color = get_line_gutter_item_color(p_line, line_number_gutter);
	if (number_color == Color(1, 1, 1)) {
		number_color = line_number_color;
	}
	tl->draw(get_canvas_item(), Point2(p_region.position.x, yofs), number_color);
}
void CodeEdit::set_draw_fold_gutter(bool p_draw) {