Skip to content

List index out of range error when checking types #28

Open
@tysonzero

Description

@tysonzero

Whenever hdevtools emits a warning message, which isn't all that infrequent, something like an unused import or a defined and not used variable will cause it to emit warnings. :HdevtoolsType will give a bunch of errors that make it a huge pain to use.

The code causing the issue is here:

let l:types = []
for l:line in split(l:output, '\n')
  let l:m = matchlist(l:line, '\(\d\+\) \(\d\+\) \(\d\+\) \(\d\+\) "\([^"]\+\)"')
  call add(l:types, [l:m[1 : 4], l:m[5]])
endfor

Since the regex does not correctly parse the warning message. Index 5 is out of range. Causing the following error messages to appear:

Error detected while processing function hdevtools#type:
line   30:
E684: list index out of range: 5
E116: Invalid arguments for function add
... (above two lines repeated often several times, taking up often a good third of the screen)

I personally think the onus is on vim-hdevtools to silently ignore those warnings. Since I will see them on save from hdevtools itself anyway, so I don't need them annoying me whenever I want to check types of things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions