Commit Graph

3159 Commits

Author SHA1 Message Date
Justin M. Keyes
e31e49a8e3 refactor(vim.version): cleanup
- version.cmp(): assert valid version
- add test for loading vim.version (the other tests use shared.lua in
  the test runner)
- reduce test scopes, reword test descriptions
2023-03-06 14:51:56 +01:00
Kelly Lin
0e7196438d feat(lua): add semver api 2023-03-06 13:45:59 +01:00
Justin M. Keyes
533d671271
docs: module-level docstrings (@defgroup) #22498
Problem:
gen_vimdoc.py / lua2dox.lua does not support @defgroup or \defgroup
except for "api-foo" modules.

Solution:
Modify `gen_vimdoc.py` to look for section names based on `helptag_fmt`.

TODO:
- Support @module ?
  https://github.com/LuaLS/lua-language-server/wiki/Annotations#module
2023-03-05 15:15:29 -08:00
Jon Huhn
ac69ba5fa0
feat(lsp): implement workspace/didChangeWatchedFiles (#22405) 2023-03-05 07:52:27 +01:00
Jaehwang Jung
aa16590999
docs(lua): number → integer (#22517) 2023-03-04 13:07:39 +00:00
Jaehwang Jung
82b77900d7
docs(diagnostic): number → integer (#22512) 2023-03-04 13:06:20 +00:00
Jaehwang Jung
1f07307aeb
docs(inspect): number → integer (#22511) 2023-03-04 13:05:46 +00:00
Jaehwang Jung
ccd2cc1abd
docs(uri): number → integer (#22515) 2023-03-04 13:05:16 +00:00
Jaehwang Jung
128b82103b
docs(treesitter): number → integer (#22513) 2023-03-04 13:04:05 +00:00
Christian Clason
a4f443994b
docs(luvref): update to version bump (#22508) 2023-03-04 10:45:20 +01:00
Justin M. Keyes
8414cfe7f4 docs: fix vim.treesitter tags
Problem:
Help tags like vim.treesitter.language.add() are confusing because
`vim.treesitter.language` is (thankfully) not a user-facing module.

Solution:
Ignore the "fstem" when generating "treesitter" tags.
2023-03-03 15:07:23 +01:00
Christian Clason
f449121764
feat(treesitter): add :InspectTree command (#22477) 2023-03-02 18:03:11 +01:00
Justin M. Keyes
b0b4c31097
refactor: rename show_tree => inspect_tree #22474
Problem:
"show" is potentially a new verb that we can avoid (there is already
"open" and "echo"). Even if we can't avoid it, the behavior of
`show_tree` fits well in the "inspect" family of functions: a way for
users to introspect/reflect on the state of Nvim.

Existing "inspect" functions:
    vim.inspect()
    vim.inspect_pos()
    vim.treesitter.inspect_language()
    nvim__inspect_cell

Solution:
Rename `show_tree` to `inspect_tree`.
2023-03-02 07:01:42 -08:00
Mike
bc15b075d1
feat(vim.fs): pass path to find() predicate, lazy evaluate #22378
Problem:
No easy way to find files under certain directories (ex: grab all files under
`test/`) or exclude the content of certain paths (ex. `build/`, `.git/`)

Solution:
Pass the full `path` as an arg to the predicate.
2023-03-01 08:51:22 -08:00
bfredl
8bd0a9c360
Merge pull request #22429 from bfredl/hkmap
feat(edit)!: remove old c implementation of hebrew keymap
2023-02-28 19:38:38 +01:00
bfredl
cf07f2baab feat(edit)!: remove old c implementation of hebrew keymap
This feature has long been obsolete. The 'keymap' option can be used
to support language keymaps, including hebrew and hebrewp (phonetic
mapping). There is no need to keep the old c code with hardcoded
keymaps for some languages.
2023-02-28 15:14:03 +01:00
zeertzjq
278aeee3ae vim-patch:9.0.0430: cannot use repeat() with a blob
Problem:    Cannot use repeat() with a blob.
Solution:   Implement blob repeat. (closes vim/vim#11090)

375141e1f8

Co-authored-by: Bakudankun <bakudankun@gmail.com>
2023-02-28 21:27:43 +08:00
zeertzjq
ccac34af76 vim-patch:8.2.3446: not enough tests for empty string arguments
Problem:    Not enough tests for empty string arguments.
Solution:   Add tests, fix type check. (Yegappan Lakshmanan, closes vim/vim#8881)

820d5525ca

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-28 20:46:06 +08:00
zeertzjq
f6b9791212 vim-patch:8.2.3438: cannot manipulate blobs
Problem:    Cannot manipulate blobs.
Solution:   Add blob2list() and list2blob(). (Yegappan Lakshmanan,
            closes vim/vim#8868)

5dfe467432

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-28 20:46:06 +08:00
zeertzjq
7aad75e293 vim-patch:9.0.0810: readblob() returns empty when trying to read too much
Problem:    readblob() returns empty when trying to read too much.
Solution:   Return what is available.

5b2a3d77d3

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 19:52:45 +08:00
zeertzjq
4bd0611d7b vim-patch:9.0.0803: readblob() cannot read from character device
Problem:    readblob() cannot read from character device.
Solution:   Use S_ISCHR() to not check the size. (Ken Takata, closes vim/vim#11407)

43625762a9

S_ISCHR is always defined in Nvim.

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-02-28 19:52:45 +08:00
zeertzjq
bfa0bc7df0 vim-patch:9.0.0795: readblob() always reads the whole file
Problem:    readblob() always reads the whole file.
Solution:   Add arguments to read part of the file. (Ken Takata,
            closes vim/vim#11402)

11df3aeee5

Remove trailing whitespace in test as done in patch 9.0.1257.
Move the help for rand() before range().

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-02-28 19:52:45 +08:00
Justin M. Keyes
3b92776226
Merge #22382 has('gui_running') 2023-02-28 06:24:23 -05:00
Christian Clason
66c384d4e8
vim-patch:partial:dd60c365cd26 (#22437)
vim-patch:partial:dd60c365cd26

Update runtime files

dd60c365cd

Co-authored-by: Bram Moolenaar <Bram@vim.org>

Skip: eval.txt, repeat.txt (needs `getscriptinfo()`)
2023-02-28 09:34:27 +01:00
Lewis Russell
fb2ead6cf3
docs(usr): make usr_05.txt more coherent with Nvim changes (#22428)
- Make section 05.2 more coherent.
- Remove explanation of options that are already default.
2023-02-27 22:17:12 +00:00
Mike
f89e3497c8
docs(lsp): update cmd_env description (#22438) 2023-02-27 21:19:41 +01:00
Justin M. Keyes
ce597235a2 feat(ui): restore has('gui_running')
Problem:
has('gui_running') is still common in the wild and our answer has
changed over time, causing frustration.
95a6ccbe9f

Solution:
Use stdin_tty/stdout_tty to decide if a UI is (not) a GUI.
2023-02-27 19:50:59 +01:00
Justin M. Keyes
7f424e2b65 feat(api): more fields in nvim_list_uis
Problem:
nvim_list_uis does not report all ":help ui-option" fields.

Solution:
Store ":help ui-option" fields on the `UI` object and update ui_array.
2023-02-27 19:50:59 +01:00
zeertzjq
2c9fbe34b2
vim-patch:8.2.2336: Vim9: not possible to extend dictionary with different type (#22425)
Problem:    Vim9: it is not possible to extend a dictionary with different
            item types.
Solution:   Add extendnew(). (closes vim/vim#7666)

b0e6b51364

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-27 10:10:42 +08:00
zeertzjq
13da3d469a vim-patch:partial:9.0.0202: code and help for indexof() is not ideal
Problem:    Code and help for indexof() is not ideal.
Solution:   Refactor the code, improve the help. (Yegappan Lakshmanan,
            closes vim/vim#10908)

3fbf6cd355

Skip CHECK_LIST_MATERIALIZE and set_vim_var_type().
Use tv_list_uidx() instead of lv_idx.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-27 07:53:17 +08:00
zeertzjq
0972d7a124 vim-patch:9.0.0196: finding value in list may require a for loop
Problem:    Finding value in list may require a for loop.
Solution:   Add indexof(). (Yegappan Lakshmanan, closes vim/vim#10903)

b218655d5a

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-27 07:34:59 +08:00
Lewis Russell
774e59f3f9
feat(treesitter): expand the API 2023-02-26 16:53:33 +00:00
Mathias Fußenegger
c1514d7e67
fix(lsp): fix some type annotations (#22397) 2023-02-25 18:47:05 +01:00
Mathias Fussenegger
f0f27e9aef Revert "feat(lsp): implement workspace/didChangeWatchedFiles (#21293)"
This reverts commit 5732aa706c.

Causes editor to freeze in projects with many watcher registrations
2023-02-25 11:17:28 +01:00
Jon Huhn
5732aa706c
feat(lsp): implement workspace/didChangeWatchedFiles (#21293) 2023-02-25 10:07:18 +01:00
Lewis Russell
c57af5d41c
feat(treesitter)!: remove silent option from language.add()
Simply use `pcall` if you want to silence an error.
2023-02-24 09:50:59 +00:00
zeertzjq
904d099583 vim-patch:8.2.2449: Vim9: flatten() always changes the list type
Problem:    Vim9: flatten() always changes the list type.
Solution:   Disallow using flatten() and add flattennew().

3b69006973

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-24 15:36:08 +08:00
Lewis Russell
1df3f5ec6a
feat(treesitter): upstream foldexpr from nvim-treesitter 2023-02-23 17:05:20 +00:00
Christian Clason
6dfbeb0d99 docs: fix more treesitter parsing errors 2023-02-23 10:25:22 +01:00
Christian Clason
1c37553476 test(help): drop treesitter parse error to 0
All parser errors have been fixed; make sure we don't introduce new
ones.
2023-02-23 10:24:15 +01:00
bfredl
799edca18a feat(lua): make sure require'bit' always works, even with PUC lua 5.1 2023-02-22 22:15:19 +01:00
Justin M. Keyes
09b6a68c37
Merge #21428 docs: naming conventions, guidelines 2023-02-22 10:40:01 -05:00
Justin M. Keyes
6752f1005d docs: naming conventions, guidelines
close #21063
2023-02-22 16:23:49 +01:00
Luuk van Baal
0b36145c69 docs: mention getmousepos() for click execute function label
close #18741
close #11312
2023-02-22 16:23:49 +01:00
Justin M. Keyes
b496605fea docs: vim_diff.txt 2023-02-22 16:23:49 +01:00
Gregory Anders
675826da63
refactor(treesitter): Add vim.treesitter.get_node() (#22360)
This function replaces both vim.treesitter.get_node_at_pos() and
vim.treesitter.get_node_at_cursor(). These two functions are similar
enough that they don't need separate interfaces. Even worse,
get_node_at_pos() returns a TSNode while get_node_at_cursor() returns a
string, so the two functions behave slightly differently.

vim.treesitter.get_node() combines these two into a more streamlined
interface. With no arguments, it returns the node under the cursor in
the current buffer. Optionally, it can accept a buffer number or a
position to get the node at a given position in a given buffer.
2023-02-22 08:01:08 -07:00
Lewis Russell
8714a4009c
feat(treesitter): add filetype -> lang API
Problem:

  vim.treesitter does not know how to map a specific filetype to a parser.

  This creates problems since in a few places (including in vim.treesitter itself), the filetype is incorrectly used in place of lang.

Solution:

  Add an API to enable this:

  - Add vim.treesitter.language.add() as a replacement for vim.treesitter.language.require_language().
    - Optional arguments are now passed via an opts table.
    - Also takes a filetype (or list of filetypes) so we can keep track of what filetypes are associated with which langs.
    - Deprecated vim.treesitter.language.require_language().
  - Add vim.treesitter.language.get_lang() which returns the associated lang for a given filetype.
  - Add vim.treesitter.language.register() to associate filetypes to a lang without loading the parser.
2023-02-21 17:09:18 +00:00
zeertzjq
344a1ee8e6
docs: fix typos (#22353) 2023-02-22 00:07:26 +08:00
zeertzjq
ee26b227e1
vim-patch:partial:938ae280c79b (#22356)
Update runtime files.

938ae280c7

Partially skip autocmd.txt: needs patch 8.2.5011.
Partially skip builtin.txt: needs patch 9.0.0411.
Partially skip eval.txt: needs patch 8.2.3783.
Cherry-pick :map-meta-keys from patch 9.0.1276.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-21 23:50:29 +08:00
zeertzjq
f1816f9ee2
refactor(main.c): remove unreachable use_builtin_ui conditions (#22338)
When use_builtin_ui is true, Nvim will exit before line 385 is reached.
2023-02-20 15:13:55 +08:00