latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.55k stars 53 forks source link

Completions from custom .sty not appearing #539

Closed thomasbreydo closed 2 years ago

thomasbreydo commented 2 years ago

It seems as though #100 was supposed to fix this / did fix this? But for some reason I still get the following behavior:

  1. Ensure that kpsewhich -var-value TEXMFHOME is ~/Library/texmf/tex/latex/
  2. Create a thomas.sty file in ~/Library/texmf/tex/latex/
  3. Ensure that kpsewhich thomas.sty prints ~/Library/texmf/tex/latex/thomas.sty
  4. The thomas style file does not appear in the list of suggestions when typing \usepackage{ (unlike, say, theorem). Also, the commands/environments defined in thomas.sty do not show up as suggestions after \ in math mode.

This feels very similar to #383, which was closed by the issue author even though it seems that no solution was found.

pfoerster commented 2 years ago

Thanks for the report! I assume you use a distro based on TexLive.

I think you need to regenerate the ls-R file. The mktexlsr script should be helpful in this case. texlab does not consult kpsewhich directly for every file (this would be way too slow). Instead, we use the ls-R files (and the fndb files on MikTeX) so thomas.sty needs to be a part of that file to get picked up by texlab.

thomasbreydo commented 2 years ago

Hi @pfoerster, thank you so much for the quick reply! Regenerating the ls-R file with mktexlsr ~/Library/texmf fixed my issue :)

For those with the same issue, note that the texmf folder can be found with kpsewhich -var-value TEXMFHOME.