Created
March 6, 2016 09:17
-
-
Save grncdr/0760c5452099bd7b983c to your computer and use it in GitHub Desktop.
Revisions
-
grncdr created this gist
Mar 6, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ function! LoadTsConfig() let search_depth = 20 let dirname = fnamemodify(expand('%'), ":p:h") while search_depth > 0 && dirname != "/" let search_depth = search_depth - 1 let filename = dirname . "/tsconfig.json" " while filename if filereadable(filename) let b:tsconfig_path = filename let tsconfig = jsondecode(join(readfile(filename))) if has_key(tsconfig, "compilerOptions") let extra_args = "" for [key, val] in items(tsconfig.compilerOptions) if match(key, "^out") >= 0 continue endif let extra_args = extra_args . " --" . key let val = tsconfig.compilerOptions[key] if type(val) != 6 " booleans are represented simply by being present let extra_args = extra_args . " " . val end endfor let b:syntastic_typescript_tsc_args = extra_args endif break endif let dirname = fnamemodify(dirname . "/..", ":p:h") endwhile endfunction au BufEnter *.ts call LoadTsConfig()