-
Notifications
You must be signed in to change notification settings - Fork 5
Add support for fts inside extension #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
@@ -357,6 +357,18 @@ | |||
"SQL++" | |||
], | |||
"configuration": "./language/language-configuration.json" | |||
}, | |||
|
There was a problem hiding this comment.
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" | ||
|
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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( |
There was a problem hiding this comment.
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?
vscode.window.showInformationMessage("Unable to open Index definition: It is not a valid JSON ", { modal: true }); | ||
return false; |
There was a problem hiding this comment.
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
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); |
There was a problem hiding this comment.
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?
if (!hasQueryService(connection?.services) || filterDocumentsType !== "query") { | ||
rowCount = KVCollectionCount.get(`kv_collection_item_count-${this.bucketName}-${this.scopeName}-${collection.name}`) ?? 0; |
There was a problem hiding this comment.
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
// 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 | ||
) | ||
|
||
|
There was a problem hiding this comment.
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
No description provided.