You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #107315 from HolonProduction/lsp-brief-fix
LSP: Fix class documentation to include brief
This commit is contained in:
@@ -253,7 +253,7 @@ void ExtendGDScriptParser::parse_class_symbol(const GDScriptParser::ClassNode *p
|
||||
}
|
||||
r_symbol.detail = "class " + r_symbol.name;
|
||||
{
|
||||
String doc = p_class->doc_data.description;
|
||||
String doc = p_class->doc_data.brief;
|
||||
if (!p_class->doc_data.description.is_empty()) {
|
||||
doc += "\n\n" + p_class->doc_data.description;
|
||||
}
|
||||
|
||||
7
modules/gdscript/tests/scripts/lsp/doc_comments.gd
Normal file
7
modules/gdscript/tests/scripts/lsp/doc_comments.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
## brief
|
||||
##
|
||||
## description
|
||||
##
|
||||
## @tutorial(t1): https://example.com/t2
|
||||
## @tutorial: https://example.com/t3
|
||||
extends Node
|
||||
@@ -509,6 +509,20 @@ func f():
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("Documentation is correctly set") {
|
||||
String path = "res://lsp/doc_comments.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.documentation.contains("brief"));
|
||||
REQUIRE(cls.documentation.contains("description"));
|
||||
REQUIRE(cls.documentation.contains("t1"));
|
||||
REQUIRE(cls.documentation.contains("t2"));
|
||||
REQUIRE(cls.documentation.contains("t3"));
|
||||
}
|
||||
|
||||
memdelete(proto);
|
||||
finish_language();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user