LaTeXTools
LaTeXTools copied to clipboard
Customize \ref completion
I love a feature of LatexTools: if I type \ref{, it automatically scans for all occurrences of \label{…} and offers these for some auto-completion.
How do I customize this? I want to achieve the same behavior with \thref{ and \thlabel{…} instead.
Thanks!
The behavior of ref and label is hard coded and not configurable.
You may however adapt the source code. Select View > Browse Packages... then open the LaTeXTools folder and the file latex_ref_completions.py.
Then add "th" to the array in this line (i.e. "title", "headname", "tocname", "th") to open the completion for \thref.
Then adapt this line to
for command in doc.filter_commands(['label', 'thlabel']):
and this line to
view.find_all(r'\\(?:th)?label\{([^\{\}]+)\}', 0, '\\1', completions)
to also scan the \thlabel commands
Thank you, r-stein, this works!