From 0a1c8e8374fc07b56b259aeac442ba88e62add3e Mon Sep 17 00:00:00 2001 From: Favour Ohanekwu Date: Mon, 25 Sep 2023 06:09:46 +0100 Subject: [PATCH] feat: Add autocomplete support for table schema on SQL editor (#27329) --- app/client/src/ce/selectors/entitiesSelector.ts | 1 + .../components/editorComponents/CodeEditor/utils/sqlHint.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/client/src/ce/selectors/entitiesSelector.ts b/app/client/src/ce/selectors/entitiesSelector.ts index c7b62c08bc..f649deba7a 100644 --- a/app/client/src/ce/selectors/entitiesSelector.ts +++ b/app/client/src/ce/selectors/entitiesSelector.ts @@ -1141,6 +1141,7 @@ export const getAllDatasourceTableKeys = createSelector( tables[table.name] = "table"; table.columns.forEach((column) => { tables[`${table.name}.${column.name}`] = column.type; + tables[`${column.name}`] = column.type; }); } }); diff --git a/app/client/src/components/editorComponents/CodeEditor/utils/sqlHint.ts b/app/client/src/components/editorComponents/CodeEditor/utils/sqlHint.ts index 8c4b3609e1..debf3442bc 100644 --- a/app/client/src/components/editorComponents/CodeEditor/utils/sqlHint.ts +++ b/app/client/src/components/editorComponents/CodeEditor/utils/sqlHint.ts @@ -46,7 +46,9 @@ export function getHintDetailsFromClassName( } } -const MAX_NUMBER_OF_SQL_HINTS = 200; +// Beyond 270 hints, the main thread task for rendering the hint tooltip becomes greater than 50ms +// 50ms is the limit beyond which a task is considered a long task +const MAX_NUMBER_OF_SQL_HINTS = 270; export function filterCompletions(completions: Hints) { completions.list = completions.list.slice(0, MAX_NUMBER_OF_SQL_HINTS);