Skip to content

Instantly share code, notes, and snippets.

@wedens
Last active August 7, 2019 10:05
Show Gist options
  • Save wedens/1211482f2bfa97d8e6c501f7c630a796 to your computer and use it in GitHub Desktop.
Save wedens/1211482f2bfa97d8e6c501f7c630a796 to your computer and use it in GitHub Desktop.
full sql-mode in doobie interpolators
(use-package polymode
:commands poly-scala-mode
:mode ("\\.scala\\'" . poly-scala-mode)
:config
(define-hostmode poly-scala-hostmode
:protect-syntax nil
:protect-font-lock t
:mode 'scala-mode)
(define-innermode poly-scala-sql-multiline-innermode
:mode 'sql-mode
:body-indent-offset 'scala-indent:step
:head-matcher "\\(sql\\|fr\\)\"\"\"[ \t]*\n?"
:tail-matcher "[ \t]*\"\"\"")
(define-innermode poly-scala-sql-innermode
:mode 'sql-mode
:head-matcher "\\(sql\\|fr\\)\""
:tail-matcher (cons "\\(^\\|[^\\\\]\\)\\(\"\\)" 2))
(define-polymode poly-scala-mode
:hostmode 'poly-scala-hostmode
:innermodes '(poly-scala-sql-multiline-innermode
poly-scala-sql-innermode))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment