|
@@ -488,15 +488,21 @@ func f():
|
|
|
REQUIRE(proto);
|
|
|
|
|
|
SUBCASE("selectionRange of root class must be inside range") {
|
|
|
- String path = "res://lsp/first_line_comment.gd";
|
|
|
- assert_no_errors_in(path);
|
|
|
- GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_local_script(path);
|
|
|
- ExtendGDScriptParser *parser = GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_results[path];
|
|
|
- REQUIRE(parser);
|
|
|
- lsp::DocumentSymbol cls = parser->get_symbols();
|
|
|
-
|
|
|
- REQUIRE(((cls.range.start.line == cls.selectionRange.start.line && cls.range.start.character <= cls.selectionRange.start.character) || (cls.range.start.line < cls.selectionRange.start.line)));
|
|
|
- REQUIRE(((cls.range.end.line == cls.selectionRange.end.line && cls.range.end.character >= cls.selectionRange.end.character) || (cls.range.end.line > cls.selectionRange.end.line)));
|
|
|
+ LocalVector<String> paths = {
|
|
|
+ "res://lsp/first_line_comment.gd", // Comment on first line
|
|
|
+ "res://lsp/first_line_class_name.gd", // class_name (and thus selection range) before extends
|
|
|
+ };
|
|
|
+
|
|
|
+ for (const String &path : paths) {
|
|
|
+ assert_no_errors_in(path);
|
|
|
+ GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_local_script(path);
|
|
|
+ ExtendGDScriptParser *parser = GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_results[path];
|
|
|
+ REQUIRE(parser);
|
|
|
+ lsp::DocumentSymbol cls = parser->get_symbols();
|
|
|
+
|
|
|
+ REQUIRE(((cls.range.start.line == cls.selectionRange.start.line && cls.range.start.character <= cls.selectionRange.start.character) || (cls.range.start.line < cls.selectionRange.start.line)));
|
|
|
+ REQUIRE(((cls.range.end.line == cls.selectionRange.end.line && cls.range.end.character >= cls.selectionRange.end.character) || (cls.range.end.line > cls.selectionRange.end.line)));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
memdelete(proto);
|