Function: web-mode-sql-indentation

web-mode-sql-indentation is a natively compiled function defined in web-mode.el.

Signature

(web-mode-sql-indentation POS INITIAL-COLUMN LANGUAGE-OFFSET LANGUAGE &optional LIMIT)

Source Code

;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
(defun web-mode-sql-indentation (pos initial-column language-offset language &optional limit)
  (let ((open-ctx (web-mode-bracket-up pos language limit)) offset)
    ;;(message "%S %S %S %S %S" pos (point) initial-column language-offset open-ctx)
    (cond
      ((and (not (null open-ctx)) (not (null (plist-get open-ctx :pos))))
       (setq offset (+ (plist-get open-ctx :column) 1)))
      ((looking-at-p "\\(SELECT\\|INSERT\\|DELETE\\|UPDATE\\|FROM\\|LEFT\\|JOIN\\|WHERE\\|GROUP BY\\|LIMIT\\|HAVING\\|ON\\|select\\|insert\\|delete\\|update\\|from\\|left\\|join\\|where\\|group by\\|limit\\|having\\|on\\|AND\\|and\\|OR\\|or\\)")
       (setq offset initial-column))
      (t
       (setq offset (+ initial-column language-offset)))
      ) ;cond
    (cons (if (< offset initial-column) initial-column offset) open-ctx)
    ))