Skip to content

fix: improve hidden index tree item visibility and menu actions#674

Merged
tnaum-ms merged 8 commits into
microsoft:mainfrom
lte-z:dev/lte_z/index-hidden-state
May 27, 2026
Merged

fix: improve hidden index tree item visibility and menu actions#674
tnaum-ms merged 8 commits into
microsoft:mainfrom
lte-z:dev/lte_z/index-hidden-state

Conversation

@lte-z

@lte-z lte-z commented May 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #656

Changes

This PR improves hidden index visibility and context menu behavior in the tree view.

Tree item updates

  • Added hidden/default state segments to IndexItem context values
  • Added a hidden description for hidden indexes in the tree view

Context menu updates

Updated menu when clauses so only valid actions are shown:

  • Hidden indexes show only "Unhide Index…"
  • Non-hidden indexes show only "Hide Index…"
  • _id_ indexes show neither action

Behavior

Hidden indexes

  • Display hidden next to the index name in the tree
  • Show only "Unhide Index…" in the context menu

Regular indexes

  • Show only "Hide Index…" in the context menu

_id_ index

  • Does not show hide/unhide actions

Screenshots

_id_ index

id index

Regular and hidden indexes

Regular and hidden indexes

Notes

  • Tooltip behavior remains unchanged
  • Uses createContextValue() to compose index state context segments

Copilot AI review requested due to automatic review settings May 22, 2026 06:02
@lte-z lte-z requested a review from a team as a code owner May 22, 2026 06:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds richer context and UI cues for DocumentDB index tree items so the Hide/Unhide Index commands only appear when appropriate (e.g., not for default _id_ indexes, and toggling based on hidden state).

Changes:

  • Add index_hidden / index_default context values and show a “hidden” description for hidden indexes in the tree.
  • Update command when clauses to hide/show Hide/Unhide actions based on those context values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/tree/documentdb/IndexItem.ts Adds contextValue tokens for default/hidden indexes and displays “hidden” in the tree item description.
package.json Refines command visibility logic for Hide/Unhide Index using the new contextValue tokens.

Comment thread package.json Outdated
Comment thread package.json Outdated
Comment thread src/tree/documentdb/IndexItem.ts
lte-z and others added 2 commits May 22, 2026 14:23
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@tnaum-ms tnaum-ms added this to the 0.8.1 milestone May 27, 2026
tnaum-ms added 2 commits May 27, 2026 18:13
Aligns with the single-axis-prefix naming convention used elsewhere in
the tree (treeItem_*, experience_*). The state_* prefix scopes these as
state modifiers rather than a node-kind axis, avoiding future collisions
if other element types gain similar state flags.
Wrap the 'hidden' tree item description in vscode.l10n.t() so it is
translatable. Regenerates l10n/bundle.l10n.json via npm run l10n.
@tnaum-ms

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! I pushed two small follow-ups directly to your branch:

  1. 74a9a80 rename the new context values to align with the existing tree naming convention (single-axis prefixes like treeItem_* and experience_*). The values are now state_hidden and state_default, which scopes them as state modifiers and avoids collisions if other element types gain similar flags later.
    74a9a805

  2. e9148ad wrap the new 'hidden' description in vscode.l10n.t() so it gets picked up by our localization pipeline, and regenerate l10n/bundle.l10n.json via npm run l10n.
    e9148ad1

Reviewing the rest now.

…rtual sub-tree item

Replace showCreatingChild() with runWithTemporaryDescription() in the
hide/unhide index commands. The previous approach inserted a phantom
child node under the index while the operation was in flight, which
was confusing. A temporary description on the index itself is clearer.
@tnaum-ms

Copy link
Copy Markdown
Collaborator

One more follow-up:

  1. e1b8325 replace showCreatingChild() with runWithTemporaryDescription() in the hide and unhide index commands. The previous approach inserted a virtual phantom sub-tree item under the index while the operation was in flight, which was confusing. Now the index node itself shows a brief 'Hiding…' or 'Unhiding…' description, matching the pattern used by other long-running operations in the extension (export, import, copy connection string, etc.).
    e1b8325c

The parentheses are punctuation/formatting, not translatable content.
Only the word itself goes through vscode.l10n.t().
@tnaum-ms

Copy link
Copy Markdown
Collaborator

Thanks @lte-z for another solid contribution!

This is your second PR to the project I'm merging, and the quality is consistently good. The fix is well scoped and the when clause logic is correct. I pushed a few small follow-ups directly to your branch, all noted in the comments above. Once CI passes I'll approve and merge. Keep them coming!

@tnaum-ms tnaum-ms merged commit eb59a1b into microsoft:main May 27, 2026
5 checks passed
@lte-z

lte-z commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

Thank you so much for merging this and for the detailed follow-up commits!

The changes around state_hidden / state_default, localization, and using the temporary description for Hiding… / Unhiding… all make sense to me. I learned a lot from seeing how you aligned the fix with the existing tree naming and long-running operation patterns.

Thanks again for the review and guidance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Index tree items lack visual indication of hidden state & show incorrect context menu actions 👁️🗂️

3 participants