alex-hhh/emacs-sql-indent

Anchor incorrect after "parenthetical join"

Closed this issue · 2 comments

Hi! I think the anchor is being detected wrong on the last line of this sample:

SELECT *
FROM t1
JOIN (
    t2
    LEFT JOIN t3 USING (k2)
)
	ON t1.k1 = t2.k1

If I put the cursor before ON on the last line and run sqlind-show-syntax-of-line, I get:

((select-join-condition . 36) (statement-continuation . 1))

Position 36 is the LEFT JOIN on the fifth line. I expected it to report position 18, the JOIN on the third line, as the anchor. Is this behaving as expected?

I tested this using emacs -Q, loading sql-indent.el version 1.3 from ELPA using Emacs on macOS. emacs-version reports:

GNU Emacs 26.1.50 (build 2, x86_64-apple-darwin17.7.0, NS appkit-1561.60 Version 10.13.6 (Build 17G65)) of 2018-08-31

Thank you for this package! Despite a few little issues I'm working out, this package is basically a miracle as far as I'm concerned. I never expected to see such intelligent and flexible SQL indenting in Emacs (or, frankly, in any editor). I am very impressed so far.

Thanks for reporting this and I am glad you like this package. I have pushed a fix for this case to the repository.

Confirmed fixed here, thank you very much!