Closebrackets add-on problem with qoutes


#1

Hello, I have a strange problem with Closebrackets addon. It doesn’t work in full for quotes and some other custom pairs I defined in autoCloseBrackets option.

For example: if I select a word and hit " the word is correctly enclosed with a " on both sides. But when I just type one ", the magic doesn’t happen. The same goes for single quotes '.

Typing ( or { or even < that I added to pairs works well in both cases, with selection or without it.

I am using gfm mode, but even If I disable it the problem is still there. This is my pairs string:

pairs: "\"\"**<>//__()[]{}''``"

I am wondering if you might have an insight on what may be the problem. And I know that it works on a demo page.

Regards,
Iztok


#2

Completion of pairs of identical characters must depend on context to figure out whether you are opening or closing, and as such, it currently only works for languages that style quoted tokens (using a string token type).


#3

I see. I’ll look into it. Thanks again,
Iztok


#4

Hello again, is it possible to pass new auto close brackets pairs via options (when creating new cm instance)? I am using:

...
autoCloseBrackets: {
	pairs: "\"\"**<>//__()[]{}''``",
	triples: "",
	explode: "[]{}"
}
...

New pairs defined in options never override defaults provided in closebrackets.js. I am using Markdown mode and I did disable the mode specific pairs by overriding:

closeBrackets: true,

in markdown.js.

But if I edit defaults directly in closebrackets.js, new pairs work fine. What am I missing?

Thanks,
Iztok


#5

It doesn’t look like you did. You’ll need to pass an option like closeBrackets: {pairs: "...", override: true}