improvement: make it easy to override sql parse. get options via EditorState#13
Merged
Conversation
There was a problem hiding this comment.
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
optsparameter withstateproperty is not covered by tests. Consider adding test cases that verify the parser options are correctly passed through whengetParserOptionsis 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
optsparameter withstateproperty to theparsemethod, as the method signature has changed.
it("should parse valid SQL successfully", async () => {
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.
No description provided.