Vimjas / vint

Fast and Highly Extensible Vim script Language Lint implemented in Python.
MIT License
702 stars 33 forks source link

Gives syntax error on seemingly valid code from vim docs #373

Open poetaman opened 3 years ago

poetaman commented 3 years ago

Vim documentation's file tips.txt has an example on how to open help in current window. It works when used, but for some reason vint gives a syntax error on it.

Error:

SyntaxError - unexpected token: . (see vim-jp/vim-vimlparser)

Code:

let s:did_open_help = v:false
function s:HelpCurwin(subject) abort
    let mods = 'silent noautocmd keepalt'
    if !s:did_open_help
        execute mods .. ' help'
        execute mods .. ' helpclose'
        let s:did_open_help = v:true
    endif
    if !getcompletion(a:subject, 'help')->empty()
        execute mods .. ' edit ' .. &helpfile
    endif
    return 'help ' .. a:subject
endfunction
command -bar -nargs=? -complete=help HelpCurwin execute <SID>HelpCurwin(<q-args>)

Source of code snippet: Search for help-curwin in https://vimhelp.org/tips.txt.html or https://neovim.io/doc/user/tips.html