nikitakunevich / vscode-snippet-creator

vscode extension for creating snippets
MIT License
44 stars 25 forks source link

tab escape #6

Open lrstanley opened 6 years ago

lrstanley commented 6 years ago

Doesn't seem to handle tab indentation properly. E.g. Highlighting code with tabs (\t) gets translated to \\t within the snippet. Thus, when using the snippet, it isn't creating a literal tab, but rather an escaped \t.

mrTag commented 6 years ago

Hm, there is a line in extension.js that specifically does this: function buildBodyFromText(text) { var fixed = text.replace(/\t/g, '\t'); return fixed.split("\n"); } When I just return text.split("\n") in this function everything seems to work just as I expect it... Anybody knows the reason for that "fix"? :)

As a workaround you can do this @lrstanley: just replace fixed.split with text.split in the extension.js file line 202 (in Windows you can find that file in your users folder: C:\Users\username.vscode\extensions\nikitaKunevich.snippet-creator-0.0.4\extension.js) restart vscode after the change.