area/language-latex

Support snippets when backslash for commands is already there

Closed this issue ยท 3 comments

Description

Add snippets that work when the command entered already starts with a \. If this sounds good I'd love to create a PR for it ๐Ÿ˜ƒ

Current behaviour

current

Expected behaviour

expected

Additional information

I think I figured out how to get this working by simply adding a new snippet where the prefix includes the \. For example for the \section command, adding the snippet below before the entry for section in language-latex.cson works for me (would be nice if someone could verify this):

  '\\section':
    'prefix': '\\section'
    'body': '\\\\section{${1:section name}}\n$0'

I guess this is a duplicate of #119, and there is a reasonable reason why the leading backslash is omitted in the snippet invocations.

First of all, my apologies for not finding the other issues related to this topic ๐Ÿ˜…

Secondly, if the reason you pointed out were true I understand that you won't fix it. However, I created the example .gifs using the snippet I provided (in light of the issues you referenced, I'm not sure why it works), would you at least be willing to try that and see if it works? (I only tried it on Windows so far, Atom v1.25.1)

Yep, I just tried it and it seems to work (1.26.0-beta1). I'll remove the wontfix label then, and support any PR to change it.