I am sorry to start yet another thread on autocompletion to this forum. I did consider appending my main questions to one of the others but that doesn’t seem right somehow. I am a newbie on ST2, and actually just deciding whether to stick with it. I am computer literate but I don’t know the python language or json text formatting and have no desire to learn either.
Nonetheless, I do like many parts of this program, otherwise I wouldn’t bother posting here at all, but there are some parts I just don’t like. A major one is the almost complete absence of sensible help files. I don’t understand how this program can be considered to be in version 1, let alone a candidate for version 2, when its only help documentation is written like a collection of programmers’ telegrams.
However, on to my problem. I have a bunch of files with .txt extensions which I want to highlight as html. (I’ve got that highlighting working.) I also want many tab completions to insert as HTML code but also want others to insert technical terms of my choice - maybe RNA as ribonucleic acid, that kind of stuff.
I have been trying to get ST2 to simply to autocomplete in this way and want it to draw its completions from a file or files of my choice, not from some arbitrary list drawn up by the progammer, presumably Jon Skinner. As a test, I have been trying to get br-tab to autocomplete to
. (By default, it completes to
- simple enough one might think and I can do it, but not in the way I think is needed. If I go into the default HTML/HTML.sublime-completions file and edit it I can get br-tab to complete as
. Similarly, I assume that to get the <br_tab to complete to
I would need to edit the HTML/html_completions.py file - I haven’t done that but I assume it would work.
However, I learned these things more by trial and error than via the documentation files which, as I say, seem like waste of time to me. Moreover, there still seem to be quite a few completions whose source I don’t understand or have the ability to control. More importantly, I think editing those files in the default directory would be bad because any changes I make there might be overwritten by any future upgrade. What I need is to set things up so that the completions arise from files in the user directory, where they wouldn’t be touched by program upgrades, and I can’t get files in that folder to do anything at all.
I have tried copying the HTML default files into the user directory, but I have not succeeded in getting my changes to be recognized as the required completions. Also, I have not succeeded in switching off the completions in the default folder, which I would like to do.
I can get completions like this to work in snippets, but I don’t want a separate snippet file for every trivial text replacement like that. So, now I have some questions.
-
How does one set up completions (or other preference) so that those specified in the user folder take precedence over those in the default folders? How could I turn of the default completions altogether, so that only those controlled by the user directory or drawn from active files are operational?
-
What is the precise set of files from which autocompletion data is drawn and what is the order of preference assigned to them? It would be useful to have a clear order of priority so that, without random experiments, a user could infer which file is providing any particular completion.
-
I think part of my problem comes from the “scope” syntax found at the beginning of many of these files, since I have .txt files that I want to act as html. Here is an example of the syntax I mean.
“scope”: “text.html - source - meta.tag, punctuation.definition.tag.begin”
It would be useful to know what exactly this kind of thing, at the beginning of a file, means but the explanation should preferably be in English, rather than python. The scope directive seems to be sending the system to the html defaults and, if so, I want to know how to write a line that redirects it to files in the user folder or to files with a .txt ending. -
Can a collection of snippets be assembled into a single user file? If so, how?