Commit Graph

18630 Commits

Author SHA1 Message Date
Sean Dewar
b2994e35c9
feat(v:lua): support calling v:lua as a method 2021-08-13 01:11:36 +01:00
Sean Dewar
da9005af79
fix(v:lua): fix emsg when calling v:lua directly
v:lua expressions are represented using vvlua_partial. As v:lua isn't
intended to be called directly, it's given an empty pt_name.

Because of this, calling v:lua directly like "v:lua()" will cause "E117:
Unknown function: ", with an empty name.

Instead, have call_func() show the name "v:lua" in the emsg.
2021-08-12 22:35:25 +01:00
Sean Dewar
5503d8e28b
fix(eval_lambda): cherry-pick leak fix from v8.1.2107
That patch also includes a test using test_refcount() for lambdas, but
such test functions are N/A for Nvim.
2021-08-12 22:35:25 +01:00
Sean Dewar
5d88349817
feat(eval): partially port v8.1.1915
Cannot be fully ported as chdir() hasn't been ported yet.
2021-08-12 22:35:25 +01:00
Sean Dewar
56b56a76e8
vim-patch:8.1.1911: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make a few more functions usable as a method.
64b4d73524

Note that the old-style version of Test_byteidx() was already translated
to a Lua test in 069_multibyte_formatting_spec.lua. Keep both versions,
using Test_byteidx() to mainly test the method call syntax for byteidx()
and byteidxcomp().
2021-08-12 22:35:24 +01:00
Sean Dewar
7925f0b633
vim-patch:8.1.1909: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make a few more functions usable as a method.
e49fbff384
2021-08-12 22:35:24 +01:00
Sean Dewar
5fbc1a49c7
vim-patch:8.1.1888: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
073e4b92e6

test_popup.vim already has the changes from this patch (they're N/A
anyway).
2021-08-12 22:35:24 +01:00
Sean Dewar
41dbd3a2e0
vim-patch:8.1.1879: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make float functions usable as a method.
93cf85f9ef

Fix atan2() doc typo (patch referred to it as atan()).
Adjust Test_fmod() method test to expect "str2float('nan')".
2021-08-12 22:35:23 +01:00
Sean Dewar
7474db98af
vim-patch:8.1.1878: negative float before method not parsed correctly
Problem:    Negative float before method not parsed correctly.
Solution:   Apply "!" and "-" in front of expression before using ->.
9cfe8f6e68
2021-08-12 22:35:23 +01:00
Sean Dewar
98dfe4adc4
vim-patch:8.1.1863: confusing error when using a builtin function as method
Problem:    Confusing error when using a builtin function as method while it
            does not support that.
Solution:   Add a specific error message.
9174639a82
2021-08-12 22:35:23 +01:00
Sean Dewar
287a77ef51
vim-patch:8.1.1861: only some assert functions can be used as a method
Problem:    Only some assert functions can be used as a method.
Solution:   Allow using most assert functions as a method.
24278d2407

