Skip to content

Commit dcf4d3a

Browse files
committed
Properly escape strings for snippets
Surfaced when completing the `word_separators` setting.
1 parent f0bc60d commit dcf4d3a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugins_/settings/known_settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,9 @@ def _key_snippet(key, value, bol="", eol=",\n"):
408408
string: the contents field to insert into completions entry
409409
"""
410410
encoded = sublime.encode_value(value)
411-
encoded = encoded.replace("$", "\\$") # escape snippet markers
411+
encoded = encoded.replace("\\", "\\\\") # escape snippet markers
412+
encoded = encoded.replace("$", "\\$")
413+
encoded = encoded.replace("}", "\\}")
412414

413415
if isinstance(value, str):
414416
# create the snippet for json strings and exclude quotation marks

0 commit comments

Comments
 (0)