Repo:
IF b = 0
BEGIN
  IF @a = 0
  BEGIN
    PRINT '0'
    IF @a = 0
      PRINT '0'
  END
  ELSE
  BEGIN
    PRINT 'not 0'
  END
END
If I disable "Indent BEGIN...END blocks and then format the SQL code the formatting looks correct as seen above.
However, if I first insert semicolons via Ctrl+B, Ctrl+C nad then format the SQL code I end up with an incorrect layout as shown below:
IF b = 0
BEGIN
  IF @a = 0
  BEGIN
    PRINT '0';
    IF @a = 0
      PRINT '0';
  END;
ELSE
BEGIN
  PRINT 'not 0';
END;
END;
[/code]
jmeyer
0

Comments

4 comments

  • Aaron L
    Hi jmeyer,

    Thanks for reporting this. I can recreate this locally and will look into a fix for you. I think we might be being a tiny bit overzealous with the semicolons here anyway as I don't think they're strictly necessary after BEGIN…END even in ANSI SQL.

    Thanks,
    Aaron.
    Aaron L
    0
  • Aaron L
    The private build I posted in your other thread should stop Prompt adding in the semicolons after BEGIN/END blocks hopefully helping avoid hitting this for now. I'll continue looking into a fix.
    Aaron L
    0
  • jmeyer
    Aaron:

    The private build did fix the issue on my machine.

    Thanks,
    Jens
    jmeyer
    0
  • Aaron L
    Thanks Jens,

    I've just uploaded a new stable build (6.4.0.641) which should have a proper fix for this, so it will be formatted correctly even with semicolons in there.
    Aaron L
    0

Add comment

Please sign in to leave a comment.