dense-analysis / dense-analysis/ale
mcs (mono) on Windows fails to lint
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
TLDR: You need to make a batch file to use mcs linter on Windows
## Information
**VIM version**
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 1 2017 22:02:48)
MS-Windows 64-bit GUI version with OLE support
Operating System: Win10
### :ALEInfo
Current Filetype: cs
Available Linters: ['mcs', 'mcsc']
Enabled Linters: ['mcs', 'mcsc']
Linter Variables:
let g:ale_cs_mcs_options = ''
let g:ale_cs_mcsc_assemblies = []
let g:ale_cs_mcsc_assembly_path = []
let g:ale_cs_mcsc_options = ''
let g:ale_cs_mcsc_source = ''
Global Variables:
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_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
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_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 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 = '>>'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
(executable check - failure) mcs
## What went wrong
Linting doesn't work. Vim doesn't think I have mono. I installed with [their instructions](http://www.mono-project.com/docs/getting-started/install/windows/). The "Mono 64-bit (no GTK#)" installer doesn't let you choose a destination, it just goes into program files. Added that to vimrc:
let $PATH = $PATH . ';"C:/Program Files/Mono/bin/"'
But I get the above failure.
Checking from vim:
:echo executable('mcs')
0
:!mcs --version
C:\WINDOWS\system32\cmd.exe /c (mcs --version)
Mono C# compiler version 5.8.0.0
So I can run it, but vim doesn't know about it.
## Workaround
Create a batch file:
C:/bin/mcs.cmd
@echo off
call "%ProgramFiles%\Mono\bin\mcs.bat" %*
Add c:/bin to your PATH.
Restart vim.
It works!
## Conclusion
It doesn't seem that vim can't look at stuff in Program Files (works with TortoiseSVN executables). I think it's because Mono has a bash `mcs` file and a batch `mcs.bat`, but I don't understand how that breaks things. Renaming `mcs` to `mcs_other` seems to also fix it. Editing the linter to use mcs.bat didn't seem to fix it.
I know vim searches for multiple extensions (`:help executable()`), so I guess that's related:
:Verbose ec $PATHEXT
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.wlua;.lexe
I'm happy to use the batch file. I'm not sure how you'd attempt to fix this, but I hope this info is useful to someone else.
Contributor guide
Assessment
This issue has not been assessed yet.