vim-syntastic / syntastic

Syntax checking hacks for vim
Do What The F*ck You Want To Public License
11.3k stars 1.14k forks source link

Errors ignored on open #2329

Closed davidystephenson closed 4 years ago

davidystephenson commented 4 years ago

I am using syntastic for TypeScript in vim using eslint and tsuquyomi. I expect to see all errors when I open the file. Instead, I only eslint errors. I can only see tsuquyomi errors when saving or manually running the checker.

In my .vimrc, I configure syntastic to check with tsuquyomi on open:

" 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:tsuquyomi_disable_quickfix = 1
let g:syntastic_check_on_open = 1
let g:syntastic_typescript_checkers = ['eslint', 'tsuquyomi']
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:

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 found no errors:

"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': []}

If I then manually check with :SyntasticCheck, the error does show, and it is listed in :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 Syntastic show typescript errors when opening while ensuring I always see them as fast as possible?

lcd047 commented 4 years ago

You have two checkers configured for typescript: eslint and tsuquyomi. On open both eslint and tsuquyomi return no error:

syntastic: 3.530516: typescript/eslint raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
syntastic: 3.600261: typescript/tsuquyomi raw: []

On the later run eslint still returns no error, but tsuquyomi finds a problem:

syntastic: 67.664235: typescript/eslint raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
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''.'}]

Now, please note that tsuquyomi is a third party checker not part of syntastic. Why does tsuquyomi returns different results on file open and on subsequent runs is a question for its maintainer(s). Sorry about that.