syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.68k stars 4.89k forks source link

Smartparens mode gets disabled after auto-completing with yasnippet in Go mode. #16155

Closed rinconjc closed 10 months ago

rinconjc commented 1 year ago

Description :octocat:

Smartparens mode gets disabled after auto-completing with yasnippet in Go mode.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

Expected behaviour: :heart: :smile:

Potential solution:

(defvar spacemacs--smartparens-enabled-initially nil
  "Stored whether smartparens is originally enabled or not.")

(defun spacemacs//smartparens-disable-before-expand-snippet ()
  "Handler for `yas-before-expand-snippet-hook'.
Disable smartparens and remember its initial state."
  ;; Remember the initial smartparens state only once, when expanding a top-level snippet.
  (setq spacemacs--smartparens-enabled-initially (or spacemacs--smartparens-enabled-initially smartparens-mode smartparens-strict-mode))
  (spacemacs//deactivate-smartparens))

System Info :computer:

Backtrace :paw_prints:

<<BACKTRACE IF RELEVANT>>
smile13241324 commented 11 months ago

Solution sounds good PR would be welcome