Sublime Forum

Autocomplete with quotation marks

#1

Hi,

I’m trying to create some custom autocompletions. It works fine as long as I don’t use quotation marks. For example,

{ "trigger": "<Test", "contents": "<Test>"}

works as expected. I type <T and it autocompletes to <Test>. But the following doesn’t work:

{ "trigger": "\"Test", "contents": "\"Test\""}.

If I type T and choose autocomplete then I end up with "Test", which is finde, but if I type "T then I end up with "Test"", two quotation marks at the end. Am I doing something wrong?

I’m using Sublime 3, Build 3083, Windows 7, 64 bit

0 Likes

#2

The extraneous quoation mark at the end is most likely from ST auto-matching quotation marks when you type them around whitespace, just like for other brackets. Set "auto_match_enabled": false to disable that.

0 Likes

#3

Thanks for your reply. Disabling auto-matching changes the behaviour but isn’t really a solution. I need auto-matching for brackets, etc. and even without auto-matching enabled it works for brackets but not for quotation marks. Shouldn’t the behaviour for brackets and quotation marks be the same?

0 Likes

#4

I’m not sure I understand. What happens when exactly?

0 Likes

#5

The following works as expected:

{ "trigger": "<Test", "contents": "<Test>"}

I type <T and it autocompletes to <Test>.

The following doesn’t work and is the same as the first example except that the bracket is now a quotation mark:

{ "trigger": "\"Test", "contents": "\"Test\""}.

If I type T and choose autocomplete then I end up with "Test", which is fine, but if I type "T then I end up with "Test"", two quotation marks at the end.

So it seems that brackets behave differently than quotation marks.

0 Likes

#6

Angled brackets are not auto-matched.

You can probably get behind this more easily by inspecting the default keybindings.

0 Likes

#7

Oh, yeah, I used different types of brackets for different tests. I get it now. The auto-matching interferes with the auto complete. That’s not great but I guess there’s no way to change that except for turning the auto-matching off?!

Thanks for your help!

0 Likes