Commit Graph

23 Commits

Author SHA1 Message Date
dundargoc
052498ed42 test: improve test conventions
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
2024-04-23 18:17:04 +02:00
Lewis Russell
81fc27124b refactor(test): inject after_each differently 2024-04-10 15:53:50 +01:00
dundargoc
7035125b2b test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-08 22:51:00 +02:00
Lewis Russell
795f896a57 test: rename (meths, funcs) -> (api, fn) 2024-01-12 18:59:14 +00:00
Lewis Russell
c30f2e3182 test: typing for helpers.meths 2024-01-12 13:01:06 +00:00
Justin M. Keyes
04f2f864e2 refactor: format test/* 2024-01-03 02:09:29 +01:00
zeertzjq
4b60267f82
feat(:source): source current ft=lua buffer as Lua code (#23802) 2023-06-02 21:00:55 +08:00
Lewis Russell
1fe1bb084d refactor(options): deprecate nvim[_buf|_win]_[gs]et_option
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: famiu <famiuhaque@protonmail.com>
2023-05-21 15:14:01 +06:00
zeertzjq
4863ca6b89
test: use exec_capture() in more places (#22787)
Problem:
Using `meths.exec2("code", { output = true })` is too verbose.

Solution:
Use exec_capture() in more places.
2023-03-26 10:49:32 +08:00
Evgeni Chasnovski
fe9cbcb3a5
feat(api): nvim_exec2(), deprecate nvim_exec() #19032
Problem:
The signature of nvim_exec() is not extensible per ":help api-contract".

Solution:
Introduce nvim_exec2() and deprecate nvim_exec().
2023-03-25 09:58:48 -07:00
dundargoc
5eb5f49488
test: simplify platform detection (#21020)
Extend the capabilities of is_os to detect more platforms such as
freebsd and openbsd. Also remove `iswin()` helper function as it can be
replaced by `is_os("win")`.
2022-11-22 08:13:30 +08:00
ii14
4a67f9d386 vim-patch:9.0.0409: #{g:x} was seen as a curly-braces expression
Problem:    #{g:x} was seen as a curly-braces expression.
Solution:   Do never see #{} as a curly-braces expression. (closes vim/vim#11075)
7c7e1e9b98
2022-09-08 08:17:30 +08:00
zeertzjq
ffa1335047 vim-patch:8.2.4726: cannot use expand() to get the script name
Problem:    Cannot use expand() to get the script name.
Solution:   Support expand('<script>'). (closes vim/vim#10121)
6013d0045d

Use `.sn_name` instead of `->sn_name` as v8.2.0154 hasn't been ported.
Cherry-pick builtin.txt expand() doc from latest Vim.
2022-08-23 17:47:46 +08:00
zeertzjq
d1464d16d6 fix(source): fix expand('<sfile>') no longer works for Lua 2022-08-16 05:39:44 +08:00
zeertzjq
9ab9eb1220 fix(source): make changing 'shellslash' change expand() result 2022-08-15 10:14:53 +08:00
zeertzjq
a6803f3adf test: add a test for what Vim patch 8.2.0151 fixes 2022-07-08 14:18:16 +08:00
Sean Dewar
da9b0abc67
feat(:source, nvim_exec): defer script item creation until s:var access
For anonymous scripts, defer the creation of script items until an attempt to access a script-local
variable is made. This dramatically reduces the number of script items created when using lots of
vim.cmd and nvim_exec especially.

This will mean <SID> usage fails until a script-local variable access is first made.
2021-10-14 12:50:04 +01:00
Sean Dewar
d4ed51eb44
feat(:source, nvim_exec): support script-local variables
Based on #13143 (and #11507) with changes:

 - Omit script_type_E. Use sn_name == NULL to determine anon items.
 - Keep SID_STR. Used by anon :source for .lua files (no item).
 - Show SID in get_scriptname output (:verbose set).
 - Factor item creation into new_script_item.
 - Leave sc_seq = 0 (anon scripts don't re-use the same item when re-sourced).
 - Add tests for anon :source.

Co-authored-by: Vikram Pal <vikrampal659@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2021-10-14 01:27:10 +01:00
Sean Dewar
afdc9e6150
fix(:source): copy curbuf lines to memory before sourcing #15111
It's possible for weirdness to happen if curbuf is modified while
sourcing from it via :source (with no arguments). For example:

- Deleting lines from or wiping curbuf can cause internal error E315 to
  be thrown from ml_get.
- Changing the curbuf to another buffer while sourcing can cause lines
  from the new curbuf to then be sourced instead.
2021-09-15 05:17:07 -07:00
Sean Dewar
6188926e00
fix(:source, nvim_exec): handle Vimscript line continuations #14809
Problem:
Anonymous :source (no args) and nvim_exec() don't support Vimscript line continuations.

Solution:
Factor out the concat logic into concat_continued_line() and a
CONCAT_CONTINUED_LINES macro for simple concatenations where lines are
fetched individually.

Closes #14807
2021-09-14 16:35:33 -07:00
shadmansaleh
b4ac878026 fix(source): Source giving E484 & parsing error at line 1 for lua files
It's happening because do_source is only expected to return FAIL when it
was unable to open file . But `nlua_exec_file` returns fail for parsing
and execution error too . Those errors are emitted through `nlua_error`.

So now return value of nlua_exec_file is ignored like do_cmdline. It now
only returns fail when it was unable to open file that check is done
before calling nlua_exec_file or do_cmdline. Errors in nlua_exec_file
are still directly emitted through nlua_error like before.
2021-06-21 13:07:05 +06:00
shadmansaleh
e1edc079dd refactor(source): Move lua file detection to do_source
So now :source can run lua files too :)

* feat: Add support for :[ranged]source for lua files
2021-06-11 01:01:03 +06:00
Vikram Pal
4d5dbea4f4
[RFC] ":source" sources from current buffer if filename is omitted (#11444)
Fix https://github.com/neovim/neovim/issues/8722
2021-02-18 01:25:51 -05:00