From cb1324fc2ddb582b35567f5879c5a5fbce263af8 Mon Sep 17 00:00:00 2001 From: Nils Hausfeld Date: Wed, 19 Jun 2024 20:56:25 +0200 Subject: [PATCH] - Now removing tags from tooltips - Capitalizing the first character of inputs/outpus - Removing & chars from input/output types to make it easier to read - Moving description signature down to make items without a description look less ugly --- .../Modules/SourceCodeEditing/CodeDocsModule.cs | 4 +++- Source/Editor/Surface/ContextMenu/VisjectCM.cs | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Source/Editor/Modules/SourceCodeEditing/CodeDocsModule.cs b/Source/Editor/Modules/SourceCodeEditing/CodeDocsModule.cs index 610368a82..a26fe9924 100644 --- a/Source/Editor/Modules/SourceCodeEditing/CodeDocsModule.cs +++ b/Source/Editor/Modules/SourceCodeEditing/CodeDocsModule.cs @@ -316,7 +316,9 @@ namespace FlaxEditor.Modules.SourceCodeEditing var memberReader = xmlReader.ReadSubtree(); if (memberReader.ReadToDescendant("summary")) { - result[rawName] = memberReader.ReadInnerXml().Replace('\n', ' ').Trim(); + // Remove and replace them with the captured group (the content of the cref). Additionally, getting rid of prefixes + const string crefPattern = @""; + result[rawName] = Regex.Replace(memberReader.ReadInnerXml(), crefPattern, "$1").Replace('\n', ' ').Trim(); } } } diff --git a/Source/Editor/Surface/ContextMenu/VisjectCM.cs b/Source/Editor/Surface/ContextMenu/VisjectCM.cs index 2ebdc1c3b..b30e726dd 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCM.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCM.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Text.RegularExpressions; using FlaxEditor.GUI.ContextMenu; using FlaxEditor.GUI.Input; using FlaxEditor.Scripting; @@ -897,8 +898,17 @@ namespace FlaxEditor.Surface.ContextMenu float panelHeight = _descriptionSignatureLabel.Height; - _descriptionLabel.Y = _descriptionSignatureLabel.Bounds.Bottom + 6f; - _descriptionLabel.Text = archetype.Description; + if (string.IsNullOrEmpty(archetype.Description)) + { + _descriptionSignatureLabel.Y = 15; + _descriptionLabel.Text = ""; + } + else + { + _descriptionSignatureLabel.Y = 8; + _descriptionLabel.Y = _descriptionSignatureLabel.Bounds.Bottom + 6f; + _descriptionLabel.Text = Regex.Replace(archetype.Description, @"\s{2,}", "\n"); + } _descriptionPanelSeparator.Y = _descriptionLabel.Bounds.Bottom + 8f; @@ -938,7 +948,8 @@ namespace FlaxEditor.Surface.ContextMenu MouseOverColor = typeColor, AutoFocus = false, }).SetAnchorPreset(AnchorPresets.TopLeft, true); - + + text = (char.ToUpper(text[0]) + text.Substring(1)).Replace("&", ""); var elementText = new Label(16, 0, Width * 0.5f - 32, 16) { Text = text,