Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing key case, add BC type checking #1206

Merged
merged 3 commits into from
Jan 19, 2021
Merged

Fix missing key case, add BC type checking #1206

merged 3 commits into from
Jan 19, 2021

Conversation

przepompownia
Copy link
Contributor

Resolves #1205

Copy link
Member

@PhilRunninger PhilRunninger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works. I just have 3 BC suggestions. Fix those, and I'll merge.


if v:false is# s:validateType(l:customOpenArgs, v:t_dict)
if v:false is# s:validateType(l:customOpenArgs, type({})) || empty(l:customOpenArgs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if anyone still uses it, but NERDTree is supposed to be compatible to 7.3. After reviewing (the 7.3 documentation](http://vimdoc.sourceforge.net/htmldoc/eval.html#expression-syntax), I think is# and v:false didn't exist at that time. Let's use this instead.

Suggested change
if v:false is# s:validateType(l:customOpenArgs, type({})) || empty(l:customOpenArgs)
if !s:validateType(l:customOpenArgs, type({})) || empty(l:customOpenArgs)

return l:defaultOpenArgs
endif

for l:typeKey in keys(l:defaultOpenArgs)
if v:false is# s:validateType(get(l:customOpenArgs, l:typeKey, {}), v:t_dict)
if v:false is# s:validateType(get(l:customOpenArgs, l:typeKey, {}), type({}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Suggested change
if v:false is# s:validateType(get(l:customOpenArgs, l:typeKey, {}), type({}))
if !s:validateType(get(l:customOpenArgs, l:typeKey, {}), type({}))

And below...

function! s:validateType(variable, type) abort
    return type(a:variable) == a:type
endfunction

Copy link
Member

@PhilRunninger PhilRunninger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this.

@PhilRunninger PhilRunninger merged commit 7099f63 into preservim:master Jan 19, 2021
@przepompownia przepompownia deleted the fix-1205-type-checking-bc branch January 19, 2021 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't open directory after latest update
2 participants