xolox / vim-shell

Improved integration between Vim and its environment (fullscreen, open URL, background command execution)
http://peterodding.com/code/vim/shell/
169 stars 13 forks source link

MakeWithShell & C# #15

Open mMontu opened 11 years ago

mMontu commented 11 years ago

Hello Peter,

I've just noticed that :MakeWithShell doesn't works very well when compiling C# code.

Using compiler msbuild (from https://groups.google.com/forum/?fromgroups=#!topic/vim_dev/q644Mx3ehYM) and :make on files with errors, followed by :cwindow does open the quickfix window. Replacing make with :MakeWithShell doesn't opens the quickfix, similar to sucessful compilation result.

Is it possible to change :MakeWithShell so it works like :make on this case?

xolox commented 11 years ago

I can't easily test this because I don't do much Windows development and don't have a C# environment set up. Can you edit a C# file, run the Vim command :verbose MakeWithShell and report the output here? You can recall the output using Vim's :messages command if the messages scroll out of view. I don't think you can easily copy/paste that text on Windows, but a screenshot is fine with me :-).

mMontu commented 11 years ago

Output of :verbose MakeWithShell:

shell.vim 0.13: Running make command: msbuild /nologo /v:q /property:GenerateFullPaths=true
C:\Test\Test
shell.vim 0.13: Checking if compiled DDL is supported ..
shell.vim 0.13: Called function libversion() in DLL C:\Portable\PortableApps\gVimPortable\Data\settings\vimfiles\bundle\shell_a04b3abc28\misc\shell\shell-x86.dll, returning string '0.5' in 0.0013 seconds.
vim-misc 1.0: Executing external command using compiled DLL: (msbuild /nologo /v:q /property:GenerateFullPaths=true 2>&1) 1>"C:\DOCUME~1\...\VIK127.tmp" 2>"C:\DOCUME~1\...\VIL128.tmp"
shell.vim 0.13: Executing external command: cmd.exe /c "(msbuild /nologo /v:q /property:GenerateFullPaths=true 2>&1) 1>"C:\DOCUME~1\...\VIK127.tmp" 2>"C:\DOCUME~1\...\VIL128.tmp""
shell.vim 0.13: Called function execute_synchronous() in DLL C:\Portable\PortableApps\gVimPortable\Data\settings\vimfiles\bundle\shell_a04b3abc28\misc\shell\shell-x86.dll, returning string 'exit_code=1' in 0.59 seconds.
No matching autocommands
(1 of 3): c:\Test\Test\Program.cs(12,17): error CS0103: The name 'x' does not exist in the current context [C:\Test\Test\Test.csproj]

Output of :verbose make:

C:\Test\Test
:!msbuild /nologo /v:q /property:GenerateFullPaths=true  >C:\DOCUME~1\...\VIe12A.tmp 2>&1

shell returned 1

The output messages can be copied with :redir @+ & :redir end, even on windows; but screenshot are still useful :)

quickfix_makewithshell

quickfix_make

For some reason the errors aren't recognized when :MakeWithShell is executed.

Please let me know if there are any tests I can perform.

xolox commented 11 years ago

For some reason it seems like :cexpr is not respecting the error format set by the msbuild compiler plug-in. It's very strange though that this works fine for other compilers, even on Windows (I use it to compile shell.c and it works quite nicely).