aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
Commit message (Collapse)AuthorAge
...
* | | fix(lsp): handle absence of a trailing newline #25194Sergey Slipchenko2023-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #24339 rust-analyzer sends "Invalid offset" error in such cases. Some other servers handle it specially. LSP spec mentions that "A range is comparable to a selection in an editor". Most editors don't handle trailing newlines the same way Neovim/Vim does, it's clearly visible if it's present or not. With that in mind it's understandable why sending end position as simply the start of the line after the last one is considered invalid in such cases.
* | | fix(lsp): clear codelens on LspDetach (#24903)Jaehwang Jung2023-09-21
|/ / | | | | Also fix incorrect parameters in on_detach callback.
* | vim-patch:9.0.1921: not possible to use the jumplist like a stack (#25278)zeertzjq2023-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: not possible to use the jumplist like a stack Solution: Add the 'jumpoptions' setting to make the jumplist a stack. Add an option for using jumplist like tag stack related: vim/vim#7738 closes: vim/vim#13134 ported from NeoVim: - https://neovim.io/doc/user/motion.html#jumplist-stack - neovim/neovim@39094b3 - https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior Based on the feedback in the previous PR, it looks like many people like this option. https://github.com/vim/vim/commit/87018255e3ad0f4dfa03e20318836d24af721caf Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com> Co-authored-by: butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com>
* | vim-patch:9.0.1918Christian Clason2023-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | patch 9.0.1918: No filetype detection for Authzed filetypes Problem: No filetype detection for Authzed filetypes Solution: Detect the *.zed file extension as authzed filetype closes: vim/vim#13129 https://github.com/vim/vim/commit/5790a54166793554d16f6a85d8824632860b8b37 Co-authored-by: Matt Polzin <mpolzin@workwithopal.com>
* | feat(lua): add vim.func._memoizeLewis Russell2023-09-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Memoizes a function, using a custom function to hash the arguments. Private for now until: - There are other places in the codebase that could benefit from this (e.g. LSP), but might require other changes to accommodate. - Invalidation of the cache needs to be controllable. Using weak tables is an acceptable invalidation policy, but it shouldn't be the only one. - I don't think the story around `hash_fn` is completely thought out. We may be able to have a good default hash_fn by hashing each argument, so basically a better 'concat'.
* | docs: misc #24561Justin M. Keyes2023-09-20
| | | | | | | | fix #24699 fix #25253
* | fix(lsp)!: deprecate trim_empty_linesMaria José Solano2023-09-19
| |
* | feat(lsp): use treesitter for stylize markdownMaria José Solano2023-09-19
| |
* | Merge pull request #25214 from bfredl/glyphcachebfredl2023-09-19
|\ \ | | | | | | refactor(grid): change schar_T representation to be more compact
| * | refactor(grid): change schar_T representation to be more compactbfredl2023-09-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a screen cell would occupy 28+4=32 bytes per cell as we always made space for up to MAX_MCO+1 codepoints in a cell. As an example, even a pretty modest 50*80 screen would consume 50*80*2*32 = 256000, i e a quarter megabyte With the factor of two due to the TUI side buffer, and even more when using msg_grid and/or ext_multigrid. This instead stores a 4-byte union of either: - a valid UTF-8 sequence up to 4 bytes - an escape char which is invalid UTF-8 (0xFF) plus a 24-bit index to a glyph cache This avoids allocating space for huge composed glyphs _upfront_, while still keeping rendering such glyphs reasonably fast (1 hash table lookup + one plain index lookup). If the same large glyphs are using repeatedly on the screen, this is still a net reduction of memory/cache consumption. The only case which really gets worse is if you blast the screen full with crazy emojis and zalgo text and even this case only leads to 4 extra bytes per char. When only <= 4-byte glyphs are used, plus the 4-byte attribute code, i e 8 bytes in total there is a factor of four reduction of memory use. Memory which will be quite hot in cache as the screen buffer is scanned over in win_line() buffer text drawing A slight complication is that the representation depends on host byte order. I've tested this manually by compling and running this in qemu-s390x and it works fine. We might add a qemu based solution to CI at some point.
* | | Merge pull request #25148 from glepnir/fixed_optbfredl2023-09-19
|\ \ \ | |/ / |/| | fix(float): add fixed option
| * | fix(float): add fixd optionglepnir2023-09-18
| | |
* | | vim-patch:9.0.1907: No support for liquidsoap filetypesChristian Clason2023-09-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: No support for liquidsoap filetypes Solution: Add liquidsoap filetype detection code closes: vim/vim#13111 https://github.com/vim/vim/commit/6b5efcdd8e976d2ab2554b22c4220c5e88de4717 Co-authored-by: Romain Beauxis <toots@rastageeks.org>
* | | fix(treesitter): _trees may not be list-likeJaehwang Jung2023-09-17
| |/ |/| | | | | | | | | | | | | | | | | | | Problem: With incremental injection parsing, injected languages' parsers parse only the relevant regions and stores the result in _trees with the index of the corresponding region. Therefore, there can be holes in _trees. Solution: * Use generic table functions where appropriate. * Fix type annotations and docs.
* | fix(lua): not using global value in vim.opt_global (#25196)Phelipe Teles2023-09-17
| |
* | feat(treesitter): add lang parameter to the query editor (#25181)Maria José Solano2023-09-16
| |
* | fix(treesitter): properly combine injection.combined regionsJaehwang Jung2023-09-16
| | | | | | | | | | | | | | | | | | Problem: It doesn't make much sense to flatten each region (= list of ranges). This coincidentally worked for region with a single range. Solution: Custom function for combining regions.
* | fix(treesitter): fix trim predicateLewis Russell2023-09-16
| |
* | fix(typing): vim.fn.executeLewis Russell2023-09-16
| |
* | perf(treesitter): do not scan past given line for predicate matchL Lllvvuu2023-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem --- If a highlighter query returns a significant number of predicate non-matches, the highlighter will scan well past the end of the window. Solution --- In the iterator returned from `iter_captures`, accept an optional parameter `end_line`. If no parameter provided, the behavior is unchanged, hence this is a non-invasive tweak. Fixes: #25113 nvim-treesitter/nvim-treesitter#5057
* | fix(languagetree): apply `resolve_lang` to `metadata['injection.language']`L Lllvvuu2023-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | `resolve_lang` is applied to `@injection.language` when it's supplied as a capture: https://github.com/neovim/neovim/blob/f5953edbac14febce9d4f8a3c35bdec1eae26fbe/runtime/lua/vim/treesitter/languagetree.lua#L766-L768 If we want to support `metadata['injection.language']` (as per #22518 and [tree-sitter upstream](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection)) then the behavior should be consistent. Fixes: nvim-treesitter/nvim-treesitter#4918
* | refactor(treesitter): remove duplicated diagnostic code (#24976)Maria José Solano2023-09-15
| | | | | | | | | | | | | | * refactor(treesitter): remove duplicated diagnostic code * fixup!: fix type errors * fixup!: add type namespace
* | refactor(treesitter): rename "preview" => "edit" #25161Maria José Solano2023-09-15
| | | | | | | | | | | | "Edit" more closely describes the generic application than "Preview", though the buffer contents don't (yet) map to an actual file on disk. https://github.com/neovim/neovim/pull/24703#discussion_r1321719133
* | docs: replace <pre> with ``` (#25136)Gregory Anders2023-09-14
| |
* | refactor(treesitter): deprecate for_each_child #25118LW2023-09-14
| | | | | | | | | | | | | | The name for_each_child is misleading and caused bugs. After #25111, #25115, there are no more usages of `for_each_child` in Nvim. In the future if we want to restore this functionality we can consider a generalized vim.traverse(node, key, visitor) function.
* | fix(treesitter): `language.add` - only register parser if it existsL Lllvvuu2023-09-14
| | | | | | | | Fixes: #24531
* | feat(lsp): remove notify from vim.lsp.buf_detach_client (#25140)Mathias Fußenegger2023-09-14
|/ | | Closes https://github.com/neovim/neovim/issues/19838
* docs: fix typos and other small fixes (#25005)dundargoc2023-09-14
| | | | | | | Co-authored-by: nuid64 <lvkuzvesov@proton.me> Co-authored-by: Mike Smith <10135646+mikesmithgh@users.noreply.github.com> Co-authored-by: XTY <xty@xty.io> Co-authored-by: Empa <emanuel@empa.xyz> Co-authored-by: kyu08 <49891479+kyu08@users.noreply.github.com>
* feat(vimdoc): support Markdown code blocks (#25127)Gregory Anders2023-09-13
| | | | | | Support Markdown code blocks in addition to <pre> blocks in Doxygen doc comments. Update doc comments in iter.lua as a test.
* fix(treesitter): don't update fold if tree is unchangedJaehwang Jung2023-09-13
| | | | | | | | | | | Problem: Folds are opened when the visible range changes even if there are no modifications to the buffer, e.g, when using zM for the first time. If the parsed tree was invalid, on_win re-parses and gets empty tree changes, which triggers fold updates. Solution: Don't update folds in on_changedtree if there are no changes.
* fix(treesitter): fixup for InspectTreeLewis Russell2023-09-12
| | | | Fixes #25120
* fix(treesitter): remove more double recursionLewis Russell2023-09-12
| | | | Do not call `for_each_child` in functions that are already recursive.
* feat(extmark): support proper multiline rangesbfredl2023-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The removes the previous restriction that nvim_buf_set_extmark() could not be used to highlight arbitrary multi-line regions The problem can be summarized as follows: let's assume an extmark with a hl_group is placed covering the region (5,0) to (50,0) Now, consider what happens if nvim needs to redraw a window covering the lines 20-30. It needs to be able to ask the marktree what extmarks cover this region, even if they don't begin or end here. Therefore the marktree needs to be augmented with the information covers a point, not just what marks begin or end there. To do this, we augment each node with a field "intersect" which is a set the ids of the marks which overlap this node, but only if it is not part of the set of any parent. This ensures the number of nodes that need to be explicitly marked grows only logarithmically with the total number of explicitly nodes (and thus the number of of overlapping marks). Thus we can quickly iterate all marks which overlaps any query position by looking up what leaf node contains that position. Then we only need to consider all "start" marks within that leaf node, and the "intersect" set of that node and all its parents. Now, and the major source of complexity is that the tree restructuring operations (to ensure that each node has T-1 <= size <= 2*T-1) also need to update these sets. If a full inner node is split in two, one of the new parents might start to completely overlap some ranges and its ids will need to be moved from its children's sets to its own set. Similarly, if two undersized nodes gets joined into one, it might no longer completely overlap some ranges, and now the children which do needs to have the have the ids in its set instead. And then there are the pivots! Yes the pivot operations when a child gets moved from one parent to another.
* fix(languagetree): remove double recursion in LanguageTree:parseL Lllvvuu2023-09-12
| | | | | | | | | | | | | | | | `LanguageTree:parse` is recursive, and calls `LanguageTree:for_each_child`, which is also recursive. That means that, starting from the third level (child of child of root), nodes will be parsed twice. Which then means that if the tree is N layers deep, there will be ~2^N parses even if the branching factor is 1. Now, why was the tree deepening with each character inserted? And why did this only regress in #24647? These are mysteries for another time. Fixes: #25104
* fix(decorations): better approximation of botline #24794Jaehwang Jung2023-09-11
| | | | | | | | | | | | | | | | Problem: * The guessed botline might be smaller than the actual botline e.g. when there are folds and the user is typing in insert mode. This may result in incorrect treesitter highlights for injections. * botline can be larger than the last line number of the buffer, which results in errors when placing extmarks. Solution: * Take a more conservative approximation. I am not sure if it is sufficient to guarantee correctness, but it seems to be good enough for the case mentioned above. * Clamp it to the last line number. Co-authored-by: Lewis Russell <me@lewisr.dev>
* Merge pull request #24901 from faergeek/more-intuitive-cursor-updatebfredl2023-09-11
|\ | | | | fix(api): more intuitive cursor updates in nvim_buf_set_text
| * fix(api): more intuitive cursor updates in nvim_buf_set_textSergey Slipchenko2023-09-11
| | | | | | | | Fixes #22526
* | vim-patch:9.0.1891: No runtime support for MojoChristian Clason2023-09-11
|/ | | | | | | | | | | | Problem: No runtime support for Mojo Solution: Add basic filetype and syntax plugins closes: vim/vim#13062 closes: vim/vim#13063 https://github.com/vim/vim/commit/0ce2c594d0704f27a16d2c13fce85d596cc91489 Co-authored-by: Mahmoud Abduljawad <mahmoud@masaar.com>
* feat(lsp): improve control over placement of floating windows (#24494)Grace Petryk2023-09-10
|
* fix(highlight): add create param in nvim_get_hlglepnir2023-09-09
|
* feat(runtime): highlight hl groups in syntax.txt (#25050)zeertzjq2023-09-08
| | | | | | - Add runtime/lua/vim/vimhelp.lua, which is a translation of Vim's runtime/import/dist/vimhelp.vim. - Unlike Vim, run the highlighting from an ftplugin file instead of a syntax file, so that it is run even if using treesitter.
* feat(lsp): add original LSP Location as item's user_data in ↵Tom Praschan2023-09-07
| | | | locations_to_items (#23743)
* fix(diagnostic): always return copies of diagnostic items (#25010)Evgeni Chasnovski2023-09-06
|
* fix: windows timeouts have exit code 1Lewis Russell2023-09-05
|
* refactor(vim.system): factor out on_exit handlingLewis Russell2023-09-05
|
* fix(vim.system): make timeout work properlyLewis Russell2023-09-05
| | | | Mimic the behaviour of timeout(1) from coreutils.
* fix(vim.system): let on_exit handle cleanup after killLewis Russell2023-09-05
| | | | Fixes #25000
* build: bump lpeg to 1.1.0 (#25016)dundargoc2023-09-04
| | | | Release notes indicates it has better UTF8 handling which is relevant for us.
* vim-patch:9.0.1856: issues with formatting positional arguments (#25013)zeertzjq2023-09-04
| | | | | | | | | | | | | Problem: issues with formatting positional arguments Solution: fix them, add tests and documentation closes: vim/vim#12140 closes: vim/vim#12985 Tentatively fix message_test. Check NULL ptr. https://github.com/vim/vim/commit/aa90d4f031f73a34aaef5746931ea746849a2231 Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
* fix(lsp): wrong iterator in registerCapability handler (#24971)TheBlob422023-09-01
|