Port tests to assert_spec.lua.
2021-08-12 22:35:22 +01:00
Sean Dewar
f03dd22f0d
vim-patch:8.1.1835: cannot use printf() as a method
Problem:    Cannot use printf() as a method.
Solution:   Pass the base as the second argument to printf().
fd8ca21b3f
2021-08-12 22:35:22 +01:00
Sean Dewar
5811390f82
vim-patch:8.1.1834: cannot use a lambda as a method
Problem:    Cannot use a lambda as a method.
Solution:   Implement ->{lambda}(). (closes vim/vim#4768)
22a0c0c4ec

Add an additional lua_funcname argument to call_func_rettv() to maintain
support for v:lua.

A memory leak was introduced with this patch that was fixed in
v8.1.2107.
2021-08-12 22:35:22 +01:00
Sean Dewar
32589341a4
vim-patch:8.1.1828: not strict enough checking syntax of method invocation
Problem:    Not strict enough checking syntax of method invocation.
Solution:   Check there is no white space inside ->method(.
5184132ec0
2021-08-12 22:35:21 +01:00
Sean Dewar
daedbd9312
vim-patch:8.1.1821: no test for wrong number of method arguments
Problem:    No test for wrong number of method arguments.
Solution:   Add a test.
f97d46f816
2021-08-12 22:35:21 +01:00
Sean Dewar
d41b87e070
vim-patch:8.1.1820: using expr->FuncRef() does not work
Problem:    Using expr->FuncRef() does not work.
Solution:   Make FuncRef work as a method.
761fdf01c6
2021-08-12 22:35:21 +01:00
Sean Dewar
8d1ca37d1f
vim-patch:8.1.1816: cannot use a user defined function as a method
Problem:    Cannot use a user defined function as a method.
Solution:   Pass the base as the first argument to the user defined function
            after "->". (partly by FUJIWARA Takuya)
fcfe1a9b89
2021-08-12 22:35:20 +01:00
Sean Dewar
aa2dc8b7b4
vim-patch:8.1.1809: more functions can be used as a method
Problem:    More functions can be used as a method.
Solution:   Add has_key(), split(), str2list(), etc.
a74e4946de
2021-08-12 22:35:20 +01:00
Sean Dewar
003c8acc8a
vim-patch:8.1.1807: more functions can be used as a method
Problem:    More functions can be used as a method.
Solution:   Add append(), appendbufline(), assert_equal(), etc.
            Also add the :eval command.
25e42231d3

:eval is already ported.
2021-08-12 22:35:20 +01:00
Sean Dewar
e6be6c307a
vim-patch:8.1.1803: all builtin functions are global
Problem:    All builtin functions are global.
Solution:   Add the method call operator ->.  Implemented for a limited number
            of functions.
ac92e25a33

- Note that to *exactly* port hunk @@ -7376,18 +7444,19 from
  handle_subscript(), we need the :scriptversion patches (I have an open
  PR for those, but this patch works fine without them anyway).
- Port call_internal_func() from v7.4.2058.
- Adjust some error messages in tests, as they rely on the Blob patches.
- Add a modeline to test_method.vim.

Ignore the global_functions and base_method tables and prefer the
current GPerf implementation. Instead, add an extra base_arg field to
VimLFuncDef that holds the number of the argument to use as the base
(1-indexed, so that 0 may be used to refer to functions that cannot be
used as methods).

This also means we support using any argument as a base from the get-go,
rather than just the first (Vim includes this ability in future patches,
however).

To mark a function as usable as a method, use the "base" key as
described in eval.lua.
2021-08-12 22:35:19 +01:00
Sean Dewar
4042ae5a2b
vim-patch:8.1.1800: function call functions have too many arguments
Problem:    Function call functions have too many arguments.
Solution:   Pass values in a funcexe_T struct.
c6538bcc1c

Use FUNCEXE_INIT to initialize funcexe_T instances.

call_callback() and other Vim listener related stuff is N/A.
2021-08-12 22:31:18 +01:00
Sean Dewar
60dd76c7e2
vim-patch:8.1.1638: running tests leaves some files behind
Problem:    Running tests leaves some files behind.
Solution:   Delete the files. (Ozaki Kiichi, closes vim/vim#4617)
3940ec6d41

Required for v8.1.1888.

N/A patches for version.c:

vim-patch:8.1.1912: more functions can be used as methods

Problem:    More functions can be used as methods.
Solution:   Make channel and job functions usable as a method.
vim/vim@570497a
2021-08-12 17:16:34 +01:00
Sean Dewar
1918638c67
test(oldtest): cherry-pick needed test functions from v8.1.1336
Cherry-pick Test_call() and Test_cindent_func().

Required for v8.1.1911 and v8.1.1915.
2021-08-12 17:16:34 +01:00
Sean Dewar
e0bdc9b89c
fix(eval): cherry-pick emsg changes from v8.1.0736
v8.1.0736 made some changes for making some emsgs more specific.
Includes the change for Test_lambda_fails() in test_lambda.vim.
Adjust relevant functionaltests to expect the new emsgs.

This patch has been fully ported in my Blob port PR, but it hasn't been
merged yet, so just use what we need from it for now.

Required for v8.1.1821.
2021-08-12 17:16:33 +01:00
Björn Linse
7d2233fad0
Merge pull request #15336 from bfredl/plines
refactor(plines): move "plines" (size of printed lines) family of function to own file
2021-08-11 17:38:36 +02:00
Björn Linse
28b5c73bf8 refactor(plines): move horizontal size functions to plines.c
fix style.
2021-08-11 17:10:52 +02:00
Thomas Vigouroux
2c60f7c991
Merge pull request #15335 from muniter/set_extmark_error_cleanup
refactor(api): remove redundant api_set_error
2021-08-11 10:38:21 +02:00
Björn Linse
8bf318dcde refactor(plines): what is basic compiler optimizations? 2021-08-10 23:22:25 +02:00
Björn Linse
ac56a27a10 refactor(plines): remove implicit curwin chartabsize() function 2021-08-10 23:18:12 +02:00
Björn Linse
b506643dfc refactor(plines): style of new plines.c file 2021-08-10 23:06:48 +02:00
Björn Linse
7f71e8a6b3 refactor(plines): move out plines related code from misc1.c 2021-08-10 22:59:29 +02:00
Javier López
d475955ed3 refactor(api): remove redundant api_set_error
This error is already handled by 'find_buffer_by_handle'
2021-08-10 15:55:03 -05:00
Björn Linse
0465341e16 refactor(plines): remove implicit curwin plines_nofill() function 2021-08-10 22:39:04 +02:00
Björn Linse
a177c7df09 refactor(plines): remove implicit curwin plines() function 2021-08-10 22:32:08 +02:00
Björn Linse
c479b90359
Merge pull request #15253 from spywhere/float-win-scl-fix
Fix sign column auto with minimum break floating window minimal style
2021-08-10 22:14:52 +02:00
Andrea Cappuccio
adebbebdd7
fix(lsp): properly handle nil lines when trimming empty lines (#15325) 2021-08-10 20:52:30 +02:00
Thomas Vigouroux
c5baba065c
Merge pull request #15329 from dundargoc/github/bug-template/make-behavior-mandatory
ci: make all questions mandatory in bug template
2021-08-10 14:35:36 +02:00
Dundar Göc
f43a8f0eda ci: make all questions mandatory in bug template 2021-08-10 12:18:55 +02:00
Hans Pinckaers
1a10acb997
fix(lsp): floating popup should take offset_x into account when positioning (#15297) 2021-08-09 23:56:58 +02:00
Cezary Drożak
33b4513b89
doc: Document -complete=lua option (#15102) 2021-08-09 21:21:14 +02:00
github-actions[bot]
3cacd108d0
docs: regenerate (#15324)
Co-authored-by: marvim <marvim@users.noreply.github.com>
2021-08-09 20:54:28 +02:00
Matthieu Coudron
0e9d97896a
Merge pull request #15307 from muniter/update-help.txt
docs(help.txt): Add a tag to the neovim api.
2021-08-09 19:51:47 +02:00
max397574
a3d5f391cf
docs: Add some references to LSP specification (#15321) 2021-08-09 19:45:00 +02:00
dundargoc
cad5f01cf3
docs: elaborate on commitlint rules (#15322)
linter requires lowercase at start and no period at end of description
2021-08-09 18:46:33 +02:00
Javier Lopez
109a417e21 docs(help.txt): add treesitter to the main help file 2021-08-09 09:17:02 -05:00
Javier Lopez
4667bfb732 docs(help.txt): add a tag to the neovim api 2021-08-09 09:16:56 -05:00
dundargoc
7dbbd5d8b1
ci: create GitHub Action that squashes all typo PRs into a single PR (#15041)
The action adds all pull-request authors (and Marvim) as a co-author to the
newly created PR and also links to the closed PRs.
2021-08-09 15:21:50 +02:00
Jan Edmund Lazo
9ef7003c38
Merge pull request #15312 from janlazo/vim-8.2.2639
vim-patch:8.1.{1818},8.2.{1464,2639,2814,2947,2976,2986,3114,3141,3160,3198}
2021-08-09 08:28:36 -04:00
Sirisak Lueangsaksri
0a43b4d51e refactor(sign): include longer sign column option 2021-08-09 11:09:22 +07:00
Sirisak Lueangsaksri
c8f57f6ded fix(sign): reset auto sign column with minimum in float win minimal style 2021-08-09 11:09:22 +07:00