Commit Graph

26619 Commits

Author SHA1 Message Date
zeertzjq
e551d623d2
build(vim-patch.sh): rename locale.c to os/lang.c (#24687) 2023-08-13 11:27:31 +08:00
zeertzjq
3ce3218fb4
build(vim-patch.sh): group co-authors together (#24686) 2023-08-13 10:34:25 +08:00
zeertzjq
165c4c9e57
vim-patch:cd4e4e169ab3 (#24685)
.cirrus.yml: skip pkg update for FreeBSD 13.1 (vim/vim#12767)

cd4e4e169a

Co-authored-by: Philip H <47042125+pheiduck@users.noreply.github.com>
2023-08-13 07:34:23 +08:00
zeertzjq
d39361f5e0
vim-patch:9.0.1698: Test_map_restore_sid fails in GUI (#24682)
Problem: Test_map_restore_sid fails in GUI
Solution: Feed an unsimplified Ctrl-B

closes: vim/vim#12770

7fe1089904
2023-08-13 07:10:43 +08:00
zeertzjq
7542286d6a
vim-patch:9.0.1697: incsearch test not sufficient (#24683)
Problem: incsearch test not sufficient (after 9.0.1691)
Solution: add an additional test

73b8209266

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-08-13 07:10:24 +08:00
Lewis Russell
2ca076e45f feat(treesitter)!: incremental injection parsing
Problem:

Treesitter highlighting is slow for large files with lots of injections.

Solution:

Only parse injections we are going to render during a redraw cycle.

---

- `LanguageTree:parse()` will no longer parse injections by default and
  now requires an explicit range argument to be passed.

- `TSHighlighter` now parses injections incrementally during on_win
  callbacks for the line range being rendered.

- Plugins which require certain injections to be parsed must run
  `parser:parse({ start_row, end_row })` before using the tree.
2023-08-12 16:11:36 +01:00
Jaehwang Jung
5a25dcc5a4
fix(diff): filler lines for hunks bigger than linematch limit (#24676)
Apply linematch filler computation only if the hunk is actually
linematched.

Fixes #24580
2023-08-12 17:14:37 +08:00
Christian Clason
04aed08157 vim-patch:d8f981138aa0
Add commentstring for nix file format (vim/vim#12696)

d8f981138a

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2023-08-12 11:01:05 +02:00
zeertzjq
58a1ef8e6a
fix(events): avoid unnecessary CursorMoved (#24675)
Problem:    Temporarily changing current window in a script causes
            CursorMoved to be triggerd.
Solution:   Don't trigger CursorMoved if neither curwin nor cursor
            changed between two checks.
2023-08-12 09:50:17 +08:00
zeertzjq
6c07a189f2
vim-patch:9.0.1688: cannot store custom data in quickfix list (#24673)
Problem: cannot store custom data in quickfix list
Solution: add `user_data` field for the quickfix list

closes: vim/vim#11818

ca6ac99077

Co-authored-by: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
2023-08-12 08:19:06 +08:00
zeertzjq
72cf94fc0e
vim-patch:9.0.1694: wrong mapping applied when replaying a char search (#24670)
Problem: wrong mapping applied when replaying a char search
Solution: Store a NOP after the ESC

closes: vim/vim#12708
closes: vim/vim#6350

bacc83009b
2023-08-12 06:50:52 +08:00
zeertzjq
8c5d81997e
vim-patch:9.0.1693: Ctrl-Q not handled like Ctrl-V in replace mode (#24669)
Problem: Ctrl-Q not handled like Ctrl-V in replace mode
Solution: Handle Ctrl-Q like Ctrl-V

closes: vim/vim#12686
closes: vim/vim#12684

2d63e4b3cc

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-12 06:41:23 +08:00
zeertzjq
8f9c5ee5ef
vim-patch:9.0.1691: wrong viewport restored for incsearch and smoothscroll (#24667)
Problem: wrong viewport restored for incsearch and smoothscroll
Solution: Save and restore skipcol as well

closes: vim/vim#12713

7b7b4cb6f2
2023-08-12 06:32:13 +08:00
zeertzjq
713311be62
vim-patch:9.0.1687: mapset() not properly handling script ID (#24666)
Problem: mapset() not properly handling script ID
Solution: replace_termcodes() may accept a script ID

closes: vim/vim#12699
closes: vim/vim#12697

7e0bae024d
2023-08-12 06:08:07 +08:00
zeertzjq
6e0c36ba0e
vim-patch:9.0.1686: undotree() only works for the current buffer (#24665)
Problem:    undotree() only works for the current buffer
Solution:   Add an optional "buffer number" parameter to undotree().  If
            omitted, use the current buffer for backwards compatibility.

closes: vim/vim#4001
closes: vim/vim#12292

5fee111149

Co-authored-by: Devin J. Pohly <djpohly@gmail.com>
2023-08-12 05:51:49 +08:00
Christian Clason
278805dfac vim-patch:21aaff3faa82
Update my name and email in runtime files (vim/vim#12763)

21aaff3faa

Co-authored-by: Lily Ballard <lily@ballards.net>
2023-08-11 22:06:37 +02:00
Christian Clason
35c8ad1c80 vim-patch:dd0ad2598898
Update syntax/dosini.vim to the latest version (vim/vim#12764)

The latest version is in https://github.com/xuhdev/syntax-dosini.vim/blob/master/syntax/dosini.vim. I've sent the file to Bram at the end of June, unfortunately it wasn't able to make into the Vim repository. RIP!

dd0ad25988

Co-authored-by: Hong Xu <hong@topbug.net>
2023-08-11 22:06:37 +02:00
Christian Clason
31c4ed26bc
feat(treesitter): add injection language fallback (#24659)
* feat(treesitter): add injection language fallback

Problem: injection languages are often specified via aliases (e.g.,
filetype or in upper case), requiring custom directives.

Solution: include lookup logic (try as parser name, then filetype, then
lowercase) in LanguageTree itself and remove `#inject-language`
directive.

Co-authored-by: Lewis Russell <me@lewisr.dev>
2023-08-11 17:05:17 +02:00
Raphael
72e64a1afe
fix(lsp): extra "." when completing with tsserver #24646
Problem:
With tsserver LSP, omni completion after "." inserts an extra "."

Solution:
Apply adjust_start_col() regardless of `filterText`.
adjust_start_col() is explained here:
0ea8dfeb3d/runtime/lua/vim/lsp.lua (L2334-L2351)

The `filterText` field is used in the following situations rather than as
a condition for obtaining column values:
1. Real-time filtering: When the user types characters in the editor, the
   language server can use the filterText field to filter the list of
   suggestions and only return suggestions that match the typed characters. This
   helps to provide more precise recommendations.
2. Fuzzy matching: The filterText field can be used to perform fuzzy matching,
   allowing matching in the middle or beginning of input characters, not limited
   to prefix matching. This can provide a more flexible code completion
   experience.

Inspecting usage of `filtertext` in vim-lsp and coc and lsp-mode:
- vim-lsp uses a `refresh_pattern` to judge filterText as completionitem word
  (although I think this is not the correct usage).
- coc uses it for filtering.

Fix #22803
2023-08-11 05:20:05 -07:00
zeertzjq
3d948a4dc4
vim-patch:9.0.1683: Updated runtime files (#24638)
This is a collection of various PRs from github that all require a minor
patch number:

1) https://github.com/vim/vim/pull/12612

    Do not conflate dictionary key with end of block

2) https://github.com/vim/vim/pull/12729:

    When saving and restoring 'undolevels', the constructs `&undolevels` and
    `:set undolevels` are problematic.

    The construct `&undolevels` reads an unpredictable value; it will be the
    local option value (if one has been set), or the global option value
    (otherwise), making it unsuitable for saving a value for later
    restoration.

    Similarly, if a local option value has been set for 'undolevels',
    temporarily modifying the option via `:set undolevels` changes the local
    value as well as the global value, requiring extra work to restore both
    values.

    Saving and restoring the option value in one step via the construct
    `:let &undolevels = &undolevels` appears to make no changes to the
    'undolevels' option, but if a local option has been set to a different
    value than the global option, it has the unintended effect of changing
    the global 'undolevels' value to the local value.

    Update the documentation to explain these issues and recommend explicit
    use of global and local option values when saving and restoring.  Update
    some unit tests to use `g:undolevels`.

3) https://github.com/vim/vim/pull/12702:

    Problem:    Pip requirements files are not recognized.
    Solution:   Add a pattern to match pip requirements files.

4) https://github.com/vim/vim/pull/12688:

    Add indent file and tests for ABB Rapid

5) https://github.com/vim/vim/pull/12668:

    Use Lua 5.1 numeric escapes in tests and add to CI

    Only Lua 5.2+ and LuaJIT understand hexadecimal escapes in strings.  Lua
    5.1 only supports decimal escapes:

    > A character in a string can also be specified by its numerical value
    > using the escape sequence \ddd, where ddd is a sequence of up to three
    > decimal digits. (Note that if a numerical escape is to be followed by a
    > digit, it must be expressed using exactly three digits.) Strings in Lua
    > can contain any 8-bit value, including embedded zeros, which can be
    > specified as '\0'.

    To make sure this works with Lua 5.4 and Lua 5.1 change the Vim CI to
    run with Lua 5.1 as well as Lua 5.4

6) https://github.com/vim/vim/pull/12631:

    Add hurl filetype detection

7) https://github.com/vim/vim/pull/12573:

    Problem:   Files for haskell persistent library are not recognized
    Solution:  Add pattern persistentmodels for haskell persistent library

closes: vim/vim#12612
closes: vim/vim#12729
closes: vim/vim#12702
closes: vim/vim#12688
closes: vim/vim#12668
closes: vim/vim#12631
closes: vim/vim#12573

Already ported but wasn't marked: vim-patch:ad34abee2583

6efb198033

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: lacygoill <lacygoill@lacygoill.me>
Co-authored-by: Michael Henry <drmikehenry@drmikehenry.com>
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
Co-authored-by: KnoP-01 <knosowski@graeffrobotics.de>
Co-authored-by: James McCoy <jamessan@jamessan.com>
Co-authored-by: Jacob Pfeifer <jacob@pfeifer.dev>
Co-authored-by: Borys Lykah <lykahb@fastmail.com>
2023-08-10 17:45:36 +08:00
zeertzjq
3e3eddc8e7
Merge pull request #24639 from zeertzjq/vim-6a500661a9cb
vim-patch:6a500661a9cb,81b8bf5b4a33
2023-08-10 17:43:35 +08:00
zeertzjq
a51ab112a6 vim-patch:81b8bf5b4a33
Update the vimscript code for restoring cursor position

Using xxd(1) to filter and edit binary files causes the input files
to have dual nature, so to speak, which effectively makes restoring
the cursor position broken.  Fix that by ignoring the "xxd" file type
in the code that restores the cursor position.

Interactive rebasing in git causes files to be edited in vim, which,
similarly to commit messages, are rarely the same as the last one
edited.  Thus, also add "gitrebase" to the list of file types for
which the cursor position isn't restored.

While there, refactor the code a bit to possibly save a few CPU cycles
and to keep the line lengths in check, and use the long form of the
commands and variables, to make the code slightly more consistent and
more understandable to newcomers.

Update the relevant comments in the code and the associated parts of
the documentation, to keep them in sync with the updated code.

Remove some redundant trailing whitespace as well, as spotted.

81b8bf5b4a

Co-authored-by: Dragan Simic' via vim_dev <vim_dev@googlegroups.com>
2023-08-10 17:28:04 +08:00
zeertzjq
5684c415b4 vim-patch:6a500661a9cb
Improve the vimscript code in ":h hex-editing"

Save and restore the view position before and after saving the buffer,
respectively, to keep the current view of the xxd(1)'s hex dump
unchanged after doing ":w", which previously caused the window to
scroll back to the very beginning of the buffer.  I believe it's
needless to say how annoying and counterproductive that was.

Get rid of the "Press ENTER or type command to continue" message, which
was previously displayed after opening larger binary files.  The use
of "silent" and "redraw" commands is tailored specifically to avoid
screen flickering, e.g. when doing ":w", which is caused by the buffer
being filtered by an external command.

Increase the number of octets per line, produced by xxd(1), from the
default value of 16 to 32.  This puts bigger chunks of the hex dump
on the screen and makes the whole thing much more usable.

While there, reformat the code to make it more readable, and use the
long form of the commands and variables to make the code slightly more
consistent and more understandable to newcomers.

6a500661a9

Co-authored-by: Dragan Simic' via vim_dev <vim_dev@googlegroups.com>
2023-08-10 17:28:02 +08:00
zeertzjq
72e619ca92
vim-patch:8f566fdb1e34 (#24636)
update .wast files syntax highlighting (vim/vim#12741)

8f566fdb1e

Co-authored-by: Linda_pp <rhysd@users.noreply.github.com>
2023-08-10 07:13:23 +08:00
Justin M. Keyes
1d81d7a268
feat(defaults): treat "•" as a list item prefix #24623
Problem:
Nvim docs use "•" as a list item prefix but `gw{motion}` doesn't format
such lists by default.

Solution:
Change the 'comments' option to include "fb:•" by default.
2023-08-09 15:33:53 -07:00
Maria José Solano
e6947bb1e8 fix(types): make filetype.add parameters optional 2023-08-09 23:27:32 +01:00
Christian Clason
1cf942204f
vim-patch:bd76c89e31ac (#24630)
update matchit (vim/vim#12611)

bd76c89e31

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-09 23:44:16 +02:00
Christian Clason
f060f03304
vim-patch:2eb413f89b97 (#24627)
* vim-patch:2eb413f89b97

detect filetype for `*.vsh` and `*.vv` files (vim/vim#12692)

Co-authored-by: Turiiya <34311583+tobealive@users.noreply.github.com>

2eb413f89b

Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-08-09 23:35:10 +02:00
Gregory Anders
2ee8ace217
fix(iter): make pipeline termination conditions consistent (#24614)
If an iterator pipeline stage returns nil as its first return value, the
other return values are ignored and it is treated as if that stage
returned only nil (the semantics of returning nil are different between
different stages). This is consistent with how for loops work in Lua
more generally, where the for loop breaks when the first return value
from the function iterator is nil (see :h for-in for details).
2023-08-09 15:41:45 -05:00
Christian Clason
cc4540ebce
vim-patch:92f076e53e22 (#24634)
Update krl and add rapid syntax files (vim/vim#12750)

92f076e53e

Co-authored-by: Patrick Meiser-Knosowski <31903021+KnoP-01@users.noreply.github.com>
2023-08-09 22:37:49 +02:00
Christian Clason
3c929fd1c2
vim-patch:077ade4f6703 (#24629)
feat: recognize geojson extension as json filetype (vim/vim#12636)

077ade4f67

Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com>
2023-08-09 22:35:57 +02:00
Christian Clason
2e8f38690f
vim-patch:b69b9d5e1753 (#24628)
Add filetype detection for eyaml files (vim/vim#12659)

https://github.com/voxpupuli/hiera-eyaml/ uses and produces the eyaml
format, which is simply yaml with some encrypted values.

It's convenient to edit the file without decrypting when not touching
encrypted values (or when you don't have access to the decryption key),
which is why vim should treat those files as yaml files.

b69b9d5e17

Co-authored-by: Max Gautier <mg@max.gautier.name>
2023-08-09 22:35:43 +02:00
Christian Clason
1904e5060e
vim-patch:8967f6c4b9e2 (#24626)
feat(heex): borrow matchit support from html (vim/vim#12717)

* feat(heex): borrow matchit support from html

Makes % support behave the same in heex as in html. For example, quickly moving the cursor between opening and closing tags.

* Remove unnecessary line; define b:undo_ftplugin first

* Remove b:html_set_match_words

8967f6c4b9

Co-authored-by: Chris Vincent <chris.vincent@hey.com>
2023-08-09 22:34:54 +02:00
Christian Clason
90ed7ee112
vim-patch:44ff25d5243b (#24625)
* vim-patch:44ff25d5243b

PyPA manifest files are not recognized (vim/vim#12707)

Problem:    PyPA manifest files are not recognized.
Solution:   Add a pattern to match PyPA manifest files.

44ff25d524

Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
2023-08-09 22:34:39 +02:00
Christian Clason
aaeb1a8cd1
vim-patch:7159ac7fec28 (#24624)
Unison support (vim/vim#12715)

7159ac7fec

Co-authored-by: Anton Parkhomenko <chuwy@users.noreply.github.com>
2023-08-09 22:34:02 +02:00
Christian Clason
ceb501c1c6
vim-patch:a13eb2b14791 (#24622)
Add WebGPU Shading Language (WGSL) filetype (vim/vim#12723)

The current W3C Working Draft for the WebGPU Shading Language (WGSL) specifies
'text/wgsl' media type for WGSL modules with the '.wgsl' file extension:
https://www.w3.org/TR/WGSL/#text-wgsl-media-type

It has also been registered at the Internet Assigned Numbers Authority (IANA):
https://www.iana.org/assignments/media-types/text/wgsl

Neovim's nvim-lspconfig already associates wgsl language servers
with 'filetype wgsl':
https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#wgsl_analyzer

However currenly setting 'filetype wgsl' for *.wgsl files by defalut in Neovim
is blocked by adding this filetype to the vim project first:
https://github.com/neovim/neovim/pull/23331

This commit adds this missing wgsl filetype.

a13eb2b147

Co-authored-by: Gergő Sályi <87373293+gergo-salyi@users.noreply.github.com>
2023-08-09 22:33:41 +02:00
zeertzjq
bad71a4ca7
Merge pull request #24631 from clason/vim-c2bd205254c8
vim-patch:{c2bd205254c8,0401933a5be3}: typo fixes
2023-08-10 03:20:56 +08:00
bfredl
8f9b2652fb
Merge pull request #24633 from bfredl/luabool2
fix(api): revert unintended change of optional bool params
2023-08-09 21:15:03 +02:00
Christian Clason
f81645abd2 vim-patch:0401933a5be3
Fix alignment in filetype.txt (vim/vim#12618)

There are three spaces because the "<" is concealed.

0401933a5b

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-08-09 20:44:12 +02:00
Christian Clason
164370a4cb vim-patch:c2bd205254c8
Change "the" to "then" under ':help bufload()' (vim/vim#12662)

c2bd205254

N/A commits:
vim-patch:64dea84bb05a (we have our own manpager at home)
vim-patch:958e15bb1c7d (we have our own editorconfig syntax file)
vim-patch:c41b3c9f95ac (we don't have defaults.vim)

Co-authored-by: Daniel Steinberg <dstein64@users.noreply.github.com>
2023-08-09 20:43:45 +02:00
bfredl
dbcba26bf1 fix(api): revert unintended change of optional bool params
Currently (as of nvim 0.9), the behavior of boolean params in
vim.api lua wrappers is inconsistent for optional parameters
(part of an `opts` dict) compared to positional parameters.

This was inadvertently changed in #24524 . While cleaning up this
inconsistency is something we might want eventually, it needs
to be discussed separately and the impact of existing code considered.
2023-08-09 20:34:07 +02:00
Kyuuhachi
68f12e7fcb
fix(lua): annotate that TSNode functions can return nil (#24621) 2023-08-09 18:06:42 +01:00
Lewis Russell
977f9659a7
docs(MAINTAIN): update deprecation policy (#24619)
docs(MAINTAIN.md): update deprecation policy

Refine a deprecation policy and add another deprecation period in which
a feature is only deprecated via documentation and does not issue a
warning.
2023-08-09 16:49:52 +01:00
Christian Clason
c43c745a14
fix(lua): improve annotations for stricter luals diagnostics (#24609)
Problem: luals returns stricter diagnostics with bundled luarc.json
Solution: Improve some function and type annotations:

* use recognized uv.* types 
* disable diagnostic for global `vim` in shared.lua
* docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type)
* add type alias for lpeg pattern
* fix return annotation for `vim.secure.trust`
* rename local Range object in vim.version (shadows `Range` in vim.treesitter)
* fix some "missing fields" warnings
* add missing required fields for test functions in eval.lua
* rename lsp meta files for consistency
2023-08-09 11:06:13 +02:00
zeertzjq
8afdc1f386
ci(labeler): run "type-scope" after "triage"
Problem:    When "triage" job is run after "type-scope" job, it may
            remove labels added by the "type-scope" job.
Solution:   Run "type-scope" job after "triage" job.
2023-08-09 09:27:51 +08:00
zeertzjq
fdb11888f5
vim-patch:9.0.1679: Cleanup Tests from leftover files (#24617)
Problem:    Tests may leave leftover files around
Solution:   Clean up tests and remove files

There were a few failures in 'linux (huge, gcc, testgui, true, true)'
e.g. here: https://github.com/vim/vim/actions/runs/5497376153/jobs/10018060156

,----
| Error detected while processing command line..script /home/runner/work/vim/vim/src/testdir/runtest.vim[585]..function RunTheTest[54]..Test_lvimgrep_crash[16]..TestTimeout[12]..VimLeavePre Autocommands for "*"..function EarlyExit[7]..FinishTesting:
| line   70:
| E445: Other window contains changes
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txt
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txt
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txtmalloc(): unsorted double linked list corrupted
`----

Which is puzzling, because the Xtest_stable_xxd file should have been
long gone after test_crypt.vim is run (and definitely no longer be
staying around in test_quickfix.vim).

So try to clean up properly after a test script is run, just in case any
X<file> is still around. During testing, a found a few leftover files,
which I also fixed in the relevant test-file.

Unfortunately, the test workflow 'linux (huge, gcc, testgui, true,
true)' now seems to fail with 'E1230: Encryption: sodium_mlock()' in
test_crypt.vim. Hopefully this is only temporary.

84bc00e9b5

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-09 06:07:23 +08:00
Sean Dewar
4134cebb17
docs(builtin): fix some missing lines (#24615)
These two functions seem to have previously had their docs start on the same
line as the signature, which I guess contributed to the lines being lost (though
I checked all other such functions from before again and these were the only
two).
2023-08-08 21:25:22 +01:00
Lewis Russell
c6c21db82b
fix(filetype): add typing and dry (#24573) 2023-08-08 16:36:06 +01:00
Computer2340
61ed45486d
docs: Bram farewell #24589
ref #24579
2023-08-08 06:41:55 -07:00
Christian Clason
2e824e89c1
build(deps): bump tree-sitter to HEAD - 0a1c4d846 (#24607)
adapt to breaking change in `ts_query_cursor_set_max_start_depth`
https://github.com/tree-sitter/tree-sitter/pull/2278
2023-08-08 14:57:06 +02:00