简体   繁体   English

Tsuquyomi 忽略打开时的错误

[英]Tsuquyomi ignores errors on open

I am using Tsuquyomi as a Syntastic plugin for checking TypeScript in Vim. I expect to see all errors when I open the file.我使用Tsuquyomi作为Syntastic插件来检查 Vim 中的 TypeScript。我希望在打开文件时看到所有错误。 Instead, I only see ESLint errors.相反,我只看到ESLint错误。 I can only see Tsuquyomi errors when saving or manually running the checker.保存或手动运行检查程序时,我只能看到 Tsuquyomi 错误。

In my .vimrc , I configure Syntastic to check with Tsuquyomi on open:在我的.vimrc中,我将 Syntastic 配置为在打开时使用 Tsuquyomi 检查:

" Configure syntax management
let g:syntastic_error_symbol = "✗"
let g:syntastic_warning_symbol = "⚠"
let g:syntastic_javascript_checkers = ['eslint', 'standard']
let g:syntastic_cs_checkers = ['syntax', 'semantic', 'issues']
let g:syntastic_ignore_files = ['Sync/ebs/*']
let syntastic_mode_map = { 'passive_filetypes': ['less'] }
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_typescript_checkers = ['tsuquyomi']
let g:tsuquyomi_disable_quickfix = 0
let g:syntastic_debug = 3
" Frustratingly necessary for syntastic redrawing
set autoread
set ttyfast
au FileWritePost * :redraw!
au TermResponse * :redraw!
au TextChanged * :redraw!
au QuickFixCmdPre * :redraw!
au QuickFixCmdPost * :redraw!

If I create a file with errors, for example x.ts :如果我创建了一个有错误的文件,例如x.ts

const a: number = 'a'

console.log('a test:', a)

When I open the file, no errors are shown.当我打开文件时,没有显示任何错误。 The output from :mes shows that Tsuquyomi hasn't found any errors:来自:mes的 output 表明 Tsuquyomi 没有发现任何错误:

"src/x.ts" 3L, 49C
syntastic: 0.544308: g:syntastic_version = '3.8.0-94 (Vim 801, Linux, GUI)'
syntastic: 0.544445: &shell = '/usr/bin/zsh', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellxescape = ''
syntastic: 0.544821: UpdateErrors (auto): default checkers
syntastic: 0.545096: CacheErrors: default checkers
syntastic: 0.545567: g:syntastic_aggregate_errors = 0
syntastic: 0.545754: getcwd() = '/home/david/Sync/phaser3-typescript-project-template'
syntastic: 0.550256: CacheErrors: Invoking checker: typescript/tsuquyomi
syntastic: 2.404657: getLocList: checker typescript/tsuquyomi returned 0
syntastic: 2.404823: typescript/tsuquyomi raw: []
syntastic: 2.405012: quiet_messages filter: {}
syntastic: 2.405159: getLocList: checker typescript/tsuquyomi run in 1.854759s
syntastic: 2.405434: aggregated: {'_sorted': 0, '_name': '', '_owner': 1, '_columns': 1, '_rawLoclist': []}

If I then manually check with :SyntasticCheck , the error does show, and it is listed in :mes :如果我然后手动检查:SyntasticCheck ,错误会显示,并且它列在:mes中:

