feat(sql-completion): schema-aware autocomplete with dialect switching - #131
Merged
Conversation
- Add 4-layer completion pipeline (analyzer/builder/dialects/provider) - Wire monaco completion providers for all SQL dialects - Track async-loaded metadata so provider snapshots rebuild after connect - Register Pinia store loader browser-safely (no CommonJS require) - 60 unit tests; full suite 515/515
…ompletion, require monaco in provider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds schema-aware SQL autocomplete to the Monaco editor with per-dialect profiles and metadata-driven suggestions.
What's included
src/composables/sqlCompletion/:analyzer.ts— parses the query at the cursor (keywords, FROM clause, table refs, aliases, CTEs)builder.ts— builds suggestions (keywords, functions, tables, columns, schemas, databases) with prefix matchingdialects.ts— dialect profiles (postgresql, mysql, mssql, plsql, sqlite, generic sql)provider.ts— monaco completion provider, registered for every SQL dialect idmetadata.ts) — 3-level cache (connection objects / columns / derived aliases), injected store loader (browser-safe, no CommonJSrequire)SQLEditor.vue+useMonacoEditor.tsregister the provider and push dialect + completion context;QueriesPage.vuecomputes the active connection/db/schema/dialect contextsrc/__tests__/sqlCompletion/Key fixes found during manual QA
onMountedReferenceError: Can't find variable: require): replaced CommonJSrequire('@/store/databaseStore')with injectablesetDatabaseStoreLoaderregistered inmain.ts— jest could not catch thiscompletionContextnow tracks the full async metadata dependency graph (meta.databases,meta.schemas[db],meta.tables[db]+ every schema-qualified key) so the provider snapshot rebuilds after connectPost-review fixes (b52ad63)
sql/mysql/pgsqlgrammars. The editor now falls back to the genericsqlgrammar whenhasGrammar(id)is false (at both editor creation andupdateLanguage) — completion still resolves the real dialect profile per editor.public.uswith a FROM table whose columns were cached returned that table's columns instead ofpublicschema tables. The analyzer no longer falls back to the last FROM table when the qualifier matches neither an alias nor a table (single-segment qualifiers only, quoted segments unquoted before compare).getCompletionProviderdefaulted toundefined as never; themonacoLikeparameter is now required.metadata.ts(FROM public.userswhile another schema is active gets no column completion — sync-provider v1 tradeoff;fetchTableColumns()is the async escape).Validation
vue-tscclean, eslint 0 errors,npm run build✓aws_lc_rs::default_provider()internally); SQL Server suite passes 6/8Out of scope
src/components/grid/DataGrid.vuelocal styling change intentionally left uncommitted