Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neovim: Skipping text check as LTeX has been disabled for files with code language ID 'tex' via ltex.enabled #278

Open
VukanJ opened this issue Oct 17, 2023 · 3 comments
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label)

Comments

@VukanJ
Copy link

VukanJ commented Oct 17, 2023

Describe the bug
ltex-ls refuses to check grammar in some latex documents (and reports unexpected errors) while it works fine in main.tex and some other random files which are not the main.tex file.

Steps to reproduce
start neovim
Install ltex-ls with mason.nvim
Create main.tex with minimal setup:

\documentclass{article}
\begin{document}
This documenet is great.
\input{introduction}
\end{document}

A spelling diagnostic appears for "documenet", this is expected.
Then create a file introduction.tex and write

\section{intro}
This is the introdcution.

No diagnostic appears despite the typo and the LspLog contains the following errors:

[START][2023-10-17 23:10:50] LSP logging initiated
[ERROR][2023-10-17 23:10:50] .../vim/lsp/rpc.lua:734	"rpc"	"ltex-ls"	"stderr"	'SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".\n'
[ERROR][2023-10-17 23:10:50] .../vim/lsp/rpc.lua:734	"rpc"	"ltex-ls"	"stderr"	"SLF4J: Defaulting to no-operation (NOP) logger implementation\nSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.\n"
[ERROR][2023-10-17 23:10:54] .../vim/lsp/rpc.lua:734	"rpc"	"ltex-ls"	"stderr"	"Oct 17, 2023 11:10:54 PM org.bsplines.ltexls.server.LtexLanguageServer initialize\nINFO: ltex-ls 16.0.0 - initializing...\n"
[ERROR][2023-10-17 23:10:54] .../vim/lsp/rpc.lua:734	"rpc"	"ltex-ls"	"stderr"	"Oct 17, 2023 11:10:54 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\nFINE: Skipping text check as LTeX has been disabled for files with code language ID 'tex' via ltex.enabled\n"
[ERROR][2023-10-17 23:11:15] .../vim/lsp/rpc.lua:734	"rpc"	"ltex-ls"	"stderr"	"Oct 17, 2023 11:11:15 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked\nFINE: Checking the following text in language 'en-US' via LanguageTool: \"\\n\\nThis documenet is great! \"\n"
[ERROR][2023-10-17 23:11:16] .../vim/lsp/rpc.lua:734	"rpc"	"ltex-ls"	"stderr"	"Oct 17, 2023 11:11:16 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\nFINE: Obtained 1 rule match\n"

Expected behavior

  • Grammar diagnostic messages should appear because of obvious typos, even if the file does not contain a "\begin...\end{document}".
  • ".tex" file endings should not be disabled as printed in the error message.
  • Info messages should not go to stderr?
  • Is the SLF4J error something the user should fix? If not, this is yet another bug i guess :) Also I failed to fix this error by myself as I don't work with java

Sample document
I use the default setup, no further configuration.

LTeX configuration
I do not configure ltex-ls, at all. I just installed it with mason.nvim

LTeX LS log
see error messages above

Version information
nvim 0.9.4
ltex-ls 16.0.0

  • Operating system: Linux (ArchLinux)
  • ltex-ls: 16.0.0
  • Java: openjdk version "21" 2023-09-19
    OpenJDK Runtime Environment (build 21+35)
    OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)

Additional context/information

@VukanJ VukanJ added 1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label) labels Oct 17, 2023
@cipollone
Copy link

cipollone commented Nov 4, 2023

Same issue.
nvim v0.7.2
ltex-ls 16.0.0
JAVA binary and paths correctly set by the ltex-ls script to the release directory

This does not happen with:
vim 9.0
coc.nvim
ltex-ls

I also see the error about the java logging class

@cipollone
Copy link

Solved by setting filetype from plaintex to tex.
Also solved by writing let g:tex_flavor = "latex" in ftplugin/tex.vim

@VukanJ
Copy link
Author

VukanJ commented Nov 20, 2023

I can confirm that setting the tex flavor in ftplugin seems to solve the problem of missing diagnostics. Thanks a lot, @cipollone . In my lua settings I added

vim.api.nvim_create_autocmd(
    {
        "BufNewFile",
        "BufRead",
    },
    {
        pattern = "*.tex",
        callback = function()
            vim.opt.filetype = "tex"
        end
    }
)

and under "after/ftplugin/tex.vim" the line you suggested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label)
Projects
None yet
Development

No branches or pull requests

2 participants