Skip to content

Commit

Permalink
DA#239: BugFix: Fix Index with # issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushTyagi1 committed Oct 4, 2023
1 parent 00edbf0 commit 0e66012
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions src/commands/indexes/openIndexInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
2 changes: 1 addition & 1 deletion src/model/IndexDirectory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down

0 comments on commit 0e66012

Please sign in to comment.