You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess the use case should be pretty obvious and it is common in most formatters I've used for other languages in the past.
Additionally apart from making the code more consistent, it will solve an issue I'm having with mssql-scripter that sometimes produce empty line at the end of the file before the last GO statement, bloating the diffs in PRs unecessarily: ko4life-net/ko-db@7b7ed20
I couldn't find any option to format GO statement either, althougt I've tried modifying the code here:
class FileSegment(BaseFileSegment):
"""A segment representing a whole file or script.
We override default as T-SQL allows concept of several
batches of commands separated by GO as well as usual
semicolon-separated statement lines.
This is also the default "root" segment of the dialect,
and so is usually instantiated directly. It therefore
has no match_grammar.
"""
match_grammar = Sequence(
AnyNumberOf(Ref("BatchDelimiterGrammar")),
Delimited(
Ref("BatchSegment"),
delimiter=AnyNumberOf(
Sequence(
Ref("DelimiterGrammar", optional=True), Ref("BatchDelimiterGrammar")
),
min_times=1,
),
- allow_gaps=True,- allow_trailing=True,+ allow_gaps=False,+ allow_trailing=False,
),
)
If no one have the patience to work on this, I'm happy to help, but I'll need some guidance where to start looking at considering I've just started using the project. Thanks.
Dialect
tsql
Are you willing to work on and submit a PR to address the issue?
Search before asking
Description
As a user I would like to specify the maximum amount of empty lines allowed to keep so that empty lines will be removed. As an example, clang-format have this as one of the first features: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#maxemptylinestokeep
Use case
I guess the use case should be pretty obvious and it is common in most formatters I've used for other languages in the past.
Additionally apart from making the code more consistent, it will solve an issue I'm having with mssql-scripter that sometimes produce empty line at the end of the file before the last GO statement, bloating the diffs in PRs unecessarily: ko4life-net/ko-db@7b7ed20
I couldn't find any option to format GO statement either, althougt I've tried modifying the code here:
If no one have the patience to work on this, I'm happy to help, but I'll need some guidance where to start looking at considering I've just started using the project. Thanks.
Dialect
tsql
Are you willing to work on and submit a PR to address the issue?
Code of Conduct
The text was updated successfully, but these errors were encountered: