pears.nvim icon indicating copy to clipboard operation
pears.nvim copied to clipboard

Unexpected behavior with `tag_matching` preset

Open rawhat opened this issue 3 years ago • 0 comments

I have this preset enabled, and looking at the custom rules for should_expand, I would expect different behavior than I am seeing.

The rule for

-- Don't expand when there is a preceding character "SomeClass<T> (only for tsx)"
R.when(
  R.lang {"typescript", "tsx"},
  R.not_(R.start_of_context "[a-zA-Z0-9]")),

looks like it should allow the code structure in the comment. However, when I try this, I instead see:

SomeClass<T|
-- (press >)
SomeClass<T>|</T>
-- (press BS)
SomeClass<T|</T>

The behavior on backspace seems to imply that the "context" is actually correct, but the closing tag is being generated as well?

Additionally, the rule

-- Don't expand if we made a closing tag </div>
-- Don't expand if we made have a space after the opening angle 1 < 3
R.not_(R.start_of_context "<[/ ]"),

Appears to work correctly with closing tag. But with the numeric comparison example, I see the following:

1 < 3|
-- (press >)
1 < 3>|</>
-- (press BS)
1 < 3|</>

My config is essentially:

require("pears").setup(function(conf)
  conf.preset("tag_matching")
end)

Not sure if something changed, or I am missing some kind of other setup. Any help would be appreciated! Thank you.

rawhat avatar Sep 08 '21 17:09 rawhat