[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/sql-indent 7f649aa 1/9: Fix indentation for create sche
From: |
Alex Harsanyi |
Subject: |
[elpa] externals/sql-indent 7f649aa 1/9: Fix indentation for create schema if not exists (fixes #87) |
Date: |
Fri, 20 Mar 2020 19:08:01 -0400 (EDT) |
branch: externals/sql-indent
commit 7f649aa97eba2836f8cb1106fb3b01e59cfc71b9
Author: Alex Harsanyi <address@hidden>
Commit: Alex Harsanyi <address@hidden>
Fix indentation for create schema if not exists (fixes #87)
---
sql-indent-test.el | 5 +++++
sql-indent.el | 2 +-
test-data/pr87-syn.eld | 6 ++++++
test-data/pr87.sql | 3 +++
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/sql-indent-test.el b/sql-indent-test.el
index f9a5910..235fa7f 100644
--- a/sql-indent-test.el
+++ b/sql-indent-test.el
@@ -422,4 +422,9 @@ information read from DATA-FILE (as generated by
"test-data/pr85.sql"
"test-data/pr85-syn.eld"))
+(ert-deftest sqlind-ert-pr87 ()
+ (sqlind-ert-check-file-syntax
+ "test-data/pr87.sql"
+ "test-data/pr87-syn.eld"))
+
;;; sql-indent-test.el ends here
diff --git a/sql-indent.el b/sql-indent.el
index 7d84583..d77a73c 100644
--- a/sql-indent.el
+++ b/sql-indent.el
@@ -488,7 +488,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\\|table\\|view\\|index\\|trigger\\|procedure\\|function\\|package\\|body")))))
+ (not (looking-at
"end\\|schema\\|table\\|view\\|index\\|trigger\\|procedure\\|function\\|package\\|body")))))
(defun sqlind-maybe-if-statement ()
"If (point) is on an IF statement, report its syntax."
diff --git a/test-data/pr87-syn.eld b/test-data/pr87-syn.eld
new file mode 100644
index 0000000..c3be56e
--- /dev/null
+++ b/test-data/pr87-syn.eld
@@ -0,0 +1,6 @@
+(((comment-start . 1)
+ (toplevel . 1))
+ ((toplevel . 1))
+ ((comment-start . 1)
+ (toplevel . 1))
+ ((toplevel . 1)))
diff --git a/test-data/pr87.sql b/test-data/pr87.sql
new file mode 100644
index 0000000..eb388ee
--- /dev/null
+++ b/test-data/pr87.sql
@@ -0,0 +1,3 @@
+-- -*- mode: sql; sql-product: postgres; -*-
+CREATE SCHEMA IF NOT EXISTS test;
+-- this line must be toplevel
- [elpa] externals/sql-indent updated (08f0417 -> dad9605), Alex Harsanyi, 2020/03/20
- [elpa] externals/sql-indent 7f649aa 1/9: Fix indentation for create schema if not exists (fixes #87),
Alex Harsanyi <=
- [elpa] externals/sql-indent b694078 2/9: CREATE TABLE, VIEW and INDEX does not start a block (#89), Alex Harsanyi, 2020/03/20
- [elpa] externals/sql-indent 56be397 4/9: Create GH Action for build and test (#91), Alex Harsanyi, 2020/03/20
- [elpa] externals/sql-indent f75d7a7 3/9: Fixes to function and procedure block detection (#88, #90), Alex Harsanyi, 2020/03/20
- [elpa] externals/sql-indent e7795c7 6/9: Mode refinements in recognizing declare statements (#92), Alex Harsanyi, 2020/03/20
- [elpa] externals/sql-indent dad9605 9/9: Release 1.5, remove Travis, add GitHub Actions status badge, Alex Harsanyi, 2020/03/20
- [elpa] externals/sql-indent 5656cfb 8/9: Document limitations of recognizing DECLARE statements (#92), Alex Harsanyi, 2020/03/20
- [elpa] externals/sql-indent 7edd915 7/9: fixups for indenting where clauses (#93), Alex Harsanyi, 2020/03/20
- [elpa] externals/sql-indent 1bb06f8 5/9: Fix detection of DECLARE blocks in PostgresSQL (#92), Alex Harsanyi, 2020/03/20