Open bglusman opened 2 weeks ago
Proposed fix, though discovered while making it another seemingly valid option is also just to ensure that the valid queries always end in ;
as it won't indent comments unless the fragments below could be part of that query... but... since without this change it breaks otherwise working implementations, think we likely still want this? 🤷♂️
@bglusman Can you please elaborate? I was checking different comment indentations (both with tabs and spaces) and I still can use the query properly (comments are ignored). Can you give me an example that's breaking the lexer?
I saw in #40, you are allowing white spaces before -- name:
and -- docs:
keywords. Is the formatter indenting those two?
Yes, if a query doesn't end with ;
the formatter will indent comments following that line. I didn't realize this at first and thought I couldn't make the formatter at all compatible with AyeSQL without this change, but, given that its such an easy fix, tolerating it without breaking compilation still seems like an easy win to me.
Very early stage of playing with this, but I wanted to adopt consistent .sql formatting in the project, and found https://github.com/akoutmos/sql_fmt which comes with a mix formatter plugin that seems perfect... however, unless I configure it with
indent: 0
it looks like it will completely break AyeSQL because it can't tolerate indented comments... wondering easiest way to address this, as it seems like a good pairing otherwise? Putting this up for now for initial thoughts, best guess is it MIGHT only take lexer changes in https://github.com/alexdesousa/ayesql/blob/master/src/ayesql_lexer.xrl to allow for whitespace before a comment? Maybe I'll fork and try and see if I can make that change work locally, but thought I'd put the question here in case any concerns/alternative thoughts...