From c0a1cb6b84a0b5803485ee8fbb9487f305d1af3f Mon Sep 17 00:00:00 2001 From: lte_z Date: Fri, 22 May 2026 13:49:52 +0800 Subject: [PATCH 1/6] fix: improve hidden index visibility and menu actions --- package.json | 4 ++-- src/tree/documentdb/IndexItem.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index dae1408a3..005dfea2b 100644 --- a/package.json +++ b/package.json @@ -876,13 +876,13 @@ { "//": "[Index] Hide Index", "command": "vscode-documentdb.command.hideIndex", - "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", + "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /^(?!.*\\bindex_hidden\\b)(?!.*\\bindex_default\\b).*$/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", "group": "3@1" }, { "//": "[Index] Unhide Index", "command": "vscode-documentdb.command.unhideIndex", - "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", + "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /\\bindex_hidden\\b/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", "group": "3@2" }, { diff --git a/src/tree/documentdb/IndexItem.ts b/src/tree/documentdb/IndexItem.ts index 416d4fc7f..a88232630 100644 --- a/src/tree/documentdb/IndexItem.ts +++ b/src/tree/documentdb/IndexItem.ts @@ -27,8 +27,15 @@ export class IndexItem implements TreeElement, TreeElementWithExperience, TreeEl ) { this.id = `${cluster.treeId}/${databaseInfo.name}/${collectionInfo.name}/indexes/${indexInfo.name}`; this.experience = cluster.dbExperience; + const contextValues = ['treeItem_index']; + if (this.indexInfo.name === '_id_') { + contextValues.push('index_default'); + } else if (this.indexInfo.hidden) { + contextValues.push('index_hidden'); + } this.experienceContextValue = `experience_${this.experience.api}`; - this.contextValue = createContextValue([this.contextValue, this.experienceContextValue]); + contextValues.push(this.experienceContextValue); + this.contextValue = createContextValue(contextValues); } async getChildren(): Promise { @@ -63,6 +70,7 @@ export class IndexItem implements TreeElement, TreeElementWithExperience, TreeEl id: this.id, contextValue: this.contextValue, label: this.indexInfo.name, + description: this.indexInfo.hidden ? 'hidden' : undefined, tooltip: this.buildTooltip(), iconPath: new vscode.ThemeIcon('combine'), // TODO: create our onw icon here, this one's shape can change collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, From 6e8f4659e96f749d1d4ad9463ec44a00366bccfc Mon Sep 17 00:00:00 2001 From: lte_z <56144340+lte-z@users.noreply.github.com> Date: Fri, 22 May 2026 14:23:03 +0800 Subject: [PATCH 2/6] chore: simplify hide index when clause Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 005dfea2b..038efee04 100644 --- a/package.json +++ b/package.json @@ -876,7 +876,7 @@ { "//": "[Index] Hide Index", "command": "vscode-documentdb.command.hideIndex", - "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /^(?!.*\\bindex_hidden\\b)(?!.*\\bindex_default\\b).*$/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", + "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && !(viewItem =~ /\\bindex_hidden\\b/i) && !(viewItem =~ /\\bindex_default\\b/i) && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", "group": "3@1" }, { From 74a9a8058f1d9a24bc5283397ecd3ccc420a2aee Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Wed, 27 May 2026 18:13:45 +0200 Subject: [PATCH 3/6] refactor: rename index context values to state_hidden and state_default 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. --- package.json | 4 ++-- src/tree/documentdb/IndexItem.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a65b83fce..e9d5de794 100644 --- a/package.json +++ b/package.json @@ -881,13 +881,13 @@ { "//": "[Index] Hide Index", "command": "vscode-documentdb.command.hideIndex", - "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && !(viewItem =~ /\\bindex_hidden\\b/i) && !(viewItem =~ /\\bindex_default\\b/i) && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", + "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && !(viewItem =~ /\\bstate_hidden\\b/i) && !(viewItem =~ /\\bstate_default\\b/i) && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", "group": "3@1" }, { "//": "[Index] Unhide Index", "command": "vscode-documentdb.command.unhideIndex", - "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /\\bindex_hidden\\b/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", + "when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /\\bstate_hidden\\b/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i", "group": "3@2" }, { diff --git a/src/tree/documentdb/IndexItem.ts b/src/tree/documentdb/IndexItem.ts index a88232630..3d3bc1273 100644 --- a/src/tree/documentdb/IndexItem.ts +++ b/src/tree/documentdb/IndexItem.ts @@ -29,9 +29,9 @@ export class IndexItem implements TreeElement, TreeElementWithExperience, TreeEl this.experience = cluster.dbExperience; const contextValues = ['treeItem_index']; if (this.indexInfo.name === '_id_') { - contextValues.push('index_default'); + contextValues.push('state_default'); } else if (this.indexInfo.hidden) { - contextValues.push('index_hidden'); + contextValues.push('state_hidden'); } this.experienceContextValue = `experience_${this.experience.api}`; contextValues.push(this.experienceContextValue); From e9148ad1d043a671944a7acb4c89bddadefbb955 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Wed, 27 May 2026 18:15:10 +0200 Subject: [PATCH 4/6] fix(l10n): localize hidden index description Wrap the 'hidden' tree item description in vscode.l10n.t() so it is translatable. Regenerates l10n/bundle.l10n.json via npm run l10n. --- l10n/bundle.l10n.json | 1 + src/tree/documentdb/IndexItem.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index bf54b8f00..2d23392bd 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -590,6 +590,7 @@ "Good": "Good", "Got a moment? Share your feedback on DocumentDB for VS Code!": "Got a moment? Share your feedback on DocumentDB for VS Code!", "Helped me understand the query execution": "Helped me understand the query execution", + "hidden": "hidden", "hide": "hide", "Hide index \"{indexName}\" from collection \"{collectionName}\"?": "Hide index \"{indexName}\" from collection \"{collectionName}\"?", "Hide index?": "Hide index?", diff --git a/src/tree/documentdb/IndexItem.ts b/src/tree/documentdb/IndexItem.ts index 3d3bc1273..fe7fe521f 100644 --- a/src/tree/documentdb/IndexItem.ts +++ b/src/tree/documentdb/IndexItem.ts @@ -70,7 +70,7 @@ export class IndexItem implements TreeElement, TreeElementWithExperience, TreeEl id: this.id, contextValue: this.contextValue, label: this.indexInfo.name, - description: this.indexInfo.hidden ? 'hidden' : undefined, + description: this.indexInfo.hidden ? vscode.l10n.t('hidden') : undefined, tooltip: this.buildTooltip(), iconPath: new vscode.ThemeIcon('combine'), // TODO: create our onw icon here, this one's shape can change collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, From e1b8325c0c0dcdf21b17ac27555f4ffb0205e916 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Wed, 27 May 2026 18:18:53 +0200 Subject: [PATCH 5/6] =?UTF-8?q?fix(index):=20show=20inline=20'Hiding?= =?UTF-8?q?=E2=80=A6/Unhiding=E2=80=A6'=20description=20instead=20of=20vir?= =?UTF-8?q?tual=20sub-tree=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- l10n/bundle.l10n.json | 4 ++-- src/commands/index.hideIndex/hideIndex.ts | 2 +- src/commands/index.unhideIndex/unhideIndex.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 2d23392bd..4475e9020 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -595,7 +595,7 @@ "Hide index \"{indexName}\" from collection \"{collectionName}\"?": "Hide index \"{indexName}\" from collection \"{collectionName}\"?", "Hide index?": "Hide index?", "Hide Index…": "Hide Index…", - "Hiding index…": "Hiding index…", + "Hiding…": "Hiding…", "High efficiency ratio": "High efficiency ratio", "High multikey expansion": "High multikey expansion", "HIGH PRIORITY": "HIGH PRIORITY", @@ -1194,7 +1194,7 @@ "Unhide index \"{indexName}\" from collection \"{collectionName}\"?": "Unhide index \"{indexName}\" from collection \"{collectionName}\"?", "Unhide index?": "Unhide index?", "Unhide Index…": "Unhide Index…", - "Unhiding index…": "Unhiding index…", + "Unhiding…": "Unhiding…", "Unknown command type: {type}": "Unknown command type: {type}", "Unknown conflict resolution strategy: {0}": "Unknown conflict resolution strategy: {0}", "Unknown constructor '{0}'. Expected a BSON constructor (e.g., ObjectId, ISODate) or a known global (e.g., Date, RegExp).": "Unknown constructor '{0}'. Expected a BSON constructor (e.g., ObjectId, ISODate) or a known global (e.g., Date, RegExp).", diff --git a/src/commands/index.hideIndex/hideIndex.ts b/src/commands/index.hideIndex/hideIndex.ts index 5715eb09a..5d68e5120 100644 --- a/src/commands/index.hideIndex/hideIndex.ts +++ b/src/commands/index.hideIndex/hideIndex.ts @@ -47,7 +47,7 @@ export async function hideIndex(context: IActionContext, node: IndexItem): Promi const client = await ClustersClient.getClient(node.cluster.clusterId); let success = false; - await ext.state.showCreatingChild(node.id, l10n.t('Hiding index…'), async () => { + await ext.state.runWithTemporaryDescription(node.id, l10n.t('Hiding…'), async () => { const result = await client.hideIndex( node.databaseInfo.name, node.collectionInfo.name, diff --git a/src/commands/index.unhideIndex/unhideIndex.ts b/src/commands/index.unhideIndex/unhideIndex.ts index 3dcf53e3f..3901e1a11 100644 --- a/src/commands/index.unhideIndex/unhideIndex.ts +++ b/src/commands/index.unhideIndex/unhideIndex.ts @@ -42,7 +42,7 @@ export async function unhideIndex(context: IActionContext, node: IndexItem): Pro const client = await ClustersClient.getClient(node.cluster.clusterId); let success = false; - await ext.state.showCreatingChild(node.id, l10n.t('Unhiding index…'), async () => { + await ext.state.runWithTemporaryDescription(node.id, l10n.t('Unhiding…'), async () => { const result = await client.unhideIndex( node.databaseInfo.name, node.collectionInfo.name, From 797d5e8c031072459858a598f42868126d009e2a Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Wed, 27 May 2026 18:28:13 +0200 Subject: [PATCH 6/6] fix(l10n): localize only the word 'hidden', keep () as formatting The parentheses are punctuation/formatting, not translatable content. Only the word itself goes through vscode.l10n.t(). --- src/tree/documentdb/IndexItem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tree/documentdb/IndexItem.ts b/src/tree/documentdb/IndexItem.ts index fe7fe521f..845e51754 100644 --- a/src/tree/documentdb/IndexItem.ts +++ b/src/tree/documentdb/IndexItem.ts @@ -70,7 +70,7 @@ export class IndexItem implements TreeElement, TreeElementWithExperience, TreeEl id: this.id, contextValue: this.contextValue, label: this.indexInfo.name, - description: this.indexInfo.hidden ? vscode.l10n.t('hidden') : undefined, + description: this.indexInfo.hidden ? `(${vscode.l10n.t('hidden')})` : undefined, tooltip: this.buildTooltip(), iconPath: new vscode.ThemeIcon('combine'), // TODO: create our onw icon here, this one's shape can change collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,