aboutsummaryrefslogtreecommitdiff
path: root/src/gen
Commit message (Collapse)AuthorAge
* build: bump NVIM_API_LEVEL #33340Justin M. Keyes2025-04-05
| | | | | Bumping NVIM_API_LEVEL is pretty much required after every major release, because it's also used to correlated Lua stdlib changes to a Nvim version.
* docs: lsp config/commands #33122Justin M. Keyes2025-03-30
| | | fix #33075
* vim-patch:9.1.1247: fragile setup to get (preferred) keys from ↵zeertzjq2025-03-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | key_name_entry (#33102) Problem: fragile setup to get (preferred) keys from key_name_entry (after v9.1.1179) Solution: refactor the code further, fix a bug with "pref_name" key entry introduced in v9.1.1180 (Yee Cheng Chin) The optimization introduced for using bsearch() with key_name_entry in vim/vim#16788 was fragile as it required synchronizing a non-obvious index (e.g. IDX_KEYNAME_SWU) with the array that could be accidentally changed by any one adding a key to it. Furthermore, the "pref_name" that was introduced in that change was unnecessary, and in fact introduced a bug, as we don't always want to use the canonical name. The bug is triggered when the user triggers auto-complete using a keycode, such as `:set <Scroll<Tab>`. The bug would end up showing two copies of `<ScrollWheelUp>` because both entries end up using the canonical name. In this change, remove `pref_name`, and simply use a boolean to track whether an entry is an alt name or not and modify logic to respect that. Add test to make sure auto-complete works with alt names closes: vim/vim#16987 https://github.com/vim/vim/commit/7d8e7df55190e8e4e5a66f443e4440b52edf2fdb In Nvim there is no `enabled` field, so put `is_alt` before `name` to reduce the size of the struct. Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* refactor(eval): move diff functions to diff.c (#33085)zeertzjq2025-03-27
| | | | They were moved in Vim in patch 8.1.1989. This change is required to port patch 9.1.1243.
* docs: misc #32959Justin M. Keyes2025-03-18
|
* refactor(gen_keycodes): put TAB and K_TAB together (#32882)zeertzjq2025-03-14
| | | | Keep track of the original indexes of both TAB and K_TAB, so that there doesn't have to be an extra table and loop for K_TAB.
* feat(treesitter): allow disabling captures and patterns on TSQuery (#32790)Ian Chamberlain2025-03-11
| | | | | | | | | Problem: Cannot disable individual captures and patterns in treesitter queries. Solution: * Expose the corresponding tree-sitter API functions for `TSQuery` object. * Add documentation for `TSQuery`. * Return the pattern ID from `get_captures_at_pos()` (and hence `:Inspect!`).
* fix(lua): types for vim.api.keyset.win_config #32700Tomasz N2025-03-10
|
* refactor(gen_events): sort enums case-insensitively (#32811)zeertzjq2025-03-10
| | | | | | | | This actually only affects the order in which Cmdline* and Cmdwin* autocommands are listed, and it appears that the names of Cmdwin* were changed to CmdWin* in 8ed2dbf6e2802516501c11e72e5d6d977e6a07f3 without explanation. Also, remove the final NULL element from the names table.
* perf(events): use hashy for event name lookup (#32802)zeertzjq2025-03-10
|
* docs(api): show "since" in API docs #32806Justin M. Keyes2025-03-09
|
* fix(build): vimdoc tags are not validated #32801Justin M. Keyes2025-03-09
| | | | | | | | | Problem: "make lintdoc" is not validating vimdoc (:help) tags. Solution: - Call `lang_tree:parse()` to init the parser. - Load netrw 🤢 explicitly, since it was moved to `pack/dist/opt/`. - Fix invalid help tags.
* build(generator): add dependencies on hashy (#32796)zeertzjq2025-03-09
| | | | | | | This allows generated sources to be automatically rebuilt when modifying hashy code. Also, appending to NVIM_GENERATED_FOR_{HEADERS,SOURCES} in the middle of custom commands is a bit strange. Move that after the custom commands.
* refactor(hashy): use case labels instead of TOLOWER_ASC() (#32795)zeertzjq2025-03-09
| | | | | | | | | Follow-up to #32768 This is slightly faster according to the benchmark. This also makes it a build error if hashy is used incorrectly (generating a case-insensitive hash function from mixed-case strings), as duplicate case labels aren't allowed.
* vim-patch:9.1.1184: Unnecessary use of vim_tolower() in vim_strnicmp_asc() ↵zeertzjq2025-03-09
| | | | | | | | | | | | | | | | | | | | | (#32792) Problem: Unnecessary use of vim_tolower() in vim_strnicmp_asc(). Solution: Use TOLOWER_ASC() instead (zeertzjq). It was passing *s1 and *s2 to vim_tolower(). When char is signed, which is the case on most platforms, c < 0x80 is always true, so it already behaves the same as TOLOWER_ASC(). closes: vim/vim#16826 https://github.com/vim/vim/commit/b7dc5d3b6169efc8aa0b9d86476072877e74bc2c Use this function for hashy case-insensitive lookup, as it's ASCII-only. Note that this function doesn't cast TOLOWER_ASC() argument to uint8_t, so it'll treat a UTF-8 byte as smaller than NUL. It doesn't matter, as one of the strings being compared is ASCII-only, and its behavior still leads to consistent ordering.
* refactor(generator): remove nested loop for event aliases (#32780)zeertzjq2025-03-09
| | | | After #32777 the aliases no longer need to come later, so the list of autocommand names can be fully sorted.
* fix(types): do not mark unstable API as privateLewis Russell2025-03-08
| | | | | These functions are allowed to be used downstream, they are just not API stable.
* perf(keycodes): use hashy for string lookupzeertzjq2025-03-08
| | | | | This is slightly faster than the binary search as per the benchmark, and allows handling the vim/vim#16821 situation in generator code.
* vim-patch:partial:9.1.1179: too many strlen() calls in misc2.czeertzjq2025-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: too many strlen() calls in misc2.c Solution: refactor misc2.c and use bsearch() instead of a linear search to find matches in the key_names_table array (John Marriott). This commit changes misc2.c to use bsearch() to perform string searches of the key_names_table array. Implementation detail: - Some entries in this array have alternate names. Add field alt_name to point to the alternate name. - Some entries in this array are only available if a given feature is defined. Keep them in the array, but add a boolean field enabled to indicate if the record can be used or not. If the feature is not available, the corresponding enabled field is set to FALSE. In my measurements running the test suite on a huge non-gui build on linux, the number of string comparisons in get_special_key_code(): Before (linear search): 2,214,957 After (binary search): 297,770 A side effect of this is 1477 calls to STRLEN() in get_special_key_name() for the same test run are no longer necessary. closes: vim/vim#16788 https://github.com/vim/vim/commit/4a1e6dacbb2cc833353983bea7eac38191c9d3b4 Skip the mouse shape changes. Co-authored-by: John Marriott <basilisk@internode.on.net>
* refactor(keycodes): generate key_names_table[] using Luazeertzjq2025-03-08
| | | | This allows easier refactoring.
* refactor: old references to scripts/ dir #32647Justin M. Keyes2025-02-26
|
* feat(lua): vim.text.indent()Justin M. Keyes2025-02-26
| | | | | | | | | | | | | Problem: Indenting text is a common task in plugins/scripts for presentation/formatting, yet vim has no way of doing it (especially "dedent", and especially non-buffer text). Solution: Introduce `vim.text.indent()`. It sets the *exact* indentation because that's a more difficult (and thus more useful) task than merely "increasing the current indent" (which is somewhat easy with a `gsub()` one-liner).
* build: move all generator scripts to `src/gen/`Lewis Russell2025-02-26
- Move all generator Lua scripts to the `src/gen/` - Add a `.luarc.json` to `src/gen/` - Add a `preload.lua` to `src/gen/` - Add `src` to `package.path` so it aligns with `.luarc.json' - Fix all `require` statements in `src/gen/` so they are consistent: - `require('scripts.foo')` -> `require('gen.foo')` - `require('src.nvim.options')` -> `require('nvim.options')` - `require('api.dispatch_deprecated')` -> `require('nvim.api.dispatch_deprecated')`