Commit Graph

52 Commits

Author SHA1 Message Date
Björn Linse
06ee45b9b1 tree-sitter: fix lint, delete "demo" plugin (replaced by functional tests) 2019-09-28 17:46:25 +02:00
Björn Linse
167a1cfdef tree-sitter: improve parser API (shared parser between plugins) 2019-09-28 14:55:43 +02:00
Björn Linse
c8f861b739 tree-sitter: rename tree_sitter => treesitter for consistency 2019-09-28 14:55:43 +02:00
Björn Linse
4ea5e63aa8 tree-sitter: add basic testing on ci
build tree-sitter c parser on ci for testing purposes
2019-09-28 14:55:43 +02:00
Justin M. Keyes
af946046b9 test: Rename meth_pcall to pcall_err
- Rename `meth_pcall`.
- Make `pcall_err` raise an error if the function does not fail.
- Add `vim.pesc()` to treat a string as literal where a Lua pattern is
  expected.
2019-09-06 17:19:07 -07:00
Björn Linse
7e07efaff4 api: make try_end clean-up after an exception properly. Fixes #10809
Otherwise `force_abort` will cause an emsg() higher on the stack
to be converted to an exception, even though it is outside any
try/catch.
2019-09-02 23:01:16 +02:00
Björn Linse
1f54f68732 lua: minimal UTF-16 support needed for LSP 2019-08-08 20:10:14 +02:00
Björn Linse
c0993ed343 lua: support getting UTF-32 and UTF-16 sizes of replaced text 2019-08-06 20:24:36 +02:00
Björn Linse
b0e26199ec lua: add {old_byte_size} to on_lines buffer change event 2019-08-06 17:01:47 +02:00
Björn Linse
88938634e7 lua: add vim.in_fast_event() to check if we are in a luv callback 2019-08-05 13:57:24 +02:00
Björn Linse
e6d77993d1 lua: do not crash on syntax error in debug.debug() 2019-08-05 13:19:44 +02:00
Björn Linse
d3a7bdefb0 lua: immediate-callback safe print() 2019-08-05 13:19:44 +02:00
Daniel Hahler
68c594b10c
tests: loop_spec: retry (#10413)
Flaky test (osx):

    [  FAILED  ] ...is/build/neovim/neovim/test/functional/lua/loop_spec.lua @ 23: vim.loop timer
    ...is/build/neovim/neovim/test/functional/lua/loop_spec.lua:56: Expected objects to be the same.
    Passed in:
    (number) 0
    Expected:
    (number) 2
    stack traceback:
            ...is/build/neovim/neovim/test/functional/lua/loop_spec.lua:56: in function <...is/build/neovim/neovim/test/functional/lua/loop_spec.lua:23>

It was bumped from sleeping for 20ms to 50ms in d33aaa0f5f already.
2019-07-04 16:42:10 +02:00
Björn Linse
99f24dfbed make vim.loop == require'luv'
This avoids initializing libluv a second time if a plugin invokes
require'luv'. It is probably not an issue, but better to be safe.
2019-06-30 15:16:32 +02:00
Björn Linse
d33aaa0f5f libluv: use luv_set_callback to control callback execution
Disable the use of deferred API functions in a fast lua callback
Correctly display error messages from a fast lua callback
2019-06-30 13:13:08 +02:00
Björn Linse
64cdf9f78a api/lua: add on_detach to nvim_buf_attach 2019-06-15 13:19:12 +02:00
George Zhao
c83926cd0a lua: introduce vim.loop (expose libuv event-loop) #10123
Co-authored-by: Andrey Popp <8mayday@gmail.com>

closes #9546
closes #10084
2019-06-10 14:13:18 +02:00
Björn Linse
b684bd05b5 lua: docs and tests for vim.schedule 2019-06-05 10:46:22 +02:00
Justin M. Keyes
11a481f711 Merge #9686 'win/Lua: monkey-patch os.getenv()'
fixes #9681
2019-03-16 20:28:52 +01:00
erw7
c9264e6d52 Fix os.getenv of lua on Windows
Change to use os_getenv instead of getenv because environment variable
set by uv_os_setenv can not be get with getenv.
2019-03-07 13:49:02 +09:00
Björn Linse
f7b174eb71 tests/lua: test for multiline error messages in lua 2019-01-23 19:34:13 +01:00
Björn Linse
3a84e5be88 lua: expose full interface of vim.inspect and add test
Implement lazy loading for vim.submodule, this would be over-engineering
for inspect only, but we expect to use this solution also for more and
larger modules.
2019-01-14 20:12:57 +01:00
Justin M. Keyes
89d7e24891 Merge #9463 'Lua stdlib' 2019-01-14 02:25:45 +01:00
Justin M. Keyes
6c02ff4747 lua/stdlib: Load runtime modules on-demand
Instead of eager-loading during plugin/* sourcing, define runtime
modules such as `vim.inspect` as lazy builtins. Otherwise non-builtin
Lua modules such as `vim.inspect` would not be available during startup
(init.vim, `-c`, `--cmd`, …).

ref #6580
ref #8677
2019-01-14 02:22:16 +01:00
KillTheMule
bb3aa824b7 lua/stdlib: vim.inspect, string functions
ref #6580
ref #8677
2019-01-14 02:14:34 +01:00
Justin M. Keyes
c9f3174075 API: return non-generic VimL errors
- Return VimL errors instead of generic errors for:
  - nvim_call_function
  - nvim_call_dict_function
- Fix tests which were silently broken before this change.

This violates #6150 where we agreed not to translate API errors.  But
that can be fixed later.
2018-05-09 23:18:38 +02:00
Björn Linse
98e7112390 msg: do not scroll entire screen (#8088) 2018-03-31 11:12:27 +02:00
Justin M. Keyes
42b80c3acf Merge #7165 'lua: Move stricmp to vim module' 2017-10-22 16:29:36 +02:00
ZyX
b1a8dcefee lua/executor: Fix crash when first string contains NUL and second not 2017-08-15 17:18:05 +03:00
ZyX
93ef823f5e lua/executor: Move stricmp to vim “module” and document it 2017-08-15 16:34:51 +03:00
ZyX
96b1600bc8 functests: Add test for stricmp 2017-08-15 16:34:25 +03:00
Nikolai Aleksandrovich Pavlov
bf1b1ea6ee lua/executor: Fix crash when printing empty string (#7157) 2017-08-13 17:37:35 +02:00
ZyX
a409fa2b3f lua: Use automatic determining of suffixes only for package.cpath 2017-05-28 23:55:51 +03:00
ZyX
97602371e6 lua: Add paths from &runtimepath to package.path and package.cpath 2017-05-25 16:27:40 +03:00
ZyX
5b6d598ca8 functests: Fix tests 2017-05-08 21:21:03 +03:00
ZyX
09f849b600 Merge branch 'master' into luaviml'/lua 2017-05-08 15:43:45 +03:00
ZyX
78082e8d3e functests: Check whether it is a problem with an array 2017-04-11 11:05:19 +03:00
ZyX
acd9ed8d83 functests: Add another check for the similar transformation
Reasoning is majorly the same: check whether lua has bug or API function has 
bug, but on the other side: previous commit is checking whether similar bug when 
using API via msgpack RPC, this commit is checking whether another API function 
used via lua bindings triggers the same bug. Should additionally give a hint 
about which lua code contains a bug.
2017-04-11 02:32:13 +03:00
ZyX
9cad5155e3 functests: Make sure funcs.luaeval receives only one argument 2017-04-11 01:18:42 +03:00
ZyX
a40a969e9a api: Rename _vim_id functions to nvim__id 2017-04-08 20:33:48 +03:00
ZyX
a24e94215e eval,functests: Fix linter errors 2017-03-27 00:18:55 +03:00
ZyX
d13fdfd446 functests: Add test for debug.debug 2017-03-27 00:18:54 +03:00
ZyX
9fd2bf67aa executor,functests: Add print() tests, some fixes 2017-03-27 00:13:16 +03:00
ZyX
dcb992ab37 executor: Add :luafile command 2017-03-27 00:12:42 +03:00
ZyX
295e7607c4 executor: Fix some memory leaks 2017-03-27 00:12:42 +03:00
ZyX
e1bbaca7ac executor,functests: Add tests for :luado, also some fixes
Fixes:
1. Allocate space for the NUL byte.
2. Do not exclude last line from range.
3. Remove code for sandbox: it is handled earlier.
4. Fix index in new_line_transformed when converting NULs to NLs.
5. Always allocate new_line_transformed, but save allocated value.
2017-03-27 00:12:42 +03:00
ZyX
9114d9be77 executor: Add :luado command 2017-03-27 00:12:42 +03:00
ZyX
b4e2860c69 doc,functests: Add documentation
Missing: updates to various lists.
2017-03-27 00:12:42 +03:00
ZyX
7a5646d594 functests: Add tests for :lua 2017-03-27 00:12:42 +03:00
ZyX
666d85d3ce functests: Some more tests 2017-03-27 00:12:22 +03:00