Skip to content

refactor: share SQL analysis and enforce type safety - #238

Merged
Light2Dark merged 14 commits into
mainfrom
refactor/repo-type-safety
Nov 17, 2026
Merged

Light2Dark merged 14 commits into
mainfrom
refactor/repo-type-safety

Conversation

@Light2Dark

@Light2Dark Light2Dark commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

🤖 gpt-6.1-sol from Codex responding on behalf of Shahmir.

  • SQL features previously parsed independently, reused results after dialect changes, and could mix error offsets across concurrent calls. Share pending parses and analysis scoped to document and parser configuration, keep transformations local to each parse, and discard stale gutter work.
  • Reference operations now refuse shadowed or multiply declared bindings, including aliases on subqueries and table functions. Consolidate SQL scanning and schema resolution so features apply the same rules.
  • Enforce strict types across source, tests, demo, and configuration; prohibit any, casts, non-null assertions, and TypeScript suppressions. Validate external ASTs into stricter internal representations while preserving extensible public parser/result and namespace interfaces.

Existing sanitizer subclass hooks, per-feature parser defaults, and peer dependency requirements remain compatible. A parser configured through linterConfig still applies to syntax linting, semantic linting, and navigation, while hover and gutter retain independent defaults. Sharing a custom parser across all features is opt-in through the new top-level analysis options.

createSqlAnalysis shares dependencies across extension and completion bundles. needsRefresh refreshes linting and gutter state when parser configuration changes without an edit. The unused hover dialect option is deprecated for compatibility.

The demo normalizes all six dialect choices, updates parser state and SQL language together, and re-registers schema-aware completion sources when switching languages.

MySQL CTE column completion after switching the demo dialect

Review follow-up preserves array and subscript statement boundaries, restores column-completion fallback when namespace names collide, and distinguishes CAST types from binding declarations. Gutter selection and focus updates reuse analysis; comment stripping avoids repeatedly processing accumulated output.

The built-in parser now reuses parse, structure, and query-context analysis across cursor-only states with the same document and options. Dialect and parser-option changes still invalidate results. Custom parsers and subclasses remain state-scoped unless they provide getCacheKey(state). Document caches use weak ownership and bound configuration variants. Comment stripping walks quoted/comment spans without constructing the full token list.

The scanner preserves the original first-closing-bracket and non-nested block-comment behavior. Pending gutter markers map through edits until fresh analysis arrives, so asynchronous parsers do not clear the gutter on each keystroke.

User-visible dialect correction: BigQueryDialect now inherits PostgreSQL keyword and type definitions from PostgreSQL.spec, fixing its base dialect configuration.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants