dense-analysis / ale

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

On Windows 11, shell=pwsh/powershell continues breaking ALE lint #4768

Open wunewww opened 4 months ago

wunewww commented 4 months ago

Information

VIM version

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan  2 2024 23:53:44)
MS-Windows 64-bit console version

Operating System:

Edition Windows 11 Pro
Version 23H2
Installed on    ‎17/‎06/‎2023
OS build    22631.3527
Experience  Windows Feature Experience Pack 1000.22700.1003.0

What went wrong

On Windows 11, Vim 9.1, when set shell=pwsh.exe or set shell=powershell.exe, ale will excute commands in wrong format.

To be specific, I am using vale to lint my markdown file. when set shell=cmd.exe, ale will excute CMD like (excerpted from :ALEInfo)

cmd /s/c "vale --output=JSON  C:\Users\NIUZHA~1\AppData\Local\Temp\VMQ43BA.tmp\README.md"

when set shell=pwsh.exe, it will be

cmd /s/c "''vale'' --output=JSON  ''C:\Users\NIUZHA~1\AppData\Local\Temp\VA2D6D5.tmp\README.md''"

which could not be recognized by cmd.exe.

Similar issue may have been discussed at #2009

Reproducing the bug

  1. On windows 11, vim 9.1, set shell=pwsh.exe, open vim and trigger ale.
  2. :ALEInfo shows above, and (finished - exit code 1)

:ALEInfo

Error log appears at the bottom.

Expand Current Filetype: markdown Available Linters: ['alex', 'cspell', 'languagetool', 'markdownlint', 'marksman', 'mdl', 'proselint', 'redpen', 'remark_lint', 'textlint', 'vale', 'writegood'] Linter Aliases: 'remark_lint' -> ['remark-lint'] 'writegood' -> ['write-good'] Enabled Linters: ['alex', 'cspell', 'languagetool', 'markdownlint', 'marksman', 'mdl', 'proselint', 'redpen', 'remark_lint', 'textlint', 'vale', 'writegood'] Ignored Linters: [] Suggested Fixers: 'dprint' - Pluggable and configurable code formatting platform 'pandoc' - Fix markdown files with pandoc. 'prettier' - Apply prettier to a file. 'remark-lint' - Fix markdown files with remark-lint '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: " Press Space to read :help for a setting let g:ale_markdown_markdownlint_executable = 'markdownlint' let g:ale_markdown_markdownlint_options = '' let g:ale_markdown_marksman_executable = 'marksman' let g:ale_markdown_mdl_executable = 'mdl' let g:ale_markdown_mdl_options = '' let g:ale_markdown_remark_lint_executable = 'remark' let g:ale_markdown_remark_lint_options = '' let g:ale_markdown_remark_lint_use_global = 0 let g:ale_markdown_vale_executable = 'vale' let g:ale_markdown_vale_input_file = '%t' let g:ale_markdown_vale_options = '' Global Variables: " Press Space to read :help for a setting 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 = 'auto' let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'Warning' let g:ale_enabled = 1 let g:ale_fix_on_save = 1 let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace']} let b:ale_fixers = ['pandoc', 'remove_trailing_lines', 'trim_whitespace'] 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 = 1 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'normal' let g:ale_linter_aliases = {} let g:ale_linters = {} 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 = '%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 = 0 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_root = {} let g:ale_set_balloons = 0 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 = 'E' let g:ale_sign_info = 'I' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = 'E' let g:ale_sign_style_warning = 'W' let g:ale_sign_warning = 'W' 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 LSP Error Messages: (Errors for marksman) Failed to find project root, language server won't start. Command History: (executable check - failure) alex (executable check - failure) cspell (executable check - failure) languagetool (executable check - failure) markdownlint (executable check - failure) mdl (executable check - failure) proselint (executable check - failure) redpen (executable check - failure) remark (executable check - failure) textlint (executable check - success) vale (finished - exit code 1) 'cmd /s/c "''vale'' --output=JSON ''C:\Users\NIUZHA~1\AppData\Local\Temp\VA2D6D5.tmp\README.md''"' <<>> (executable check - failure) write-good
wunewww commented 4 months ago

currently, I manually set let g:ale_shell='cmd.exe' and let g:ale_shell_arguments='\s\c' to fix this problem. This is in the same with ALE default behavior, there may be some problems with parsing commands on Windows, when set shell=pwsh.exe.