@@ -375,6 +375,18 @@ func f():
375
375
gd.to_lsp (lines);
376
376
}
377
377
378
+ SUBCASE (" special case: zero column for root class" ) {
379
+ GodotPosition gd (1 , 0 );
380
+ lsp::Position expected = lsp_pos (0 , 0 );
381
+ lsp::Position actual = gd.to_lsp (lines);
382
+ CHECK_EQ (actual, expected);
383
+ }
384
+ SUBCASE (" special case: zero line and column for root class" ) {
385
+ GodotPosition gd (0 , 0 );
386
+ lsp::Position expected = lsp_pos (0 , 0 );
387
+ lsp::Position actual = gd.to_lsp (lines);
388
+ CHECK_EQ (actual, expected);
389
+ }
378
390
SUBCASE (" special case: negative line for root class" ) {
379
391
GodotPosition gd (-1 , 0 );
380
392
lsp::Position expected = lsp_pos (0 , 0 );
@@ -468,6 +480,25 @@ func f():
468
480
test_resolve_symbols (uri, all_test_data, all_test_data);
469
481
}
470
482
483
+ memdelete (proto);
484
+ finish_language ();
485
+ }
486
+ TEST_CASE (" [workspace][document_symbol]" ) {
487
+ GDScriptLanguageProtocol *proto = initialize (root);
488
+ REQUIRE (proto);
489
+
490
+ SUBCASE (" selectionRange of root class must be inside range" ) {
491
+ String path = " res://lsp/first_line_comment.gd" ;
492
+ assert_no_errors_in (path);
493
+ GDScriptLanguageProtocol::get_singleton ()->get_workspace ()->parse_local_script (path);
494
+ ExtendGDScriptParser *parser = GDScriptLanguageProtocol::get_singleton ()->get_workspace ()->parse_results [path];
495
+ REQUIRE (parser);
496
+ lsp::DocumentSymbol cls = parser->get_symbols ();
497
+
498
+ 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 )));
499
+ 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 )));
500
+ }
501
+
471
502
memdelete (proto);
472
503
finish_language ();
473
504
}
0 commit comments