feat: extend SQL dialect support with additional keywords for enhanced autocompletion

This commit is contained in:
t8y2
2026-05-01 23:03:56 +08:00
parent 2bca814a5d
commit 4b12d34354
2 changed files with 20 additions and 2 deletions
+7 -2
View File
@@ -160,7 +160,7 @@ onMounted(async () => {
const [
{ EditorView, keymap },
{ EditorState, Compartment },
{ sql, MySQL, PostgreSQL },
{ sql, MySQL, PostgreSQL, SQLDialect },
{ basicSetup },
{ oneDark },
{ autocompletion, startCompletion },
@@ -175,7 +175,12 @@ onMounted(async () => {
editorViewModule = { EditorView, keymap } as typeof import("@codemirror/view");
fontSizeTheme = new Compartment();
const dialect = props.dialect === "postgres" ? PostgreSQL : MySQL;
const baseDialect = props.dialect === "postgres" ? PostgreSQL : MySQL;
const extraKeywords = "PIVOT UNPIVOT EXCLUDE REPLACE QUALIFY ASOF POSITIONAL ANTI SEMI SAMPLE TABLESAMPLE STRUCT MAP LIST ARRAY LAMBDA UNNEST LATERAL FILTER RECURSIVE SUMMARIZE PRAGMA READ_CSV READ_PARQUET READ_JSON DESCRIBE SHOW COPY EXPORT IMPORT";
const dialect = SQLDialect.define({
...baseDialect.spec,
keywords: (baseDialect.spec.keywords || "") + " " + extraKeywords,
});
const runKeymap = keymap.of([
{