Hi Joel,

Our code formatting feature is very basic and straightforward. Indeed, we never planned to keep it in the GUI, but some people convinced us not to remove it.

I’ve just improved the detection of strings and comments in the latest snapshot a little [1]; maybe that helps.

Thanks for all,
Christian


 

On Wed, Feb 19, 2025 at 1:35 PM Andy Bunce <bunce.andy@gmail.com> wrote:
Hi Joel,

Welcome.  I never use the GUI format option because it is very aggressive with parenthesis regardless of the context. E.g.
 let $num := abs($d)
becomes:
  let $num := abs(
  $d
)
But obviously it should not be messing with strings. I am not aware of any workarounds.

/Andy

On Wed, 19 Feb 2025 at 03:05, Joel Kalvesmaki <director@textalign.net> wrote:
Hi everyone, I just joined. BaseX is awesome (as y'all know).

I like CTRL+SHIFT+F for formatting, but it is also messing up string
values, which especially wreaks havoc with regular expressions. That
is...

    let $regex := "(a|z)"

...becomes...

    let $regex := "(
       a|z
    )"

I didn't see anything in the documentation or archives about
micromanaging the formatting. Is the best practice to avoid formatting
altogether? Or is there a hidden pragma to exempt lines from being
formatted?

Joel
--
Joel Kalvesmaki
Director, Text Alignment Network
http://textalign.net