From be4a6695890eb5e0a81d0f359265bf32c47b06f5 Mon Sep 17 00:00:00 2001 From: "HINO, Katsuya" Date: Fri, 8 Aug 2014 18:06:48 +0900 Subject: [PATCH] Fix not to create NUL file by tsc in Windows In windows, `tsc`, the TypeScript compiler for Node.js, creates the file passed by `--out` argument, even if the file name is `NUL`. This will pass a temporary file name to `--out` argument, and remove the file after compilation, only in Windows. --- syntax_checkers/typescript/tsc.vim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index d2e7349d9..c66ab1922 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -13,9 +13,15 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_typescript_tsc_GetLocList() dict + if syntastic#util#isRunningWindows() + let out = tempname() + elseif + let out = syntastic#util#DevNull() + endif + let makeprg = self.makeprgBuild({ \ 'args': '--module commonjs', - \ 'args_after': '--out ' . syntastic#util#DevNull() }) + \ 'args_after': '--out ' . out }) let errorformat = \ '%E%f %#(%l\,%c): error %m,' . @@ -28,6 +34,10 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() dict \ 'errorformat': errorformat, \ 'defaults': {'bufnr': bufnr("")} }) + if syntastic#util#isRunningWindows() + call delete(out) + endif + call self.setWantSort(1) return loclist