微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在vim中使用tsconfig.json进行合成

我想使用合成插件 vim给我现场错误检查,而我正在编写的文件,使用tsc文件.我已经在vim中启动了tsc.任何建议,我如何可以让tsc使用最亲密的父亲的tsconfig.json文件作为配置?我发现tsc认不这样做,这使得复合配置变得困难.谢谢!

编辑:我认为没有使用tsconfig.json的原因是因为像模块解析方法这样的选项似乎不起作用(“require”没有定义),而且它也没有捕获我的文件定义文件属性在tsconfig.json.

我未能尝试解决这个问题:

let g:syntastic_typescript_checks=['tsc','tslint']

" typescript: find tsconfig.json
function! FindTypescriptRoot()
    return fnamemodify(findfile('tsconfig.json','./;'),':h')
endfunction

let g:syntastic_typescript_tsc_args=['-p',FindTypescriptRoot()]

这导致Syntastic吐槽给我这个错误

app.ts|| TS5042: Option 'project' cannot be mixed with source files on a command line.

这可能是因为它运行像tsc -p / path / to / project / app.ts这样的命令,这是非法使用该标志…但是我不明白为什么我的tsconfig.json中的设置被忽略通过综合:(

概要

将let g:syntastic_typescript_tsc_fname =”添加到.vimrc.

细节

正如his answer提到的romainl,Typescript wiki的“Using tsconfig.json”部分指出:

By invoking tsc with no input files,in which case the compiler searches for the tsconfig.json file starting in the current directory and continuing up the parent directory chain.

您可以在Vim中使用Syntastic,通过将以下内容添加到.vimrc或.vimrc.after中,如果您使用Janus,如LCD 047Syntastic issue #1628答案中所述:

let g:syntastic_typescript_tsc_fname = ''

原文地址:https://www.jb51.cc/vim/386050.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