Quramy / tsuquyomi

A Vim plugin for TypeScript

Home Page:http://www.vim.org/scripts/script.php?script_id=5151

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only enable for *.js files when tsconfig.json present?

fidian opened this issue · comments

You have a wonderful plugin.

Is there a way to enable g:tsuquyomi_javascript_support only when the current directory or any parent has a tsconfig.json file? Right now I am thinking of adapting the routine found here, but would prefer if this was built into the plugin so it could just happen automatically.

Here's my attempt at making it work - I did not try this nor am I great at vimscript.

let local_path = "/"
let path_parts = split(getcwd(), "/")
for path_part in path_parts
    let local_path = local_path . path_part . "/"
    if filereadable(local_path . "tsconfig.json")
        let g:tsuquyomi_javascript_support = 1
    endif
endfor
unlet local_path path_parts