Problem
When viewing indexes in the tree view, there is no visual distinction between hidden and non-hidden indexes — the hidden state is only visible in the tooltip. Both "Hide Index…" and "Unhide Index…" context menu actions appear for every index regardless of state, leading to confusing error messages when users pick the wrong one.
Additionally, the _id_ index (which cannot be hidden) also shows the "Hide Index…" option, resulting in an error on click.
Expected Behavior
- Visual indication: Hidden indexes should display a
hidden description next to their name in the tree view
- Context menu: Only the applicable action should appear:
- Non-hidden indexes → show "Hide Index…" only
- Hidden indexes → show "Unhide Index…" only
_id_ index → show neither "Hide" nor "Unhide"
Implementation Guide
1. Add hidden/default state to contextValue in IndexItem.ts
In src/tree/documentdb/IndexItem.ts, extend the context value based on state:
- Hidden indexes: include an
index_hidden segment → treeItem_index;index_hidden;experience_documentDB
- The
_id_ default index: include an index_default segment → treeItem_index;index_default;experience_documentDB
- Regular indexes: keep current →
treeItem_index;experience_documentDB
Use createContextValue() (already imported) to compose segments.
2. Add description for hidden indexes in IndexItem.ts
In getTreeItem(), set:
description: this.indexInfo.hidden ? 'hidden' : undefined
3. Update when clauses in package.json
Update the menu contributions for:
- Hide Index: add
&& viewItem =~ /(?!.*\\bindex_hidden\\b)(?!.*\\bindex_default\\b)/i — only show when the item is neither hidden nor default
- Unhide Index: add
&& viewItem =~ /\\bindex_hidden\\b/i — only show when the item is hidden
Files to Modify
| File |
Change |
src/tree/documentdb/IndexItem.ts |
Add index_hidden / index_default to contextValue; add description field |
package.json |
Update when clauses for hideIndex and unhideIndex commands |
Acceptance Criteria
Problem
When viewing indexes in the tree view, there is no visual distinction between hidden and non-hidden indexes — the hidden state is only visible in the tooltip. Both "Hide Index…" and "Unhide Index…" context menu actions appear for every index regardless of state, leading to confusing error messages when users pick the wrong one.
Additionally, the
_id_index (which cannot be hidden) also shows the "Hide Index…" option, resulting in an error on click.Expected Behavior
hiddendescription next to their name in the tree view_id_index → show neither "Hide" nor "Unhide"Implementation Guide
1. Add hidden/default state to
contextValueinIndexItem.tsIn
src/tree/documentdb/IndexItem.ts, extend the context value based on state:index_hiddensegment →treeItem_index;index_hidden;experience_documentDB_id_default index: include anindex_defaultsegment →treeItem_index;index_default;experience_documentDBtreeItem_index;experience_documentDBUse
createContextValue()(already imported) to compose segments.2. Add
descriptionfor hidden indexes inIndexItem.tsIn
getTreeItem(), set:3. Update
whenclauses inpackage.jsonUpdate the menu contributions for:
&& viewItem =~ /(?!.*\\bindex_hidden\\b)(?!.*\\bindex_default\\b)/i— only show when the item is neither hidden nor default&& viewItem =~ /\\bindex_hidden\\b/i— only show when the item is hiddenFiles to Modify
src/tree/documentdb/IndexItem.tsindex_hidden/index_defaultto contextValue; adddescriptionfieldpackage.jsonwhenclauses for hideIndex and unhideIndex commandsAcceptance Criteria
hiddendescription in the tree_id_index shows neither hide nor unhide