Commit Graph

332 Commits

Author SHA1 Message Date
Björn Linse
0f596665cc feat(lua): make vim.mpack support vim.NIL and vim.empty_dict() 2021-09-09 16:06:43 +02:00
Justin M. Keyes
69fe427df4 feat(lua)!: register_keystroke_callback => on_key
Analogous to nodejs's `on('data', …)` interface, here on_key is the "add
listener" interface.

ref 3ccdbc570d #12536

BREAKING_CHANGE: vim.register_keystroke_callback() is now an error.
2021-09-09 06:09:33 -07:00
Björn Linse
6896d22b63 fix(lua): preserve argument lists which are not lists 2021-08-29 16:04:50 +02:00
notomo
08e223cebb
tests(lua/on_yank): assert conditions that fail correctly #15495
The test added in 274a3504a7
does not fail if the code changes are reverted.
2021-08-27 04:54:01 -07:00
notomo
274a3504a7
fix(lua): verify buffer in highlight.on_yank (#15482)
Resolve an issue with deferred clearing of highlight failing if the 
buffer is deleted before the timeout by checking whether the
buffer is valid first.
2021-08-26 16:37:36 +02:00
Justin M. Keyes
4c499899b2
Merge #15293 Vimscript "method" syntax
Port VimL's method call syntax - vim-patch:8.1.{1638,1800,1803,1807,1809,1816,1820,1821,1828,1834,1835,1861,1863,1878,1879,1888,1909,1911,1912}
2021-08-26 04:26:32 -07:00
Thomas Vigouroux
14231463a4
fix(bufupdates): send correct updates for visual paste
One step further towards stable tree-sitter.

Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
2021-08-25 15:11:39 +02:00
Lewis Russell
3d3c0c669d
feat(api): add lua C bindings for xdiff (#14536)
* feat(api): add lua C bindings for xdiff

* chore: opt.hunk_lines -> opt.result_type

opt.on_hunk now takes precedence over opt.result_type

* chore: fix indents

Fix indents

* chore: change how priv is managed

Assign priv NULL and unconditionally apply XFREE_CLEAR to it when
finished.
2021-08-22 12:22:04 +02:00
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
Folke Lemaitre
526fc609b8
fix(shared): do not treat empty tables as list in deep extend (#15094)
An empty table was previously always treated as a list, which means that
while merging tables, whenever an empty table was encountered it would
  always truncate any table on the left.

`vim.tbl_deep_extend("force", { b = { a = 1 } }, { b = {} })`

Before: `{ b = {} }`
After: `{ b = { a = 1 } }`
2021-07-19 08:52:44 -07:00
Tom Payne
1dab9357de feat(vim.uri): Allow URI schemes other than file: without authority 2021-07-10 18:27:37 +01:00
Alessandro Pezzoni
ce5f4228aa test(lsp): file URIs without a hostname 2021-07-10 18:27:37 +01:00
jadedpasta
490615612e
fix(vim.opt): vimL map string values not trimmed (#14982)
Options formatted as a list of comma-separated key-value pairs may have
values that contain leading and trailing whitespace characters. For
example, the `listchars` option has a default value of
`"tab:> ,trail:-,nbsp:+"`. When converting this value to a lua table,
leading and trailing whitespace should not be trimmed.

Co-authored-by: Robert Hrusecky <robert.hrusecky@utexas.edu>
2021-07-04 00:14:39 -07:00
TJ DeVries
2bcf18deaa
Merge pull request #14779 from tjdevries/tjdevries/vim_opt_fixes
An assortment of various vim.opt fixups.
2021-06-29 10:24:41 -04:00
Björn Linse
f8990870ff
Merge pull request #14335 from chentau/extmark_delbytes
Extmarks: manually zero out `curbuf->deleted_bytes2` on substitute and join
2021-06-29 15:31:23 +02:00
TJ DeVries
19b7cef0a7 fix(vim.opt): Fix #14828 with empty values being incorrectly inserted 2021-06-29 09:18:59 -04:00
TJ DeVries
6ecec87c09 fix(vim.opt): Fix #14668 Now correctly handles unescaped commas in isfname style 2021-06-29 08:42:07 -04:00
TJ DeVries
9119ea1bec fix(vim.opt): Fix #14669 whichwrap now acts as expected 2021-06-29 08:42:07 -04:00
David Zhang
b02e64c4df fix(vim.opt): Add basic error handling 2021-06-29 08:42:07 -04:00
ckipp01
e6175f6389 fix(vim.opt): Get window options before setting.
This closes #14677, but I also am a little unsure if there are times
where this may not be correct. However, this just changes the behavior
that even if `was_set` was false, we still get for
`nvim_win_get_option`.
2021-06-29 08:42:07 -04:00
TJ DeVries
1d3ee1c441 fix(vim.opt): #14708 Now lets you put duplicate values in wildmode 2021-06-29 08:42:07 -04:00
chentau
1c962401a1 Manually zero out deleted_bytes2 when substituting and joining lines 2021-06-29 00:48:24 -07:00
shadmansaleh
92b6b3764c refactor(tests): Simplify tests at functional/lua/runtime_spec 2021-06-11 01:01:03 +06:00
shadmansaleh
f000251e08 feat(runtime): Allow lua to be used in syntax 2021-06-11 01:01:03 +06:00
shadmansaleh
f256a18fef feat(runtime): Allow lua to be used in ftdetect 2021-06-11 01:01:02 +06:00
shadmansaleh
4dffe1ff2f feat(runtime): Allow lua to be used in indent 2021-06-11 01:01:02 +06:00
shadmansaleh
fd5e5d2715 feat(runtime): Allow lua to be used in ftplugin 2021-06-11 01:01:02 +06:00
shadmansaleh
68be8b99cf feat(runtime): Allow lua to be used in compiler 2021-06-11 01:01:02 +06:00
shadmansaleh
1e6c02510a feat(runtime): Allow lua to be used in colorschemes
* tests(runtime): move runtime/plugin tests to functional/lua/runtime_spec
2021-06-11 01:01:02 +06:00
notomo
1a9eb7a987 api: add nvim_win_call 2021-06-10 09:34:29 +02:00
jbyuki
a15c2cbab6 add tests in buffer_updates 2021-06-09 12:20:13 -07:00
TJ DeVries
43956dea55
lua: Add vim.opt and fix scopes of vim.o (#13479)
* lua: Add vim.opt

* fixup: cleaning

* fixup: comments

* ty clason

* fixup: comments

* this is the last commit. period.
2021-05-28 17:24:48 +02:00
Thomas Vigouroux
3bd9cce368
Merge pull request #14575 from vigoux/virtualedit-bytes
fix(bufupdate): send events when inserting with virtualedit
2021-05-20 20:05:25 +02:00
Björn Linse
7fbf3bf18b lua: use proper conversion of vim.g values 2021-05-19 19:29:19 +02:00
Thomas Vigouroux
237175cf20
fix(bufupdate): send events when inserting with virtualedit
Problem first raised
https://github.com/nvim-treesitter/nvim-treesitter/issues/1304
2021-05-18 19:31:56 +02:00
chentau
13a9bd006f make get_region_bytecount end-exclusive 2021-05-09 16:23:01 -07:00
chentau
a847abc21b refactor nvim_buf_set_lines to use extmark_splice 2021-05-09 16:22:20 -07:00
chentau
37c8067226 splice extmarks on every line for block visual paste 2021-05-06 20:40:26 -07:00
Björn Linse
63b64ebab0
Merge pull request #14385 from chentau/extmark_delete
Extmarks: remove `curbuf->deleted_bytes2` from `op_delete`
2021-04-17 09:25:44 +02:00
chentau
e32eaf6538 extmarks: remove curbuf->deleted_bytes2 from op_delete 2021-04-16 23:42:53 -07:00
chentau
5a36d413fb flush curbuf->deleted_bytes2 after calling do_move 2021-04-14 21:47:21 -07:00
Björn Linse
c9817603cf
Merge pull request #14318 from chentau/extmark_luado
extmark: splice extmarks on :luado
2021-04-13 15:00:42 +02:00
chentau
ff43d9597e extmark: splice extmarks on :luado 2021-04-12 11:33:50 -07:00
Björn Linse
6435b46b48
Merge pull request #14317 from chentau/extmark_sub
extmark: correct extmark_splice call with substitute and inccommand when replacing with escaped backslashes
2021-04-10 18:14:42 +02:00
chentau
343ee2d254 extmark: correct extmark_splice call with inccommand 2021-04-09 00:34:02 -07:00
chentau
7602c56050 extmark: fixes for noexpandtab and retab 2021-04-02 16:21:46 -07:00
Björn Linse
1186f7dd96
Merge pull request #14191 from chentau/extmark_blockpaste
Extmarks: send correct buffer events on blockwise paste for nonuniform lines
2021-03-24 00:27:55 +01:00
chentau
7fbabbaa57 Extmarks: correct buffer events on blockwise paste 2021-03-23 14:06:57 -07:00
chentau
a92a8ef506 Correctly splice extmarks on tab with noexpandtab set 2021-03-22 20:26:25 -07:00
Björn Linse
e355cc8cc5
Merge pull request #13875 from smolck/vim_fn_error_on_api
vim.fn: throw error when trying to use API function
2021-03-09 23:12:23 +01:00
smolck
d1899bb5f4 use pcall_err 2021-03-09 15:23:42 -06:00
Björn Linse
6995fad260
Merge pull request #13973 from chentau/on_bytes_undofile
New versions of neovim will not read undofiles written by nvim before this merge (there will be an error message about incopmatible version). Nvim 0.4 (or an master up to bda12927be ) can be used to recover older undofiles, so if you worried about unsaved changes lurking around in undofiles it would make sense to keep such version around somewhere to recover them.

This is a necessary change to keep tree-sitter and plugins dependent on byte-level buffer change events fully working with undo states from a undofile. If there is a clear demand we might implement reading of the old format. Such recovered buffers will not be be fully functional with plugins relying on buffer updates or tree-sitter, however.
2021-03-03 09:45:06 +01:00
chentau
f42e932df4 Extmarks: Save extmark undo information to undofile. 2021-03-02 12:45:54 -08:00
Björn Linse
772421f6b1
Merge pull request #13692 from mjlbach/fix_cursor_respect_current_line
fix_cursor: do not change line number when edit will not impact cursor row
2021-02-16 18:32:38 +01:00
Björn Linse
c7a65fe6a1 buffer_updates: autoload episode III: revenge of the trees 2021-02-14 11:10:36 +01:00
Björn Linse
94622ca66b buffer updates: add on_reload callback and handle it in treesitter parser 2021-02-10 18:58:46 +01:00
Thomas Vigouroux
3094bb4e38 fix(buf_updates): send updates when putting past last line
Fixes #13710
2021-02-08 19:08:42 +01:00
smolck
ad1a437835 vim.fn: add test for error 2021-02-04 09:22:27 -06:00
Björn Linse
209fb35acd tests: clean up lua/buffer_updates_spec.lua 2021-02-04 14:35:30 +01:00
Björn Linse
aa50369897 inccommand: preserve extmarks when undoing preview substitution 2021-02-04 14:33:37 +01:00
Michael Lingelbach
563d7b694b tests: add test for cursor postion when deleting buffer lines 2021-01-31 12:43:48 -08:00
chentau
f0ccac0ba4 lint 2021-01-26 17:09:35 -08:00
Tony Chen
d95a465b43 Don't show entire context when completing 2021-01-26 17:04:32 -08:00
TJ DeVries
901dd79f6a feat: add completion to ':lua' 2021-01-26 17:04:31 -08:00
Björn Linse
adb01190c4 tests: make treesitter its own category 2021-01-03 14:47:29 +01:00
Björn Linse
39d098f9f9 api: set_text: fix some byte count issues
add byte count tests

update documentation
2021-01-01 19:51:58 +01:00
Björn Linse
5e202f69b3
Merge pull request #13367 from nvim-treesitter/offset-lang-injection
feat(treesitter): add offset predicate for language injection
2020-12-16 13:59:36 +01:00
Thomas Vigouroux
25e20da550
feat(buffer_updates): allow ignoring when previewing
Also adds a test that we actually subscribe to buffer events when in
CMDPREVIEW.
2020-12-15 22:29:27 +01:00
Steven Sojka
929f194145 feat(treesitter): add offset predicate for language injection
refactor(treesitter): add directives to queries
2020-12-15 07:03:47 -06:00
Björn Linse
52e660e857
Merge pull request #13482 from dm1try/propagate_lua_file_loading_errors
runtime: propagate lua parsing errors while using "require"
2020-12-10 12:15:40 +01:00
Thomas Vigouroux
99007bcc12
Merge pull request #13450 from nvim-treesitter/fix-unknown-language-parser
fix(treesitter): don't throw an error for missing injected langs
2020-12-10 11:12:39 +01:00
dm1try
3421485253 runtime: propagate lua parsing errors while using "require" 2020-12-10 10:53:28 +01:00
Steven Sojka
e15c5f58df fix(treesitter): don't throw an error for missing injected langs 2020-12-04 16:56:29 -06:00
Steven Sojka
2985c17867 fix(treesitter): incorrect method name call 2020-12-04 16:15:47 -06:00
Thomas Vigouroux
52d76f0a32
fix(treesitter): allow ranges in set_included_ranges 2020-11-23 15:09:32 +01:00
Steven Sojka
1a631026a9
feat(treesitter): add language tree
Implement the LanguageTree structure to enable language injection.

This is done be removing the old Parser metatable and replacing by the
new structure, with the same API (almost).

Some noticeable differences :
  - `parser:parse()` now returns a table of trees
  - There is no incremental parsing for child (injected) languages

Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
2020-11-23 08:06:17 +01:00
Björn Linse
1b0e4a5906 lua: make vim.inspect available early so it can be used for path debugging 2020-11-05 14:46:41 +01:00
Thomas Vigouroux
8e73cf6731
tree-sitter: ignore some tests on windows
Weirdl this test is failing, but can't reproduce locally, this is an
unnecessary blocker for this PR.
2020-11-03 10:39:36 +01:00
Jan Edmund Lazo
0d9fa42d83
fixup! startup: handle autoload and lua packages during startup 2020-11-02 22:37:07 -05:00
Björn Linse
c60c7375f5 startup: handle autoload and lua packages during startup
¡NO HAY BANDA!
2020-11-02 15:21:36 +01:00
Björn Linse
03c478ae53 treesitter: add node:id() 2020-11-01 14:59:17 +01:00
TJ DeVries
0ad5b34170
Merge pull request #12053 from tjdevries/tjdevries/nicer_validate
vim.validate(): include stacktrace in message
2020-10-17 16:47:18 -04:00
Thomas Vigouroux
bdbc56f931 treesitter: allow custom parser for highlighter
Also allow to get parser ranges.

This will be useful for language injection, allowing us to tweak the
parser's ranges on the fly.

Update runtime/lua/vim/treesitter.lua

Co-authored-by: Paul Burlumi <paul@burlumi.com>
2020-10-12 18:23:14 +02:00
Thomas Vigouroux
d3f544002c treesitter: runtime queries
Runtime queries just work like ftplugins, that is:

- Queries in the `after` directory are sourced _after_ the "base" query
- Otherwise, the last define query takes precedence.

Queries can be found in the `queries` directory.

Update runtime/lua/vim/treesitter/query.lua

Co-authored-by: Paul Burlumi <paul@burlumi.com>
2020-10-11 21:18:28 +02:00
Björn Linse
0b615dae07 api: multiple decoration providers at once 2020-10-10 15:16:45 +02:00
TJ DeVries
7b89353985
lua: vim.wait allows control of fast events (#13053)
* lua: vim.wait allows control of fast events

* fixup: remove requirement of function for easier waiting

* fixup: lint

* fixup: bfredl comments
2020-10-06 12:58:05 -04:00
Justin M. Keyes
8e77d70e29 test/vim.validate(): assert normalized stacktrace
- The previous commit lost information in the tests. Instead, add some
  more "normalization" substitutions in pcall_err(), so that the general
  shape of the stacktrace is included in the asserted text.
- Eliminate contains(), it is redundant with matches()
2020-10-05 09:47:59 -04:00
TJ DeVries
aad7a74053 vim.validate(): include stacktrace in message 2020-10-05 09:47:59 -04:00
KillTheMule
02dcc3c11a Fix byte updates for blockwise paste at buffer end 2020-09-30 21:28:21 +02:00
Thomas Vigouroux
c1a740ae33 bytetrack: add blockwise paste test 2020-09-30 20:10:06 +02:00
KillTheMule
ba515622fb Fix buffer_updates on blockwise paste
Fixes #12718.
2020-09-30 20:10:05 +02:00
Thomas Vigouroux
3c5141d2cf
treesitter: add string parser (#13008) 2020-09-30 09:32:43 -04:00
Björn Linse
3610d0091f test: buffer updates: add visual charwise paste test 2020-09-19 15:50:35 +02:00
Björn Linse
b7fc7ac6a1 buffer updates: fix issues with "change" operator 2020-09-19 10:01:00 +02:00
Björn Linse
4cc2a7af4b tests: lua buffer updates: reorg check_events() 2020-09-19 09:58:31 +02:00
Thomas Vigouroux
179f0bca18 buf_updates: fix wrong updates on linewise change 2020-09-18 17:54:49 +02:00
Thomas Vigouroux
6dc815530b
buf_updates: fix updates for empty buffers (#12926)
On empty buffers, when editing the first line, the line is buffered, causing offset to be < 0. While the buffer is not actually empty, the buffered line has not been flushed (and should not be) yet, so the call is valid but an edge case.
2020-09-17 23:34:28 +02:00
Thomas Vigouroux
9a7f111db6 treesitter: filter updates on <CR>
This fixes an error when fo=ro, when hitting <CR> to insert a new
comment line.
2020-09-16 16:35:17 +02:00
Björn Linse
34c0f7af04 buf_attach: fix buffer updates with setline() 2020-09-16 13:50:16 +02:00
Björn Linse
ead2fcf4ee api: add nvim_buf_call to call function with curbuf changed to buffer 2020-09-13 09:11:38 +02:00
Thomas Vigouroux
e4b5efa51e fix: use luahl in treesitter 2020-09-13 07:46:39 +02:00
Thomas Vigouroux
a8f71676a1 fix(bufupdates): avoid sending empty updates 2020-09-11 14:48:10 +02:00
Thomas Vigouroux
f0e258cf85 fix(bytetrack): send correct events when opening lines
a bit of test cleanup

ärrår

feeel

SPLIT

fix: sned correct updates on <CR>
2020-09-11 14:38:58 +02:00
Björn Linse
f239134fee tests: disable hl glitch test for now, will be fixed in luahl (next PR) 2020-09-10 06:50:04 +02:00
Thomas Vigouroux
82fb6a8818 fix lints 2020-09-09 21:22:21 +02:00
Björn Linse
bc86f76c0a api/buffer: add "on_bytes" callback to nvim_buf_attach
This implements byte-resolution updates of buffer changes.
Note: there is no promise that the buffer state is valid inside
the callback!
2020-09-09 21:22:21 +02:00
Thomas Vigouroux
1ff064126d treesitter: revert wrong optimization in highlights 2020-09-09 16:00:19 +02:00
Björn Linse
b397f31ede tests: update query.list_predicates() test 2020-09-06 10:33:13 +02:00
Thomas Vigouroux
dc579c420b treesitter: Use excplicit names in tests 2020-09-06 10:30:40 +02:00
Thomas Vigouroux
3fd6e3b923 treesitter: allow to list supported predicates 2020-09-04 15:24:23 +02:00
Thomas Vigouroux
4bcf54478a
Merge pull request #12814 from theHamsta/escape-queries
treesitter: avoid escaping complete query strings
2020-09-01 12:50:21 +02:00
Thomas Vigouroux
18217b987f treesitter: add node:field() to get field children 2020-09-01 08:57:55 +02:00
Stephan Seitz
b058c671d2 treesitter: avoid escaping complete query strings
Escape "\\" only for `vim-match?` not for `match?`
Fixes #12595
2020-08-31 17:24:38 +02:00
Thomas Vigouroux
e123fd0a5d treesitter: allow to iterate over node children 2020-08-31 13:42:30 +02:00
Thomas Vigouroux
24b5f69a49
fix(win): ignore closing wins in win_findbuf #12798
This caused segfaults when calling win_findbuf in an `on_detach`
callback, when the callback was triggered when closing the last window
containing the buffer.
2020-08-31 00:53:10 -07:00
TJ DeVries
3ccdbc570d
lua: add vim.register_keystroke_callback (#12536)
* feat: Add vim.register_keystroke_callback

* fixup: Forgot to remove mention of old option

* fixup: Answer jamessan comments

* fixup: Answer norcalli comments

* fixup: portability

* Update runtime/doc/lua.txt

Co-authored-by: Ashkan Kiani <ashkan.k.kiani@gmail.com>
2020-08-14 10:03:17 -04:00
Thomas Vigouroux
d7b12e58df treesitter: add and test vim-match? predicate 2020-08-13 20:30:15 +02:00
Thomas Vigouroux
58e37d7df8 treesitter: add contains? predicate 2020-08-13 20:30:15 +02:00
Thomas Vigouroux
613068071e treesitter: refactor and use lua regexes 2020-08-13 20:30:15 +02:00
Thomas Vigouroux
2c34780c32 buffer_updates: emit valid old_byte_size
Test this using treesitter highlighting, which is based on this
old_byte_size.
2020-07-21 19:18:04 +02:00
TJ DeVries
398201cfab
lua: Fix crash on unprotected lua errors (#12658)
Can be reproduced with a script like this:

-- in some lua file
vim.fn.timer_start(10, function() error("uh....") end)

-- will cause neovim to crash with the following error.
PANIC: unprotected error in call to Lua API
        (nlua_CFunction_func_call failed.)

After this, it will instead print the error message
from the top of the stack, like so.

tmp/error_nvim.lua:10: uh...

Also added an example test. Previously this test
caused the embedded nvim to panic.
2020-07-19 17:16:48 -04:00
TJ DeVries
6360cf7ce8 lua: Add ability to pass tables with __call
vim-patch:8.2.1054: not so easy to pass a lua function to Vim
vim-patch:8.2.1084: Lua: registering function has useless code

I think I have also opened up the possibility for people to use these
callbacks elsewhere, since I've added a new struct that we should be
able to use.

Also, this should allow us to determine what the state of a list is in
Lua or a dictionary in Lua, since we now can track the luaref as we go.
2020-07-10 20:23:12 -04:00
TJ DeVries
971a191c4d lua: Add ability to pass lua functions directly to vimL 2020-07-10 16:17:33 -04:00
Thomas Vigouroux
d19132ffd1 treesitter: update test to show overlapping works 2020-07-10 17:16:24 +02:00
Thomas Vigouroux
69816f5e13 treesitter: use single nodes in set_ranges
fixup! treesitter: fix lint
2020-06-29 23:32:49 +02:00
Thomas Vigouroux
66af35fc85 treesitter: separate tests into smaller pieces 2020-06-29 22:21:06 +02:00
Thomas Vigouroux
b652f74ca3 treesitter: use nodes to mark ranges 2020-06-29 22:21:06 +02:00
Thomas Vigouroux
ac18403d6e treesitter: test newly added set_included_ranges 2020-06-29 22:21:06 +02:00
Matthieu Coudron
dbc8ec9446
Merge pull request #12321 from vigoux/treesitter-runtime
treesitter: update runtime
2020-06-06 15:37:51 +02:00
TJ DeVries
d14298a1f0 test: remove flaky unhelpful test
vim.wait( sthg)
2020-06-06 01:11:12 +02:00
notomo
ac5a3f2c56
lua: fix behavior when split empty string (#12429)
* lua: fix behavior when split empty string

* test: lsp.util.apply_text_edits with an empty edit
2020-06-04 08:48:48 -04:00
Thomas Vigouroux
6a93077475 treesitter: fix tests 2020-06-03 19:58:02 +02:00
notomo
60c581b35d
lua: fix infinite loop for vim.split on empty string (#12420) 2020-06-02 19:31:43 -04:00
Thomas Vigouroux
8349192503 treesitter: update runtime
Since tree-sitter PR 615, predicates are not parsed the same.
"Old" way of writing predicates is still supported.
2020-06-02 21:19:07 +02:00
TJ DeVries
be662fe5c7 lua: vim.wait implementation 2020-05-30 12:01:32 -04:00
Mathias Fußenegger
04a0486c66
Change uri_to_fname to not convert non-file URIs (#12351)
* Change uri_to_fname to not convert non-file URIs

A URI with a scheme other than file doesn't have a local file path.

* fixup! Change uri_to_fname to not convert non-file URIs

* fixup! fixup! Change uri_to_fname to not convert non-file URIs
2020-05-22 01:17:21 +09:00
Hirokazu Hata
eabf1803cd
test: fix flaky vim.defer_fn test 2020-05-19 00:02:14 +09:00
Christian Clason
f2894bffb0
lua: Add highlight.on_yank (#12279)
* add lua function to highlight yanked region

* extract namespace, better naming, default values

* add default for event argument

* free timer

* factor out mark to position calculation

* d'oh

* make sure timer stops before callback (cf. luv example)

* factor out timer, more documentation

* fixup

* validate function argument for schedule

* fix block selection past eol

* correct handling of multibyte characters

* move arguments around, some cleanup

* move utility functions to vim.lua

* use anonymous namespaces, avoid local api

* rename function

* add test for schedule_fn

* fix indent

* turn hl-yank into proper (hightlight) module

* factor out position-to-region function

mark extraction now part of highlight.on_yank

* rename schedule_fn to defer_fn

* add test for vim.region

* todo: handle double-width characters

* remove debug printout

* do not shadow arguments

* defer also callable table

* whitespace change

* move highlight to vim/highlight.lua

* add documentation

* add @return documentation

* test: add check before vim.defer fires

* doc: fixup
2020-05-18 09:49:50 -04:00
Hirokazu Hata
ae5bd0454e
lua: add tbl_deep_extend (#11969) 2020-05-17 13:24:34 -04:00
TJ DeVries
1407899c32
lua: Add buffer, window and tab accessors (#12268)
* Add buffer, window and tab accessors

* Fix deletion and add tests
2020-05-07 15:22:24 -04:00
Mathias Fußenegger
2c40a38b39
LSP: Avoid URI-to-fname conversion for non-file URIs #12243
Fixes https://github.com/neovim/neovim/issues/12210
2020-05-04 20:06:40 -07:00
Tristan Konolige
bf0f745861
lua: allow deepcopy of functions (#12136) 2020-04-19 01:04:37 +02:00
Hirokazu Hata
4139678f97
vim.uri: fix uri_to_fname (#12059)
fix: #12056
If the colon of the drive letter of windows is URI encoded,
it doesn't match the expected pattern, so decode it first.
2020-03-30 14:30:24 +02:00
Hirokazu Hata
e35ff7371f
lua: add vim.tbl_len() #11889 2020-03-01 23:38:43 -08:00
Björn Linse
9c00fea585 lua: add regex support, and @match support in treesitter queries 2020-02-26 19:39:02 +01:00
Hirokazu Hata
e2ed8053bf
lua: move test helper function, map and filter, to vim.shared module 2020-02-18 17:43:10 +09:00
Björn Linse
dc0e534a91
Merge pull request #11864 from h-michael/deepcopy
lua: vim.deepcopy() and vim.tbl_extend() should preserve vim.empty_dict()
2020-02-15 18:10:48 +01:00
Hirokazu Hata
cdb729b746
lua: add vim.tbl_extend and vim.deepcopy test 2020-02-14 22:36:21 +09:00
Hirokazu Hata
417fc6ccf7
lua: vim.deepcopy uses empty_dict() instead of {} for empty_dict()
fix: https://github.com/neovim/nvim-lsp/issues/94
2020-02-13 11:55:43 +09:00