glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.
GNU General Public License v3.0
4.79k stars 147 forks source link

Autoformatting of LaTeX files via coc-texlab latexindent fails #1317

Closed thesofakillers closed 2 years ago

thesofakillers commented 2 years ago

Issue Description

I use CoC a lot, particularly for its LSP offerings. For LaTeX, I make use of coc-texlab, which, among other things, allows me to autoformat latex files through the use of latexindent.

I was working on Overleaf.com, using firenvim, and tried calling the autoformatting like I normally would, but nothing happened.

From here I tried a few things:

So my conclusion is that for some reason, perhaps due to the internal machinations of latexindent, coc-texlab, firenvim, or some combination of these three, autoformatting with latexindent does not work in a firenvim instance, despite working in a normal nvim instance.

I understand this is a very niche issue and you may not have the bandwidth to solve it. If you have any ideas what's up, I'm all ears. If not, I thought I'd signal it here, in case someone else comes across this bug. Fortunately it's quite small and overall I'm very happy with firenvim.

PS: wrote this issue with firenvim ;).

glacambre commented 2 years ago

I think the problem probably is that latexindent is not in your $PATH. What happens when running :!which latexindent from firenvim and from the terminal?

thesofakillers commented 2 years ago

Forgot to mention that I also tried that. Running that command gives the same both from firenvim and from the terminal, i.e. I get /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin/latexindent, which seems correct.

glacambre commented 2 years ago

Does running :%!latexindent in a buffer containing the latex code you want to indent work when done from firenvim?

thesofakillers commented 2 years ago

Interesting. In my nvim terminal this prints x lines filtered when there is some autoformatting to do, or nothing. In firenvim, I get the following

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LC_ALL = (unset),
    LANG = "en_IT.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Can't locate YAML/Tiny.pm in @INC (you may need to install the YAML::Tiny module) (@INC contains: /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm line 20.
BEGIN failed--compilation aborted at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm line 20.
Compilation failed in require at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/TrailingComments.pm line 21.
BEGIN failed--compilation aborted at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/TrailingComments.pm line 21.
Compilation failed in require at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Replacement.pm line 20.
BEGIN failed--compilation aborted at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Replacement.pm line 20.
Compilation failed in require at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 27.
BEGIN failed--compilation aborted at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 27.
Compilation failed in require at /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin/latexindent line 27.
BEGIN failed--compilation aborted at /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin/latexindent line 27.

This is weird because I definitely have YAML/Tiny.pm installed.

thesofakillers commented 2 years ago

Fixed via this comment

thanks for the help!