From 891d65dc876be6b79d825f57bccf96d969f00403 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Tue, 22 Mar 2022 18:10:47 +0100 Subject: [PATCH] Add utility to editor CodeDocs for tooltips from C# types and members --- .../SourceCodeEditing/CodeDocsModule.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Source/Editor/Modules/SourceCodeEditing/CodeDocsModule.cs b/Source/Editor/Modules/SourceCodeEditing/CodeDocsModule.cs index 3f8d8012f..7042dfb92 100644 --- a/Source/Editor/Modules/SourceCodeEditing/CodeDocsModule.cs +++ b/Source/Editor/Modules/SourceCodeEditing/CodeDocsModule.cs @@ -27,6 +27,17 @@ namespace FlaxEditor.Modules.SourceCodeEditing { } + /// + /// Gets the tooltip text for the type. + /// + /// The type. + /// The type attributes. Optional, if null type attributes will be used. + /// The documentation tooltip. + public string GetTooltip(Type type, object[] attributes = null) + { + return GetTooltip(new ScriptType(type), attributes); + } + /// /// Gets the tooltip text for the type. /// @@ -62,6 +73,19 @@ namespace FlaxEditor.Modules.SourceCodeEditing return text; } + /// + /// Gets the tooltip text for the type member. + /// + /// The type. + /// The member name. + /// The member attributes. Optional, if null member attributes will be used. + /// The documentation tooltip. + public string GetTooltip(Type type, string memberName, object[] attributes = null) + { + var member = new ScriptType(type).GetMember(memberName, MemberTypes.All, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); + return GetTooltip(member, attributes); + } + /// /// Gets the tooltip text for the type member. ///