Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for streaming #38

Open
greg0ire opened this issue Apr 11, 2020 · 2 comments
Open

Add support for streaming #38

greg0ire opened this issue Apr 11, 2020 · 2 comments

Comments

@greg0ire
Copy link
Member

See jdorn/sql-formatter#68

@goetas
Copy link
Member

goetas commented Apr 28, 2020

This seems possible now thanks to #48

@mvorisek
Copy link
Contributor

mvorisek commented Jun 4, 2024

Tokens can be streamed, but formatting cannot as we might need up too complete lookbehind/lookahead.

However, if you want to support piping as requested in jdorn/sql-formatter#68, tokenization can be streamed on token basic and formatting done on query basic with separating detected using these two conditions

if ($indentLevel === 0) {
$prevNotWhitespaceToken = $cursor->subCursor()->previous(Token::TOKEN_TYPE_WHITESPACE);
if ($prevNotWhitespaceToken !== null && $prevNotWhitespaceToken->value() === ';') {
(semicolon + zero indentation level).

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

No branches or pull requests

3 participants