From 0e660124b8dc4c3a7e933f233815633b6da80c34 Mon Sep 17 00:00:00 2001 From: AayushTyagi1 Date: Wed, 4 Oct 2023 15:08:13 +0530 Subject: [PATCH] DA#239: BugFix: Fix Index with # issue --- src/commands/indexes/openIndexInformation.ts | 32 ++++++++++---------- src/model/IndexDirectory.ts | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/commands/indexes/openIndexInformation.ts b/src/commands/indexes/openIndexInformation.ts index 691f980e..f2d30c00 100644 --- a/src/commands/indexes/openIndexInformation.ts +++ b/src/commands/indexes/openIndexInformation.ts @@ -19,20 +19,20 @@ import { MemFS } from "../../util/fileSystemProvider"; import IndexNode from "../../model/IndexNode"; export const openIndexInfo = async (indexNode: IndexNode, memFs: MemFS) => { - try { - const uri = vscode.Uri.parse( - `couchbase:/${indexNode.bucketName}/${indexNode.scopeName}/Indexes/${indexNode.indexName}.n1ql` - ); - memFs.writeFile( - uri, - Buffer.from(indexNode.data), - { create: true, overwrite: true } - ); - const document = await vscode.workspace.openTextDocument(uri); - await vscode.window.showTextDocument(document, { preview: false }); - return true; - } catch (err: any) { - logger.error("Failed to open index information"); - logger.debug(err); - } + try { + const uri = vscode.Uri.parse( + `couchbase:/${indexNode.bucketName}/${indexNode.scopeName}/Indexes/${indexNode.indexName}.sqlpp` + ); + memFs.writeFile( + uri, + Buffer.from(indexNode.data), + { create: true, overwrite: true } + ); + const document = await vscode.workspace.openTextDocument(uri); + await vscode.window.showTextDocument(document, { preview: false }); + return true; + } catch (err: any) { + logger.error("Failed to open index information"); + logger.debug(err); + } }; diff --git a/src/model/IndexDirectory.ts b/src/model/IndexDirectory.ts index 8e26186d..0e392c64 100644 --- a/src/model/IndexDirectory.ts +++ b/src/model/IndexDirectory.ts @@ -83,7 +83,7 @@ export class IndexDirectory implements INode { this.connection, this.scopeName, this.bucketName, - `${query.name.substring(1)}_${(query.collectionName ?? "")}`, + `${query.name[0] === '#' ? query.name.substring(1) : query.name}${(query.collectionName ? ("_" + query.collectionName) : "")}`, getIndexDefinition(query), vscode.TreeItemCollapsibleState.None );