Fix LT-22427: Show Hidden Fields reveals Inflection Class/Features in Lexicon Edit#690
Fix LT-22427: Show Hidden Fields reveals Inflection Class/Features in Lexicon Edit#690johnml1135 wants to merge 3 commits intomainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Fixes LT-22427 by ensuring “Show Hidden Fields” is keyed consistently to the active tool name when rendering Lexicon entry details, preventing visibility="ifdata" slices (e.g., “Inflection Features”) from being incorrectly hidden.
Changes:
- Introduced
GetShowHiddenFieldsToolName(...)inDataTreeand applied it acrossShowObject(),OnDisplayShowHiddenFields(), andOnPropertyChanged("ShowHiddenFields")to unify tool-name resolution. - Added regression + coverage tests around tool-specific show-hidden behavior and fallback behavior for
ILexEntry. - Updated VS Code/worktree workspace settings to open
FieldWorks.slnmore deterministically (ReSharper + dotnet settings).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
Src/Common/Controls/DetailControls/DataTree.cs |
Unifies show-hidden tool name resolution via a helper and applies it at all relevant call sites. |
Src/Common/Controls/DetailControls/DetailControlsTests/DataTreeTests.cs |
Adds tests covering the regression and the three previously-inconsistent code paths. |
scripts/Setup-WorktreeColor.ps1 |
Adds managed workspace settings for solution opening behavior in generated worktree workspaces. |
.vscode/settings.json |
Adjusts ReSharper solution auto-open behavior to avoid reopening stale solutions when switching worktrees. |
a30736b to
b1c80fc
Compare
|
@johnml1135 @copilot doesn't seem to have identified the true root cause and is instead adding a hack to fix the issue. |
|
@jasonleenaylor I've opened a new pull request, #701, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
|
||
| // ifdata slices should now be visible. | ||
| Assert.That(m_dtree.Controls.Count, Is.EqualTo(2), "After toggle: ifdata slice should appear"); | ||
| Assert.That((m_dtree.Controls[1] as Slice).Label, Is.EqualTo("Bibliography")); |
papeh
left a comment
There was a problem hiding this comment.
Oops, didn't see @jasonleenaylor's comment before approving. Rescinding my approval.
Unify DataTree show-hidden key resolution across ShowObject, menu display, and property change handling. Use currentContentControl when present; fall back to lexiconEdit for LexEntry. Add regression tests for LexEntry ifdata slice visibility when show-hidden is enabled for the active tool. Add commit-messages.instructions.md for agent guidance.
New skill orchestrates the full JIRA bugfix lifecycle: fetch issue, assign, branch, TDD, fix, assess coverage, devil's advocate review, update AGENTS.md, commit, PR, and update JIRA. Includes a devil's advocate step that critically reviews the fix and surfaces uncertainties for user decision. Register the skill in both AGENTS.md files.
When Show Hidden Fields is enabled for Lexicon Edit, bypass the SliceFilter so fields hidden by IsFieldRelevant (e.g. InflectionClass with no POS) still appear. Auto-expand parent slices whose children were previously all hidden, so newly visible fields are not trapped behind a collapsed parent. This also fixes Attaches to Categories (visibility= always) being hidden when the Category Info parent stayed collapsed because all its ifdata siblings had no data. Remove unreachable dead-code branch in GetShowHiddenFieldsToolName. Add unit tests for SliceFilter bypass and parent auto-expand.

Fix LT-22427: Show Hidden Fields in Lexicon Edit
Problem
When Show Hidden Fields was enabled in Lexicon Edit, the
visibility="ifdata"fields under Grammatical Info. Details — Inflection Class, Inflection Features, and Exception "Features" — did not appear, even though they should become visible when the user toggles this option.Additionally, "Attaches to Categories" (
visibility="always") was also hidden because its parent section stayed collapsed.Root Causes (three independent issues)
1. Inconsistent property key resolution
GetShowHiddenFieldsToolName()did not normalize the key for ILexEntry roots. WhencurrentContentControlwas"lexiconBrowse"or"lexiconDictionary", the show-hidden toggle would write to the wrong property key, making it ineffective.2. SliceFilter blocking fields even with Show Hidden Fields ON
ProcessSubpartNodechecked theSliceFilter(which callsIsFieldRelevant) unconditionally. When no POS was set,IsFieldRelevantreturned false for InflectionClass, hiding it even when the user explicitly asked to see hidden fields.3. Parent slices staying collapsed
The "Category Info." parent slice (an
MSADlgLauncherSlice) had noexpansion="expanded"XML attribute and no persisted expansion state. When all itsifdatachildren were hidden (no data), the parent collapsed toktisFixed. Even after fixes 1 & 2 made the children logically visible, the parent never expanded to show them. This also hid "Attaches to Categories" (visibility="always"), which should always have been visible when the parent is expanded.Fixes
Commit 1:
GetShowHiddenFieldsToolNameunification (b1c80fc)Introduced a single helper that normalizes the property key to
"lexiconEdit"for all ILexEntry roots, regardless ofcurrentContentControl. Applied acrossShowObject,OnDisplayShowHiddenFields, andOnPropertyChanged.Commit 2: SliceFilter bypass + parent auto-expand (f4f84a9)
!m_fShowAllFields &&guard before theSliceFiltercheck inProcessSubpartNode. When Show Hidden Fields is ON, the filter is bypassed so fields hidden byIsFieldRelevantstill appear.Slice.GenerateChildren, whenShowingAllFieldsis true, forcefExpand = trueso parent slices expand to reveal their now-visible children.if (candidateRoot is ILexEntry)fallback inGetShowHiddenFieldsToolName."lexiconEdit".Why "Attaches to Categories" now appears
FromPartsOfSpeechis defined withvisibility="always"in the MoStemMsa Normal layout — it was never a hidden field. It was invisible only because its parent (Category Info.) stayed collapsed when all itsifdatasiblings had no data. The auto-expand fix correctly reveals it alongside the hidden fields. This is correct behavior.Files Changed
Src/Common/Controls/DetailControls/DataTree.csProcessSubpartNode; dead code removal + comment inGetShowHiddenFieldsToolNameSrc/Common/Controls/DetailControls/Slice.csShowingAllFieldsis trueSrc/Common/Controls/DetailControls/DetailControlsTests/DataTreeTests.csSrc/Common/Controls/DetailControls/DetailControlsTests/Test.fwlayoutParentWithHiddenChildren,CfAndBibFiltered)Src/Common/Controls/DetailControls/DetailControlsTests/TestParts.xmlBibliographyFiltered)Tests Added
ShowObject_ShowHiddenEnabledForCurrentTool_ShowsIfDataSlicesForLexEntryShowObject_NoCurrentContentControl_FallsBackToLexiconEditForLexEntryShowObject_NonLexiconCurrentContentControl_UsesLexiconEditForLexEntryShowObject_ShowHiddenForDifferentTool_DoesNotRevealIfDataSlicesShowObject_ShowHiddenEnabled_RevealsNeverVisibilityPartsShowObject_ShowHiddenEnabled_BypassesSliceFilterShowObject_ShowHiddenFields_ExpandsParentToRevealChildrenOnPropertyChanged_ShowHiddenFields_TogglesForCurrentToolOnDisplayShowHiddenFields_CheckedState_MatchesCurrentToolTest Results
19 DataTree tests: 18 passed, 1 skipped (pre-existing
NestedCollapsedPart).The TDD test (
ShowObject_ShowHiddenFields_ExpandsParentToRevealChildren) was verified to:This change is
This change is