Messages maintainer: Bram Moolenaar <Bram@vim.org>
"src/x.ts" 3L, 49C
syntastic: 0.432894: g:syntastic_version = '3.8.0-94 (Vim 801, Linux, GUI)'
syntastic: 0.432996: &shell = '/usr/bin/zsh', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellxescape = ''
syntastic: 0.433309: UpdateErrors (auto): default checkers
syntastic: 0.433540: CacheErrors: default checkers
syntastic: 0.434051: g:syntastic_aggregate_errors = 0
syntastic: 0.434179: getcwd() = '/home/david/Sync/phaser3-typescript-project-template'
syntastic: 0.646807: system: command run in 0.208338s
syntastic: 0.647076: CacheErrors: Invoking checker: typescript/eslint
syntastic: 0.647493: SyntasticMake: called with options: {'postprocess': ['guards'], 'errorformat': '%E%f: line %l\, col %c\, Error - %m,%W%f: line %l\, col %c\, Warning - %m', 'makeprg': 'eslint -f compact src/
x.ts'}
syntastic: 3.528810: system: command run in 2.880954s
syntastic: 3.529040: checker output: ['']
syntastic: 3.529402: raw loclist: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
syntastic: 3.530081: postprocess: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
syntastic: 3.530351: getLocList: checker typescript/eslint returned 0
syntastic: 3.530516: typescript/eslint raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
syntastic: 3.530739: quiet_messages filter: {}
syntastic: 3.530953: getLocList: checker typescript/eslint run in 2.883754s
syntastic: 3.531414: CacheErrors: Invoking checker: typescript/tsuquyomi
syntastic: 3.600012: getLocList: checker typescript/tsuquyomi returned 0
syntastic: 3.600261: typescript/tsuquyomi raw: []
syntastic: 3.600468: quiet_messages filter: {}
syntastic: 3.600669: getLocList: checker typescript/tsuquyomi run in 0.069068s
syntastic: 3.600990: aggregated: {'_sorted': 0, '_name': '', '_owner': 1, '_columns': 1, '_rawLoclist': []}
syntastic: 65.325780: g:syntastic_version = '3.8.0-94 (Vim 801, Linux, GUI)'
syntastic: 65.326247: &shell = '/usr/bin/zsh', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellxescape = ''
syntastic: 65.327336: UpdateErrors: default checkers
syntastic: 65.328042: CacheErrors: default checkers
syntastic: 65.329746: g:syntastic_aggregate_errors = 0
syntastic: 65.330482: getcwd() = '/home/david/Sync/phaser3-typescript-project-template'
syntastic: 65.332150: CacheErrors: Invoking checker: typescript/eslint
syntastic: 65.334221: SyntasticMake: called with options: {'postprocess': ['guards'], 'errorformat': '%E%f: line %l\, col %c\, Error - %m,%W%f: line %l\, col %c\, Warning - %m', 'makeprg': 'eslint -f compact src
/x.ts'}
syntastic: 67.663350: system: command run in 2.328375s
syntastic: 67.663507: checker output: ['']
syntastic: 67.663724: raw loclist: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
syntastic: 67.663915: postprocess: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
syntastic: 67.664079: getLocList: checker typescript/eslint returned 0
syntastic: 67.664235: typescript/eslint raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
syntastic: 67.664398: quiet_messages filter: {}
syntastic: 67.664516: getLocList: checker typescript/eslint run in 2.331968s
syntastic: 67.664731: CacheErrors: Invoking checker: typescript/tsuquyomi
syntastic: 67.720773: getLocList: checker typescript/tsuquyomi returned 0
syntastic: 67.720950: typescript/tsuquyomi raw: [{'lnum': 1, 'valid': 1, 'col': 7, 'availableCodeFix': 1, 'filename': '/home/david/Sync/phaser3-typescript-project-template/src/x.ts', 'bufnr': 1, 'code': 2322, 't
ype': 'E', 'text': '2322[QF available]: Type ''"a"'' is not assignable to type ''number''.'}]

How can I make Tsuquyomi show TypeScript errors when opening while ensuring I always see them as fast as possible?如何让 Tsuquyomi 在打开时显示 TypeScript 错误,同时确保我总是尽快看到它们?

You have this line:你有这一行:

let g:tsuquyomi_disable_quickfix = 1

This option suppresses to check the syntax/semantic.此选项禁止检查语法/语义。

It seems that saving and manually triggering are working despite of this setting and only the immediate check is blocked, as you observed.尽管有此设置,但似乎保存和手动触发仍在工作,正如您观察到的那样,只有立即检查被阻止。

Sources:资料来源:

https://github.com/Quramy/tsuquyomi/issues/183 https://github.com/Quramy/tsuquyomi/issues/183

Edit:编辑:

If that does not work, let's obey the documentations:如果这不起作用,让我们遵守文档:

Integrate with syntastic与合成器集成

If you use syntastic, you can use syntastic for displaying syntax and semantics errors instead of vim's default quickfix window. To integrate syntastic, write the following setting to your.vimrc.如果你使用 syntastic,你可以使用 syntastic 代替 vim 默认的 quickfix window 来显示语法和语义错误。要集成 syntastic,请将以下设置写入 your.vimrc。

let g:tsuquyomi_disable_quickfix = 1
let g:syntastic_typescript_checkers = ['tsuquyomi'] " You shouldn't use 'tsc' checker.

syntastic has default TypeScript checker whose name is 'tsc'. syntastic 具有默认的 TypeScript 检查器,其名称为“tsc”。 You shouldn't use it with running Tusuquyomi because they don't share compile options.您不应该在运行 Tusuquyomi 时使用它,因为它们不共享编译选项。 Tusuquyomi's checker whose name is 'tsuquyomi' uses tsserver and your tsconfig.json. Tusuquyomi 的名为“tsuquyomi”的检查器使用 tsserver 和你的 tsconfig.json。

You seem to have on that second line:你似乎在第二行:

let g:syntastic_typescript_checkers = ['eslint', 'tsuquyomi']

I would test dropping the 'eslint' away, see if it helps, and if you really like both at same time, we should look for other way to configure them.我会测试去掉“eslint”,看看它是否有帮助,如果你真的同时喜欢两者,我们应该寻找其他方式来配置它们。

Sources:资料来源:

https://github.com/Quramy/tsuquyomi https://github.com/Quramy/tsuquyomi

Edit2:编辑2:

[..], each checker will be called, in order, as long as the previous checkers don't return an error. [..],只要前面的检查器不返回错误,就会按顺序调用每个检查器。 In that case, you might want to list checkers from fastest to slowest, or from looser to stricter.在这种情况下,您可能希望从最快到最慢,或从宽松到严格列出跳棋。

So, does your eslint error(s) actually prevent tsuquyomi showing its own one(s)?那么,您的 eslint 错误是否实际上阻止了 tsuquyomi 显示自己的错误? Would be worth checking to change their order.值得检查以更改他们的订单。

Sources:资料来源:

https://blog.jpalardy.com/posts/how-to-configure-syntastic/ https://blog.jpalardy.com/posts/how-to-configure-syntastic/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM