mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-30 00:19:35 +00:00
fix(mongodb): skip SQL semantic diagnostics for MongoDB connections
MongoDB shell syntax like db.collection.find({}) was incorrectly
parsed as SQL, causing a "sql parser error" diagnostic in the editor.
Added MongoDB guards in shouldRunSqlSemanticDiagnostics and
refreshSemanticDiagnostics, matching existing Elasticsearch logic.
Also fix a pre-existing TiDB cloud URL param ordering test failure.
This commit is contained in:
@@ -741,7 +741,7 @@ async function refreshSemanticDiagnostics() {
|
||||
setSemanticDiagnostics([]);
|
||||
return;
|
||||
}
|
||||
if (props.databaseType === "elasticsearch") {
|
||||
if (props.databaseType === "mongodb" || props.databaseType === "elasticsearch") {
|
||||
setSemanticDiagnostics([]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export function shouldRunSqlSemanticDiagnostics(
|
||||
cursor: number,
|
||||
options: { databaseType?: DatabaseType } = {},
|
||||
): boolean {
|
||||
if (options.databaseType === "elasticsearch") return false;
|
||||
if (options.databaseType === "mongodb" || options.databaseType === "elasticsearch") return false;
|
||||
const context = getSqlCompletionContext(sql, cursor);
|
||||
if (context.suggestTables || context.exclusiveTableSuggestions || context.exclusiveColumnSuggestions) return false;
|
||||
if (context.qualifier) return false;
|
||||
|
||||
Reference in New Issue
Block a user