Aerijo / autocomplete-latex

A LaTeX autocomplete provider for Atom
MIT License
10 stars 2 forks source link

Help with adding custom completions #11

Closed pillsgood closed 6 years ago

pillsgood commented 6 years ago

I am trying to add custom completions for the package "physics" but i have no idea on how to begin. Can you please point me in the right direction?

I ran "apm develop autocomplete-latex" and then "apm link" in "dev/packages/autocomplete-latex" then made my changes after running "atom -d". Im not entirely sure if the steps i took were correct or not.

Ive tried editing completions.json but nothing seem to happen. e.g.: If i add a new snippet i don't see it at all, and if i edit a default snippet the changes dont take place.

Aerijo commented 6 years ago

For starters, there is no need to change any of the internals of this package. If you go into settings, the first one should be asking for a path to your custom completions. You can store your completions anywhere, so long as this setting points to it.

Regarding the custom completions file itself, the easiest way to do it is with a .json file type. The contents should be as follows:

{
  "text.tex.latex": {
    "snippets": [
      {
        "displayText": "\\customcommand",
        "snippet": "\\\\customcommand"
      },
      {
        "displayText": "\\secondCommand",
        "snippet": "\\\\secondCommand"
      }
    ]
  }
}