Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Src/Common/Controls/DetailControls/Slice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ public virtual void GenerateChildren(XmlNode node, XmlNode caller, ICmObject obj
// || (fUseChildrenOfNode && XmlUtils.GetOptionalAttributeValue(node, "expansion") == "expanded")
// || (XmlUtils.GetOptionalAttributeValue(caller, "expansion") == "expanded")
// || Expansion == DataTree.TreeItemState.ktisCollapsedEmpty)
bool fExpand = XmlUtils.GetOptionalAttributeValue(node, "expansion") == "expanded";
bool fExpand = XmlUtils.GetOptionalAttributeValue(node, "expansion") != "doNotExpand";
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string literal "doNotExpand" is a protocol value that’s easy to mistype and hard to discover/refactor. Consider centralizing it as a named constant (or using an enum-like pattern) and, if this value is intended to be case-insensitive in XML, using an explicit StringComparison to make that contract clear.

Suggested change
bool fExpand = XmlUtils.GetOptionalAttributeValue(node, "expansion") != "doNotExpand";
const string DoNotExpandExpansionValue = "doNotExpand";
bool fExpand = XmlUtils.GetOptionalAttributeValue(node, "expansion") != DoNotExpandExpansionValue;

Copilot uses AI. Check for mistakes.
if (fUsePersistentExpansion && m_mediator != null) // mediator null only in testing?
{
Expansion = DataTree.TreeItemState.ktisCollapsed; // Needs to be an expandable state to have ExpansionStateKey.
Expand Down
Loading