Skip to content

Commit 073ddba

Browse files
authored
fix broken sql completion (#6919)
1 parent f06f3bc commit 073ddba

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

frontend/src/lib/components/Editor.svelte

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,18 @@
492492
if (typeof newSchemaRes === 'string') {
493493
const resourcePath = newSchemaRes.replace('$res:', '')
494494
dbSchema = $dbSchemas[resourcePath]
495-
if (lang === 'graphql' && dbSchema === undefined) {
496-
await getDbSchemas(lang, resourcePath, $workspaceStore, $dbSchemas, (e) => {
497-
console.error('error getting graphql db schema', e)
498-
})
499-
dbSchema = $dbSchemas[resourcePath]
495+
if (dbSchema === undefined) {
496+
if (lang === 'graphql') {
497+
await getDbSchemas('graphql', resourcePath, $workspaceStore, $dbSchemas, (e) => {
498+
console.error('error getting graphql db schema', e)
499+
})
500+
} else if (lang === 'sql') {
501+
await getDbSchemas(scriptLang ?? '', resourcePath, $workspaceStore, $dbSchemas, (e) => {
502+
console.error(`error getting SQL (${scriptLang}) db schema`, e)
503+
})
504+
}
500505
}
506+
dbSchema = $dbSchemas[resourcePath]
501507
} else {
502508
dbSchema = undefined
503509
}

0 commit comments

Comments
 (0)