Skip to content

improvement: make it easy to override sql parse. get options via EditorState#13

Merged
mscolnick merged 2 commits into
mainfrom
ms/override-sql-parser
Aug 4, 2025
Merged

improvement: make it easy to override sql parse. get options via EditorState#13
mscolnick merged 2 commits into
mainfrom
ms/override-sql-parser

Conversation

@mscolnick

Copy link
Copy Markdown
Contributor

No description provided.

@mscolnick
mscolnick requested review from Light2Dark and Copilot August 4, 2025 14:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves SQL parsing extensibility by introducing a parser interface and enabling custom configuration through editor state. The changes make it easy to override SQL parsing behavior while allowing access to editor state for dynamic configuration.

  • Extract SQL parser interface to enable custom parser implementations
  • Modify parser methods to accept EditorState for configuration options
  • Add support for custom parser options based on editor state

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/sql/types.ts Defines new TypeScript interfaces for SQL parser abstraction
src/sql/structure-extension.ts Adds parser configuration option to SQL gutter config
src/sql/structure-analyzer.ts Updates constructor to accept parser dependency injection
src/sql/parser.ts Renames class and adds state-based configuration support
src/sql/diagnostics.ts Updates to use new parser interface and pass state
src/sql/tests/structure-analyzer.test.ts Updates test to use new parser constructor
src/sql/tests/parser.test.ts Updates test to use renamed parser class
src/index.ts Updates exports to reflect new interface and class names
src/tests/index.test.ts Updates test snapshot for renamed export
Comments suppressed due to low confidence (2)

src/sql/parser.ts:43

  • The new opts parameter with state property is not covered by tests. Consider adding test cases that verify the parser options are correctly passed through when getParserOptions is provided.
  async parse(sql: string, opts: { state: EditorState }): Promise<SqlParseResult> {

src/sql/tests/parser.test.ts:8

  • Existing tests need to be updated to pass the required opts parameter with state property to the parse method, as the method signature has changed.
    it("should parse valid SQL successfully", async () => {

@mscolnick
mscolnick merged commit 99a76df into main Aug 4, 2025
4 checks passed
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