smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

Double curly brace in web-mode triggers creation of third unpaired brace

Open adelq opened this issue 9 years ago • 5 comments

I'm not sure what causes this bug, I don't know elisp but I'd be willing to help. I'm editing web templates in HTML files (specifically django templates), and I'm using web-mode. Essentially, smartparens expands the inside of a curly brace, but doesn't do so correct with double braces.

Bug:

Expected:
{|} -> {{|}} -> {{ | }}
Actual:
{|} -> {{|}} -> {{ | }}}

Works as expected:

{|} -> { | }
{|} -> {%|} -> {% | %}

adelq avatar May 22 '16 18:05 adelq

Probably web-mode tries to do the expantion as well and you get one too many. Do you use some special smartparens config, or a package like spacemacs, prelude? Sometimes configurations clash, it's quite common when multiple "smart/electric/auto..." packages get enabled at the same time.

Fuco1 avatar May 23 '16 09:05 Fuco1

I'm using spacemacs with nearly default settings. I don't think I have any other matching modes enabled, as when I disable smartparens in web-mode, I don't get any pairing of parens/braces, and entering a space in between braces has no effect (besides inserting the space).

After disabling smartparens-mode:

| -> {| -> {}| -> {|} -> { |}
{{|}} -> {{ |}}
{|} -> {%|} -> {% |}

adelq avatar May 23 '16 23:05 adelq

Though, it's definitely something else in the spacemacs default configuration, since installing web-mode and smartparens on a vanilla emacs install does not have the behavior described (no expansion of parens, correct or incorrect).

adelq avatar May 24 '16 00:05 adelq

It might be a good idea then to open an issue on spacemacs as well and link here. They are quite responsive, and if needed we can implement something on our side to make it work. But it's hard to tell what it is now.

Fuco1 avatar May 24 '16 08:05 Fuco1

Not sure if related but I had a similar issue when: {{|}} => {{ }}}} I've set (setq web-mode-enable-auto-pairing nil) to disable web-mode paring and rely only on smartparens. To make smartparens do what I want in web-mode I also added (require 'smartparens-config) to my settings to get a specific config for relevant modes (in this case web-mode). Please note I'm not using spacemacs

bobrowadam avatar May 15 '20 09:05 bobrowadam