[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/sql-indent 2ed4c6a26b: Consider "column" keyword in "if
From: |
ELPA Syncer |
Subject: |
[elpa] externals/sql-indent 2ed4c6a26b: Consider "column" keyword in "if exists" checks (#109) (#110) |
Date: |
Fri, 8 Nov 2024 21:59:02 -0500 (EST) |
branch: externals/sql-indent
commit 2ed4c6a26b8f3d651ac6231eaafb2565d77c918b
Author: Alex Harsányi <alex-hhh@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Consider "column" keyword in "if exists" checks (#109) (#110)
... to avoid indenting an "if" block in such cases
---
sql-indent-test.el | 7 ++++++-
sql-indent.el | 4 ++--
test-data/pr109-syn.eld | 5 +++++
test-data/pr109.sql | 3 +++
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/sql-indent-test.el b/sql-indent-test.el
index c0ab6f46ec..707427a539 100644
--- a/sql-indent-test.el
+++ b/sql-indent-test.el
@@ -1,6 +1,6 @@
;;; sql-indent-test.el --- Automated tests for sql-indent.el. -*-
lexical-binding: t -*-
-;; Copyright (C) 2017 Free Software Foundation, Inc
+;; Copyright (C) 2017, 2024 Free Software Foundation, Inc
;; Author: Alex Harsanyi (AlexHarsanyi@gmail.com)
;; Created: 23 May 2017
@@ -513,4 +513,9 @@ information read from DATA-FILE (as generated by
"test-data/pr107.sql"
"test-data/pr107-syn.eld"))
+(ert-deftest sqlind-ert-pr109 ()
+ (sqlind-ert-check-file-syntax
+ "test-data/pr109.sql"
+ "test-data/pr109-syn.eld"))
+
;;; sql-indent-test.el ends here
diff --git a/sql-indent.el b/sql-indent.el
index 76d06fb9ce..ae65766cc5 100644
--- a/sql-indent.el
+++ b/sql-indent.el
@@ -1,6 +1,6 @@
;;; sql-indent.el --- Support for indenting code in SQL files. -*-
lexical-binding: t -*-
-;; Copyright (C) 2015, 2017-2018 Free Software Foundation, Inc
+;; Copyright (C) 2015, 2017-2018, 2024 Free Software Foundation, Inc
;; Author: Alex Harsanyi <AlexHarsanyi@gmail.com>
;; Created: 27 Sep 2006
@@ -496,7 +496,7 @@ We try to avoid false positives, like \"end if\" or the
various
(forward-word -1)
;; we don't want to match an "end if", and things like "drop index if
;; exists..." and "create index if not exist..."
- (not (looking-at
"end\\|schema\\|table\\|view\\|index\\|constraint\\|type\\|trigger\\|procedure\\|function\\|routine\\|package\\|body\\|extension")))))
+ (not (looking-at
"end\\|schema\\|table\\|column\\|view\\|index\\|constraint\\|type\\|trigger\\|procedure\\|function\\|routine\\|package\\|body\\|extension")))))
(defun sqlind-maybe-if-statement ()
"If (point) is on an IF statement, report its syntax."
diff --git a/test-data/pr109-syn.eld b/test-data/pr109-syn.eld
new file mode 100644
index 0000000000..5ac82247d6
--- /dev/null
+++ b/test-data/pr109-syn.eld
@@ -0,0 +1,5 @@
+(((toplevel . 1))
+ ((toplevel . 1))
+ ((comment-start . 1)
+ (toplevel . 1))
+ ((toplevel . 1)))
diff --git a/test-data/pr109.sql b/test-data/pr109.sql
new file mode 100644
index 0000000000..b80b20b810
--- /dev/null
+++ b/test-data/pr109.sql
@@ -0,0 +1,3 @@
+alter table sometable drop column if exists col;
+
+-- this line should not be indented
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/sql-indent 2ed4c6a26b: Consider "column" keyword in "if exists" checks (#109) (#110),
ELPA Syncer <=