dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.38k stars 1.42k forks source link

Last update broke chktex linting for LaTeX it is needed to go back to reflog HEAD@{5} to have it back. #4712

Closed wcazzola closed 4 months ago

wcazzola commented 5 months ago

Information

VIM version

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 16 2024 00:00:00) Included patches: 1-31

Operating System: Linux Fedora 38

What went wrong

I use ALE installed via Plug. Today I updated it to the last release. This has broken the linting of LaTeX files with chktex. Better it works (checking :ALEInfo) but it is not copied in the lopen window and you can't navigate to the error.

To solve the issue I went back on the git repo with git checkout HEAD@{number}

The first one working is HEAD@{5} Since the value 5 depends on which revision you are on the one working has this extra information

Previous HEAD position was 8922478 Add biome support for javascript (#4701) HEAD is now at 9a23ec1 Ruff use json-lines output format (#4656)

Reproducing the bug

  1. update ALE plugin to the last version
  2. be sure chktex is one the chosen linter for LaTeX with let g:ale_linters = { 'latex' : ['chktex'] } or similar in your .vimrc
  3. create a file test.tex with content \documentclass{article} \begin{document} hello, () ( \end{document}
    1. This files has at least two problems normally showed by chktex/ALE
      • line 4 W: No match found for '('. (15)
      • line 5 W: Number of '(' doesn't match the number of ')'! (17) But with the last revision they are not shown neither in the lopen window that is empty nor as annotations in the code nor as a symbol in the left column

:ALEInfo

Expand Current Filetype: tex Available Linters: ['alex', 'chktex', 'cspell', 'lacheck', 'proselint', 'redpen', 'texlab', 'textlint', 'vale', 'writegood'] Linter Aliases: 'writegood' -> ['write-good'] Enabled Linters: ['chktex', 'proselint'] Ignored Linters: [] Suggested Fixers: 'latexindent' - Indent code within environments, commands, after headings and within special code blocks. 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'textlint' - Fix text files with textlint --fix 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line. Linter Variables: let g:ale_tex_chktex_executable = 'chktex' let g:ale_tex_chktex_options = '-I' Global Variables: let g:ale_cache_executable_check_failures = v:null let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = 100 let g:ale_completion_enabled = 1 let g:ale_completion_max_suggestions = 50 let g:ale_disable_lsp = 1 let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'E' let g:ale_echo_msg_format = '[%linter%]% code:% %s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'W' let g:ale_enabled = 1 let g:ale_fix_on_save = 0 let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace'], 'javascript': ['eslint']} let g:ale_history_enabled = 1 let g:ale_info_default_mode = 'preview' let g:ale_history_log_output = 1 let g:ale_keep_list_window_open = 0 let g:ale_lint_delay = 200 let g:ale_lint_on_enter = 1 let g:ale_lint_on_filetype_changed = 1 let g:ale_lint_on_insert_leave = 0 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'always' let g:ale_linter_aliases = {} let g:ale_linters = {'sh': ['shellcheck', 'shell'], 'cpp': ['gcc', 'clang'], 'text': ['vale', 'proselint', 'writegood'], 'latex': ['chktex', 'vale', 'proselint', 'writegood'], 'kotlin': ['kotlinc'], 'ada': ['gcc'], 'bash': ['shellcheck', 'bashate', 'shell'], 'ocaml': ['merlin'], 'erlang': ['dialyzer', 'erlc'], 'python': ['pylint', 'flake8', 'mypy'], 'tex': ['chktex', 'proselint'], 'pony': ['ponyc'], 'java': ['eclipselsp', 'checkstyle'], 'idris': ['idris'], 'scala': ['metals', 'fsc'], 'elixir': ['elixir', 'dialyxir', 'mix']} let g:ale_linters_explicit = 0 let g:ale_linters_ignore = {} let g:ale_list_vertical = 0 let g:ale_list_window_size = 10 let g:ale_loclist_msg_format = '[%linter%]% code:% %s' let g:ale_max_buffer_history_size = 20 let g:ale_max_signs = -1 let g:ale_maximum_file_size = v:null let g:ale_open_list = 1 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_root = {} let g:ale_set_balloons = 1 let g:ale_set_highlights = 1 let g:ale_set_loclist = 1 let g:ale_set_quickfix = 0 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 let g:ale_sign_error = '✘' let g:ale_sign_info = 'I' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = 'S✘' let g:ale_sign_style_warning = 'S▶' let g:ale_sign_warning = '▶▶' let g:ale_sign_highlight_linenrs = 0 let g:ale_type_map = {} let g:ale_use_neovim_diagnostics_api = 0 let g:ale_use_global_executables = v:null let g:ale_virtualtext_cursor = 'all' let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 Command History: (executable check - success) chktex (finished - exit code 2) ['/usr/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -s TabSize=1 -l ''.chktexrc'' -I < ''/tmp/vSLSNYi/4/prova.tex'''] <<>> stdinTabSize=134TabSize=111TabSize=137TabSize=1You should avoid spaces after parenthesis. stdinTabSize=182TabSize=179TabSize=118TabSize=1Use either `` or '' as an alternative to `"'. stdinTabSize=134TabSize=110TabSize=115TabSize=1No match found for `('. stdinTabSize=1144TabSize=11TabSize=117TabSize=1Number of `(' doesn't match the number of `)'! <<>> (executable check - success) proselint (finished - exit code 1) ['/usr/bin/bash', '-c', 'proselint ''/tmp/vSLSNYi/5/prova.tex'''] <<>> (finished - exit code 2) ['/usr/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -s TabSize=1 -l ''.chktexrc'' -I < ''/tmp/vSLSNYi/13/prova.tex'''] <<>> stdinTabSize=14TabSize=112TabSize=137TabSize=1You should avoid spaces after parenthesis. stdinTabSize=14TabSize=111TabSize=115TabSize=1No match found for `('. stdinTabSize=17TabSize=11TabSize=117TabSize=1Number of `(' doesn't match the number of `)'! <<>> (finished - exit code 1) ['/usr/bin/bash', '-c', 'proselint ''/tmp/vSLSNYi/14/prova.tex'''] <<>> (finished - exit code 2) ['/usr/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -s TabSize=1 -l ''.chktexrc'' -I < ''/tmp/vSLSNYi/15/prova.tex'''] <<>> stdinTabSize=14TabSize=112TabSize=137TabSize=1You should avoid spaces after parenthesis. stdinTabSize=14TabSize=111TabSize=115TabSize=1No match found for `('. stdinTabSize=17TabSize=11TabSize=117TabSize=1Number of `(' doesn't match the number of `)'! <<>> (finished - exit code 1) ['/usr/bin/bash', '-c', 'proselint ''/tmp/vSLSNYi/16/prova.tex'''] <<>>
hsanson commented 5 months ago

This PR #4661 caused the issue. Specifically this line: https://github.com/dense-analysis/ale/blob/master/ale_linters/tex/chktex.vim#L13

Removing that line seems to fix the issue.

wcazzola commented 5 months ago

Thank you for digging the issue. Can you fix it in? So that it will propagate with the next update?

wcazzola commented 4 months ago

Today I updated my plugins and it seems the problem is still there. Since the problem has been investigated and a solution found can be merged to the master? Or can be PR 4661 definitively reverted? Thank you.

Jorengarenar commented 4 months ago

I'm not even sure how I let that typo get there, but the fix is to replace -s with -S in line 13

wcazzola commented 4 months ago

thank you

hsanson commented 4 months ago

@Jorengarenar I believe we are not using the same chktex tool since there is no -S option supported on my chktex. This PR cases no output from chktex:

(executable check - success) chktex
(finished - exit code 1) ['/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -S TabSize=1 -I < ''/tmp/nvim.ryujin/99CfNd/2/test.tex''']

<<<NO OUTPUT RETURNED>>>

Using small -s uses TabSize=1 as splitchar that is correct according to documentation of chktex but causes ALE to break:

(executable check - success) chktex
(finished - exit code 2) ['/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -s TabSize=1 -I < ''/tmp/nvim.ryujin/6X7MzX/2/test.tex''']

<<<OUTPUT STARTS>>>
stdinTabSize=13TabSize=116TabSize=137TabSize=1You should avoid spaces after parenthesis.
stdinTabSize=13TabSize=115TabSize=115TabSize=1No match found for `('.
stdinTabSize=14TabSize=11TabSize=117TabSize=1Number of `(' doesn't match the number of `)'!
<<<OUTPUT ENDS>>>

Chktex help:

ChkTeX v1.7.6 - Copyright 1995-96 Jens T. Berger Thielemann.
Compiled with PCRE regex support.        

 -s  --splitchar : String used to split fields when doing -v0

I will move forward merging #4725 to remove this -s/-S option altogether.

Jorengarenar commented 4 months ago

@hsanson Indeed, version 1.7.6 (2016-09-09) doesn't have -S option, which was added in version 1.7.7 (2022-10-17). I'll add a check to test -S option availability.

wcazzola commented 4 months ago

my chktex v1.7.8 has both switches with really different meanings:

I don't know which should be the expected behavior but to avoid any mispelling/misinterpretations I would suggest to use the long version of the switch.

hsanson commented 4 months ago

I merged #4725 to fix the issue affecting users, including me. We can add the -S flag as long as it is optional via configuration or auto-detection of chktex version.

For those that need this flag they can use the g:ale_tex_chktex_options or chktexrc configuration to add it. Also note that according to the manual TabSize is by default 8 so not sure why this was needed on first place and that the -S flag does not seem documented: