dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.48k stars 1.43k forks source link

ALEDetail not showing full JavaScript Flow error message #2263

Closed hit6 closed 5 years ago

hit6 commented 5 years ago

Information

VIM version VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan 15 2019 00:11:27) Included patches: 1-751

Operating System: Linux portatil 4.20.4-arch1-1-ARCH #1 SMP PREEMPT Wed Jan 23 00:12:22 UTC 2019 x86_64 GNU/Linux

What went wrong

ALEDetail is not working correctly with flow. The details window only shows the list of reference numbers (check attached screenshot) instead of the full error message. frame-139

Also, pressing "enter" or "t" on any of those reference numbers doesnt do anything.

Here is the full error message that should appear on the details window as flow shows it:

Error ---------------------------------------------------------------------- src/redux/actions/compoundActions.js:111:16              

Cannot call `dispatch` with `MarkTaskAsUncompletedCompoundAction(...)` bound to the first parameter because:                          
 - Either property `payload` is missing in function [1] but exists in object type [2].                                                
 - Or property `payload` is missing in function [1] but exists in object type [3].                                                    
 - Or property `type` is missing in function [1] but exists in object type [4].                                                       
 - Or property `type` is missing in function [1] but exists in object type [5].                                                       
 - Or property `payload` is missing in function [1] but exists in object type [6].                                                    
 - Or property `type` is missing in function [1] but exists in object type [7].                                                       
 - Or property `type` is missing in function [1] but exists in object type [8].                                                       
 - Or property `payload` is missing in function [1] but exists in object type [9].                                                    
 - Or property `type` is missing in function [1] but exists in object type [10].                                                      
 - Or property `type` is missing in function [1] but exists in object type [11].                                                      
 - Or property `payload` is missing in function [1] but exists in object type [12].                                                   
 - Or property `payload` is missing in function [1] but exists in object type [13].                                                   
 - Or property `payload` is missing in function [1] but exists in object type [14].                                                   
 - Or property `payload` is missing in function [1] but exists in object type [15].                                                   
 - Or property `payload` is missing in function [1] but exists in object type [16].                                                   
 - Or property `payload` is missing in function [1] but exists in object type [17].                                                   
 - Or property `payload` is missing in function [1] but exists in object type [18].                                                   

   src/redux/actions/compoundActions.js:111:16                                                                                        
   111|       dispatch(MarkTaskAsUncompletedCompoundAction(parentTaskId));                                                            
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        
References:                                                                                                                  [462/1825]
   src/redux/actions/compoundActions.js:159:10                                                                                        
                 v---------------------------------------------------------                                                           
   159|   return (dispatch: mixed => null, getState: () => StoreTypes) => {                                                           
   160|     dispatch(MarkTaskAsUncompletedAction(taskId));                                                                            
   161|                                                                                                                               
   162|     let parentTaskId = getState().tasks[taskId].parentTaskId;                                                                 
   163|     if (parentTaskId) {                                                                                                       
   164|       dispatch(MarkTaskAsUncompletedCompoundAction(parentTaskId));
   165|     }
   166|   };
          ^ [1]
   src/redux/actions/actionType.js:6:5
            v
     6|   | {
     7|       type: "NEW_TASK_DIALOG_UPDATE_TITLE_ACTION",
     8|       payload: string
     9|     }
            ^ [2]

And so on....

Reproducing the bug

  1. Start flow server
  2. Open file on vim
  3. Run :ALEDetail on selected line

:ALEInfo

 Current Filetype: javascript
Available Linters: ['eslint', 'flow', 'flow-language-server', 'jscs', 'jshint', 'standard', 'tsserver', 'xo']
  Enabled Linters: ['eslint', 'flow']
 Suggested Fixers: 
  'eslint' - Apply eslint --fix to a file.
  'importjs' - automatic imports for javascript
  'prettier' - Apply prettier to a file.
  'prettier_eslint', 'prettier-eslint' - Apply prettier-eslint to a file.
  'prettier_standard', 'prettier-standard' - Apply prettier-standard to a file.
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'standard' - Fix JavaScript files using standard --fix
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
  'xo' - Fix JavaScript files using xo --fix.
 Linter Variables:

let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_javascript_eslint_options = ''
let g:ale_javascript_eslint_suppress_eslintignore = 0
let g:ale_javascript_eslint_suppress_missing_config = 0
let g:ale_javascript_eslint_use_global = 0
let g:ale_javascript_flow_executable = 'flow'
let g:ale_javascript_flow_ls_executable = 'flow'
let g:ale_javascript_flow_ls_use_global = 0
let g:ale_javascript_flow_use_global = 0
let g:ale_javascript_flow_use_home_config = 0
let g:ale_javascript_flow_use_respect_pragma = 1
 Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%linter% says %s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {'javascript': ['eslint', 'flow']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%linter% says %s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = 'X'
let g:ale_sign_info = '?'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'X'
let g:ale_sign_style_warning = '?'
let g:ale_sign_warning = '?'
let g:ale_statusline_format = ['X %d', '? %d', '']
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(executable check - success) /home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/bin/eslint.js
(finished - exit code 1) ['/usr/bin/zsh', '-c', '''/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/bin/eslint.js'' -f unix --stdin --stdin-filename ''/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/compoundActions.js'' < ''/tmp/vxO5eRN/2/compoundActions.js''']

<<<OUTPUT STARTS>>>
Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
    at isForInRef (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:406:24)
    at variable.references.some.ref (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:443:21)
    at Array.some (<anonymous>)
    at isUsedVariable (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:442:40)
    at collectUnusedVariables (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:565:26)
    at Program:exit (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:617:36)
    at listeners.(anonymous function).forEach.listener (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/util/node-event-generator.js:251:26)
<<<OUTPUT ENDS>>>

(executable check - success) /home/hit/projects/todoList/todoList/todo_list/node_modules/.bin/flow
(finished - exit code 0) ['/usr/bin/zsh', '-c', '''/home/hit/projects/todoList/todoList/todo_list/node_modules/.bin/flow'' --version']
(finished - exit code 0) ['/usr/bin/zsh', '-c', '''/home/hit/projects/todoList/todoList/todo_list/node_modules/.bin/flow'' check-contents --respect-pragma --json --from ale ''/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/compoundActions.js'' < ''/tmp/vxO5eRN/3/compoundActions.js''; echo']

<<<OUTPUT STARTS>>>
{"flowVersion":"0.75.0","jsonVersion":"1","errors":[],"passed":true}
<<<OUTPUT ENDS>>>

(finished - exit code 1) ['/usr/bin/zsh', '-c', '''/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/bin/eslint.js'' -f unix --stdin --stdin-filename ''/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/compoundActions.js'' < ''/tmp/vxO5eRN/4/compoundActions.js''']

<<<OUTPUT STARTS>>>
Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
    at isForInRef (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:406:24)
    at variable.references.some.ref (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:443:21)
    at Array.some (<anonymous>)
    at isUsedVariable (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:442:40)
    at collectUnusedVariables (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:565:26)
    at Program:exit (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/rules/no-unused-vars.js:617:36)
    at listeners.(anonymous function).forEach.listener (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/home/hit/projects/todoList/todoList/todo_list/node_modules/eslint/lib/util/node-event-generator.js:251:26)
<<<OUTPUT ENDS>>>

(finished - exit code 0) ['/usr/bin/zsh', '-c', '''/home/hit/projects/todoList/todoList/todo_list/node_modules/.bin/flow'' --version']
(finished - exit code 0) ['/usr/bin/zsh', '-c', '''/home/hit/projects/todoList/todoList/todo_list/node_modules/.bin/flow'' check-contents --respect-pragma --json --from ale ''/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/compoundActions.js'' < ''/tmp/vxO5eRN/5/compoundActions.js''; echo']

<<<OUTPUT STARTS>>>
{"flowVersion":"0.75.0","jsonVersion":"1","errors":[{"kind":"infer","level":"error","suppressions":[],"extra":[{"message":[{"context":null,"descr":"References:","type":"Blame","path":"","line":0,"endline":0,"start":1,"end":0}]},{"message":[{"context":"  return (dispatch: mixed => null, getState: () => StoreTypes) => {","descr":"[1]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/compoundActions.js","type":"SourceFile","start":{"line":164,"column":10,"offset":4691},"end":{"line":171,"column":3,"offset":4964}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/compoundActions.js","line":164,"endline":171,"start":10,"end":3}]},{"message":[{"context":"  | {","descr":"[2]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":6,"column":5,"offset":99},"end":{"line":9,"column":5,"offset":179}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":6,"endline":9,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[3]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":10,"column":5,"offset":184},"end":{"line":13,"column":5,"offset":270}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":10,"endline":13,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[4]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":14,"column":5,"offset":275},"end":{"line":16,"column":5,"offset":325}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":14,"endline":16,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[5]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":17,"column":5,"offset":330},"end":{"line":19,"column":5,"offset":380}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":17,"endline":19,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[6]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":20,"column":5,"offset":385},"end":{"line":23,"column":5,"offset":458}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":20,"endline":23,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[7]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":24,"column":5,"offset":463},"end":{"line":26,"column":5,"offset":524}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":24,"endline":26,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[8]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":27,"column":5,"offset":529},"end":{"line":29,"column":5,"offset":591}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":27,"endline":29,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[9]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":30,"column":5,"offset":596},"end":{"line":33,"column":5,"offset":671}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":30,"endline":33,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[10]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":34,"column":5,"offset":676},"end":{"line":36,"column":5,"offset":729}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":34,"endline":36,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[11]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":37,"column":5,"offset":734},"end":{"line":39,"column":5,"offset":787}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":37,"endline":39,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[12]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":40,"column":5,"offset":792},"end":{"line":43,"column":5,"offset":869}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":40,"endline":43,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[13]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":44,"column":5,"offset":874},"end":{"line":47,"column":5,"offset":948}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":44,"endline":47,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[14]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":48,"column":5,"offset":953},"end":{"line":51,"column":5,"offset":1029}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":48,"endline":51,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[15]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":52,"column":5,"offset":1034},"end":{"line":58,"column":5,"offset":1151}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":52,"endline":58,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[16]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":59,"column":5,"offset":1156},"end":{"line":62,"column":5,"offset":1219}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":59,"endline":62,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[17]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":63,"column":5,"offset":1224},"end":{"line":66,"column":5,"offset":1319}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":63,"endline":66,"start":5,"end":5}]},{"message":[{"context":"  | {","descr":"[18]","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","type":"SourceFile","start":{"line":67,"column":5,"offset":1324},"end":{"line":70,"column":5,"offset":1416}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/actionType.js","line":67,"endline":70,"start":5,"end":5}]}],"message":[{"context":"      dispatch(MarkTaskAsUncompletedCompoundAction(parentTaskId));","descr":"Cannot call `dispatch` with `MarkTaskAsUncompletedCompoundAction(...)` bound to the first parameter because: Either property `payload` is missing in function [1] but exists in object type [2]. Or property `payload` is missing in function [1] but exists in object type [3]. Or property `type` is missing in function [1] but exists in object type [4]. Or property `type` is missing in function [1] but exists in object type [5]. Or property `payload` is missing in function [1] but exists in object type [6]. Or property `type` is missing in function [1] but exists in object type [7]. Or property `type` is missing in function [1] but exists in object type [8]. Or property `payload` is missing in function [1] but exists in object type [9]. Or property `type` is missing in function [1] but exists in object type [10]. Or property `type` is missing in function [1] but exists in object type [11]. Or property `payload` is missing in function [1] but exists in object type [12]. Or property `payload` is missing in function [1] but exists in object type [13]. Or property `payload` is missing in function [1] but exists in object type [14]. Or property `payload` is missing in function [1] but exists in object type [15]. Or property `payload` is missing in function [1] but exists in object type [16]. Or property `payload` is missing in function [1] but exists in object type [17]. Or property `payload` is missing in function [1] but exists in object type [18].","type":"Blame","loc":{"source":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/compoundActions.js","type":"SourceFile","start":{"line":116,"column":16,"offset":3308},"end":{"line":116,"column":64,"offset":3357}},"path":"/home/hit/projects/todoList/todoList/todo_list/src/redux/actions/compoundActions.js","line":116,"endline":116,"start":16,"end":64}]}],"passed":false}
<<<OUTPUT ENDS>>>
w0rp commented 5 years ago

Looks like the problem here the detailed text wasn't including the original error message. Now it will be set as essentially text . "\n" . extra.