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

Move s:viml_builtin_functions to shared file? #118

Closed
blueyed opened this issue Jul 19, 2019 · 10 comments · Fixed by #125
Closed

Move s:viml_builtin_functions to shared file? #118

blueyed opened this issue Jul 19, 2019 · 10 comments · Fixed by #125
Assignees

Comments

@blueyed
Copy link
Contributor

blueyed commented Jul 19, 2019

Currently s:viml_builtin_functions is defined twice in both py/pycompiler.vim (

let s:viml_builtin_functions = ['abs', 'acos', 'add', 'and', 'append', 'append', 'argc', 'argidx', 'argv', 'argv', 'asin', 'atan', 'atan2', 'browse', 'browsedir', 'bufexists', 'buflisted', 'bufloaded', 'bufname', 'bufnr', 'bufwinnr', 'byte2line', 'byteidx', 'call', 'ceil', 'changenr', 'char2nr', 'cindent', 'clearmatches', 'col', 'complete', 'complete_add', 'complete_check', 'confirm', 'copy', 'cos', 'cosh', 'count', 'cscope_connection', 'cursor', 'cursor', 'deepcopy', 'delete', 'did_filetype', 'diff_filler', 'diff_hlID', 'empty', 'escape', 'eval', 'eventhandler', 'executable', 'exists', 'extend', 'exp', 'expand', 'feedkeys', 'filereadable', 'filewritable', 'filter', 'finddir', 'findfile', 'float2nr', 'floor', 'fmod', 'fnameescape', 'fnamemodify', 'foldclosed', 'foldclosedend', 'foldlevel', 'foldtext', 'foldtextresult', 'foreground', 'function', 'garbagecollect', 'get', 'get', 'getbufline', 'getbufvar', 'getchar', 'getcharmod', 'getcmdline', 'getcmdpos', 'getcmdtype', 'getcwd', 'getfperm', 'getfsize', 'getfontname', 'getftime', 'getftype', 'getline', 'getline', 'getloclist', 'getmatches', 'getpid', 'getpos', 'getqflist', 'getreg', 'getregtype', 'gettabvar', 'gettabwinvar', 'getwinposx', 'getwinposy', 'getwinvar', 'glob', 'globpath', 'has', 'has_key', 'haslocaldir', 'hasmapto', 'histadd', 'histdel', 'histget', 'histnr', 'hlexists', 'hlID', 'hostname', 'iconv', 'indent', 'index', 'input', 'inputdialog', 'inputlist', 'inputrestore', 'inputsave', 'inputsecret', 'insert', 'invert', 'isdirectory', 'islocked', 'items', 'join', 'keys', 'len', 'libcall', 'libcallnr', 'line', 'line2byte', 'lispindent', 'localtime', 'log', 'log10', 'luaeval', 'map', 'maparg', 'mapcheck', 'match', 'matchadd', 'matcharg', 'matchdelete', 'matchend', 'matchlist', 'matchstr', 'max', 'min', 'mkdir', 'mode', 'mzeval', 'nextnonblank', 'nr2char', 'or', 'pathshorten', 'pow', 'prevnonblank', 'printf', 'pumvisible', 'pyeval', 'py3eval', 'range', 'readfile', 'reltime', 'reltimestr', 'remote_expr', 'remote_foreground', 'remote_peek', 'remote_read', 'remote_send', 'remove', 'remove', 'rename', 'repeat', 'resolve', 'reverse', 'round', 'screencol', 'screenrow', 'search', 'searchdecl', 'searchpair', 'searchpairpos', 'searchpos', 'server2client', 'serverlist', 'setbufvar', 'setcmdpos', 'setline', 'setloclist', 'setmatches', 'setpos', 'setqflist', 'setreg', 'settabvar', 'settabwinvar', 'setwinvar', 'sha256', 'shellescape', 'shiftwidth', 'simplify', 'sin', 'sinh', 'sort', 'soundfold', 'spellbadword', 'spellsuggest', 'split', 'sqrt', 'str2float', 'str2nr', 'strchars', 'strdisplaywidth', 'strftime', 'stridx', 'string', 'strlen', 'strpart', 'strridx', 'strtrans', 'strwidth', 'submatch', 'substitute', 'synID', 'synIDattr', 'synIDtrans', 'synconcealed', 'synstack', 'system', 'tabpagebuflist', 'tabpagenr', 'tabpagewinnr', 'taglist', 'tagfiles', 'tempname', 'tan', 'tanh', 'tolower', 'toupper', 'tr', 'trunc', 'type', 'undofile', 'undotree', 'values', 'virtcol', 'visualmode', 'wildmenumode', 'winbufnr', 'wincol', 'winheight', 'winline', 'winnr', 'winrestcmd', 'winrestview', 'winsaveview', 'winwidth', 'writefile', 'xor']
) and js/jscompiler.vim.

I think this should be shared, probably in s:VimLParser.builtin_functions.

It is likely also out of date. It would be good if this could be used through some Vim function directly.

@blueyed
Copy link
Contributor Author

blueyed commented Jul 19, 2019

I have created vim/vim#4700 to ask about support in Vim for this.

@tyru
Copy link
Member

tyru commented Jul 19, 2019

s:VimLParser.builtin_functions

Yes, currently vimlparser doesn't have such thing.
I want to implement it for #105.

Currently scripts/update_builtin_commands.sh checks vim source (src/ex_cmds.h).
I want to provide similar script for vim functions (parse src/evalfunc.c).

@tyru tyru self-assigned this Jul 19, 2019
@blueyed
Copy link
Contributor Author

blueyed commented Jul 19, 2019

Ok. As per vim/vim#4700 Vim is unlikely to provide this information itself.

However, nvim_get_commands exists already (although only for non-builtin). Might be useful in general, but only for "dynamic" linting/parsing (i.e. not for vint, vimlparser.py etc, which need the list already).

@tyru
Copy link
Member

tyru commented Jul 19, 2019

Thanks for asking to vim/vim.
I didn't know nvim_get_commands() (because I'm not neovim user).
currently neovim ex commands is updated manually. it should help auto-update 👍

Does neovim provide function list version of nvim_get_commands() ?

@tyru
Copy link
Member

tyru commented Jul 19, 2019

Created #123

@tyru
Copy link
Member

tyru commented Jul 19, 2019

I don't read nvim source code, because it MAY results in license violation when I write vim patch.
(@mattn has the same policy)

@blueyed
Copy link
Contributor Author

blueyed commented Jul 19, 2019

I don't read nvim source code, because it MAY results in license violation when I write vim patch.
(@mattn has the same policy)

Interesting - can you elaborate?

@blueyed
Copy link
Contributor Author

blueyed commented Jul 19, 2019

nvim_get_commands seems to just provide the internal information: https://github.com/neovim/neovim/blob/a46fe2e615bc5f4431cad04b67ac5ba0b67ed86c/src/nvim/api/buffer.c#L653-L684

@tyru
Copy link
Member

tyru commented Jul 19, 2019

Interesting - can you elaborate?

Neovim's license is Apache license.
But Vim's license is Vim license.
I don't clearly say they are compatible.

@tyru
Copy link
Member

tyru commented Jul 19, 2019

nvim_get_commands seems to just provide the internal information: https://github.com/neovim/neovim/blob/a46fe2e615bc5f4431cad04b67ac5ba0b67ed86c/src/nvim/api/buffer.c#L653-L684

sorry, I can't read it because of above reason 😓
I'm just afraid of that.

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 a pull request may close this issue.

2 participants