Skip to content

Conversation

@prajwal-pai77
Copy link
Collaborator

No description provided.

Copy link
Contributor

@lokeshgoel177 lokeshgoel177 left a comment

Choose a reason for hiding this comment

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

Some minor comments.
1 major is about having a function which tells if search service is present or not

],
"configuration": "./language/language-configuration.json"
},

Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove extra space in package.json

"SEARCH"
],
"configuration": "./language/language-configuration.json"

Copy link
Contributor

Choose a reason for hiding this comment

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

space

"command": "vscode-couchbase.runSearch",
"key": "ctrl+shift+e",
"mac": "cmd+shift+e",
"when": "(editorLangId == cbs.json || resourceFilename =~ /.cbs.json$/) && !isKVCluster"
Copy link
Contributor

Choose a reason for hiding this comment

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

We will have to add another condition stating isSearchService. Because by default, search service is not mandatory

Copy link
Contributor

Choose a reason for hiding this comment

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

The 2 icons are very different

Comment on lines +19 to +23
if (result?.indexDef instanceof Uint8Array || result?.indexDef instanceof Uint16Array || result?.indexDef instanceof Uint32Array) {
vscode.window.showInformationMessage("Unable to open Index definition: It is not a valid JSON", { modal: true });
return false;
}
const uri = vscode.Uri.parse(
Copy link
Contributor

Choose a reason for hiding this comment

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

is this the correct way of confirming it is valid json file?

Comment on lines +36 to +37
vscode.window.showInformationMessage("Unable to open Index definition: It is not a valid JSON ", { modal: true });
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Print error message as well, so that detailed debugging is possible here. Use logger.error for that

Comment on lines +700 to +720
const openSearchWorkbenchCommand = vscode.commands.registerCommand(Commands.openSearchWorkbench, async (searchIndexNode: SearchIndexNode) => {
const connection = Memory.state.get<IConnection>(Constants.ACTIVE_CONNECTION);
if (!connection) {
vscode.window.showErrorMessage("No active connection available.");
return;
}

currentSearchIndexNode = searchIndexNode;
currentSearchWorkbench = searchWorkbench;

searchWorkbench.openSearchWorkbench(searchIndexNode, memFs);

const editorChangeSubscription = vscode.window.onDidChangeActiveTextEditor(async (editor) => {
if (editor && editor.document.languageId === "searchQuery") {
await handleSearchContextStatusbar(editor, searchIndexNode, searchWorkbench, globalStatusBarItem);
}
});
context.subscriptions.push(editorChangeSubscription);

});
context.subscriptions.push(openSearchWorkbenchCommand);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we shift this to a new file?

Comment on lines +53 to +54
if (!hasQueryService(connection?.services) || filterDocumentsType !== "query") {
rowCount = KVCollectionCount.get(`kv_collection_item_count-${this.bucketName}-${this.scopeName}-${collection.name}`) ?? 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Will need to check for search service as well wherever required

Comment on lines +44 to +64
// get all search indexes
const connection = getActiveConnection();
if (!connection){

return []
}
const searchIndexesManager = connection?.cluster?.searchIndexes();
const ftsIndexes = await searchIndexesManager?.getAllIndexes();
const bucketIndexes = ftsIndexes?.filter(index => index.sourceName === this.bucketName);
if (bucketIndexes === undefined) {
return [];
}
const searchIndexChildren: INode[] = bucketIndexes.map((searchIndex) =>
new SearchIndexNode(
searchIndex.name,
this.bucketName,
this.scopeName,
searchIndex.name
)


Copy link
Contributor

Choose a reason for hiding this comment

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

Based on search service present, Otherwise you may show an information node

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.

3 participants