Hi, I’m the developer of the LaTeXTools package. In order to be a good Atom citizen, I’m trying to support lazy-loading and only activate the plugin when a LaTeXTools command is invoked.
I’m having the following issue. Some of the commands I implemented insert a snippet (e.g., to wrap the selected test in an
\textbf command). In the main package file, I have a
consumeService method that saves the snippet service object for future use, as per the documentation. The problem is that that method is only called when the LaTeXTools package is activated. So, if I open a file, and invoke one of the snippet-insertion commands, the command fails. The problem is that the package is correctly activated, but the command is executed before
consumeService is invoked. As a consequence, the snippet service object is not yet available, and the command fails.
Is there any way to ensure that
consumeService is invoked before anything else, and in before any of the package commands is actually executed? I guess not, because
consumeService is a callback, but perhaps I misunderstand.
[Note that all is OK if I invoke some other LaTeXTools command: then, the package is activated, the snippet serivice object is retrieved, and all works as advertised.]