chore: port TSQL sqlcmd commands :r and :setvar (#4653)#2671
Merged
Conversation
Contributor
Benchmark for 760b144Click to view benchmark
|
This was referenced Jun 6, 2026
## Summary - SQLFluff #4653 added T-SQL `sqlcmd` command support (`:r <file>` and `:setvar <name> <value>`). Ported it to sqruff's `tsql.rs`: a new `unquoted_relative_sql_file_path` lexer matcher, `SqlcmdOperatorSegment` (MultiStringParser over `r`/`setvar`), `SqlcmdFilePathSegment`, and `SqlcmdCommandSegment`, wired into the T-SQL statement list, with `R`/`SETVAR` registered as unreserved keywords. - Added the `sqlcmd_command` fixture (.sql + .yml); the dialect test parses all commands with no unparsable segments. Parser-only change. Ported from SQLFluff 964dcd18d158980e0321ab67131f07ced9f8440b sqlfluff/sqlfluff#4653 sqlfluff/sqlfluff@964dcd1
062cb99 to
7dcaa6b
Compare
Contributor
Benchmark for 4e7b5d4Click to view benchmark
|
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
sqlcmdcommand support (:r <file>and:setvar <name> <value>). Ported it to sqruff'stsql.rs: a newunquoted_relative_sql_file_pathlexer matcher,SqlcmdOperatorSegment(MultiStringParser overr/setvar),SqlcmdFilePathSegment, andSqlcmdCommandSegment, wired into the T-SQL statement list, withR/SETVARregistered as unreserved keywords.sqlcmd_commandfixture (.sql + .yml); the dialect test parses all commands with no unparsable segments. Parser-only change.Ported from SQLFluff 964dcd18d158980e0321ab67131f07ced9f8440b
sqlfluff/sqlfluff#4653
sqlfluff/sqlfluff@964dcd1