Commit Graph

4240 Commits

Author SHA1 Message Date
Lewis Russell
9b5ab66678 test(lsp): refactor and tidy
- Merge all the top level 'LSP' describe blocks
- Refactor text edit tests
- Fix typing errors
- Add linebreaks between tests
2024-08-11 15:14:14 +01:00
Christian Clason
8df6736ca1 feat(term): enable reflow by default (#21124)
Problem: Contents of terminal buffer are not reflown when Nvim is
resized.

Solution: Enable reflow in libvterm by default. Now that libvterm is
vendored, also fix "TUI rapid resize" test failures there.

Note: Neovim's scrollback buffer does not support reflow (yet), so lines
vanishing into the buffer due to a too small window will be restored
without reflow.
2024-08-10 10:26:07 +02:00
Christian Clason
fa79a8ad6d build(deps): vendor libvterm at v0.3.3
Problem: Adding support for modern Nvim features (reflow, OSC 8, full
utf8/emoji support) requires coupling libvterm to Nvim internals
(e.g., utf8proc).

Solution: Vendor libvterm at v0.3.3.
2024-08-10 10:26:07 +02:00
zeertzjq
e01ccda1be vim-patch:0cc5dce: runtime(doc): clarify directory of Vim's executable vs CWD
According to :h win32-PATH, "the same directory as Vim" means the same
directory as the Vim executable, not Vim's current directory.  In patch
8.2.4860 these two concepts were mixed up.

closes: vim/vim#15451

0cc5dce578
2024-08-09 07:21:59 +08:00
Yi Ming
0a1212ef94 docs(treesitter): generate inline docs for Ranges
docs(treesitter): in-place parameter description

docs(treesitter): remove internal type names

docs(treesitter): add missing private annotation
2024-08-06 18:18:34 +02:00
zeertzjq
37952bf7b4
vim-patch:8.2.4838: checking for absolute path is not trivial (#29990)
Problem:    Checking for absolute path is not trivial.
Solution:   Add isabsolutepath(). (closes vim/vim#10303)

dca1d40cd0

vim-patch:8a3b805c6c9c

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2024-08-06 21:19:12 +08:00
zeertzjq
28fbba2092
vim-patch:9.1.0465: missing filecopy() function (#29989)
Problem:  missing filecopy() function
Solution: implement filecopy() Vim script function
          (Shougo Matsushita)

closes: vim/vim#12346

60c8743ab6

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2024-08-06 12:49:59 +00:00
zeertzjq
9a30abb292 vim-patch:217d3c1: runtime(doc): capitalize correctly
* do not capitalize after a double colon when introducing a list
* Capitalize a header line

closes: vim/vim#15433

217d3c17c6

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-08-06 06:47:30 +08:00
zeertzjq
58406ab9f0
vim-patch:947f752: runtime(doc): fix typo in syntax.txt (#29974)
closes: vim/vim#15425

947f752a47

Co-authored-by: Jon Parise <jon@indelible.org>
2024-08-04 06:09:54 +08:00
Christian Clason
3b58d93aae docs(filetype): consolidate comments in dev_vimpatch.txt 2024-08-03 14:14:42 +02:00
Evgeni Chasnovski
37910f2703 docs(filetype): add note about prefering explicit lists over pattern 2024-08-03 14:14:42 +02:00
zeertzjq
99bb0a10d3 refactor(eval): treat v:lua call as simple function 2024-08-02 12:56:57 +08:00
zeertzjq
582bf4f1e1 vim-patch:9.0.0634: evaluating "expr" options has more overhead than needed
Problem:    Evaluating "expr" options has more overhead than needed.
Solution:   Use call_simple_func() for 'foldtext', 'includeexpr', 'printexpr',
            "expr" of 'spellsuggest', 'diffexpr', 'patchexpr', 'balloonexpr',
            'formatexpr', 'indentexpr' and 'charconvert'.

a4e0b9785e

vim-patch:9.0.0635: build error and compiler warnings

Problem:    Build error and compiler warnings.
Solution:   Add missing change.  Add type casts.

3292a22940

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-08-02 11:56:51 +08:00
zeertzjq
f7fde0173a vim-patch:9.0.0632: calling a function from an "expr" option has overhead
Problem:    Calling a function from an "expr" option has too much overhead.
Solution:   Add call_simple_func() and use it for 'foldexpr'

87b4e5c5db

Cherry-pick a call_func() change from patch 8.2.1343.
Add expr-option-function docs to options.txt.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-08-02 11:56:51 +08:00
zeertzjq
48e4589ead
vim-patch:8.2.4416: Vim9: using a script-local function requires using "s:" (#29950)
Problem:    Vim9: using a script-local function requires using "s:" when
            setting 'completefunc'.
Solution:   Do not require "s:" in Vim9 script. (closes vim/vim#9796)

1fca5f3e86

vim-patch:8.2.4417: using NULL pointer

Problem:    Using NULL pointer.
Solution:   Set offset after checking for NULL pointer.

e89bfd212b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-08-02 02:58:10 +00:00
Christian Clason
d3019419e7 vim-patch:30a8ad6: runtime(java): Document "g:java_space_errors" and "g:java_comment_strings"
closes: vim/vim#15399

30a8ad675d

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-08-01 10:14:10 +02:00
Christian Clason
a70371ff00 vim-patch:3749dff: runtime(java): Tidy up the documentation for "ft-java-syntax"
- Reword a few sentences and reformat a few paragraphs.
- Supply absent capitalisation and punctuation.
- Make listed highlighting groups and code stand out.
- Prefix all Java-related global variables with "g:".
- Add spaces around each variable assignment operator.
- Acknowledge that some Javadoc variables are maintained in
  the HTML syntax file.

Also, move the overridable _default_ HTML group links before
the HTML syntax file inclusion in order to implement the
documented diverged settings.

related: vim/vim#15399

3749dff093

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-08-01 10:14:10 +02:00
zeertzjq
b7dec93e68
vim-patch:5b07213: runtime(doc): re-format tag example lines, mention ctags --list-kinds (#29938)
5b07213c0b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-08-01 08:00:41 +00:00
zeertzjq
2b4049719a
vim-patch:partial:f10911e: Update runtime files (#29936)
f10911e5db

Also cherry-pick E1142 and E1156 tags from Vim.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-08-01 03:50:38 +00:00
Lewis Russell
573a71469d fix(scrollbind): properly take filler/virtual lines into account
Problem:

`'scrollbind'` does not work properly if the window being scrolled
automatically contains any filler/virtual lines (except for diff filler
lines).

This is because when the scrollbind check is done, the logic only
considers changes to topline which are represented as line numbers.

Solution:

Write the logic for determine the scroll amount to take into account
filler/virtual lines.

Fixes #29751
2024-07-31 11:33:32 +01:00
zeertzjq
e57598fbef vim-patch:9.1.0645: regex: wrong match when searching multi-byte char case-insensitive
Problem:  regex: wrong match when searching multi-byte char
          case-insensitive (diffsetter)
Solution: Apply proper case-folding for characters and search-string

This patch does the following 4 things:

1) When the regexp engine compares two utf-8 codepoints case
   insensitive it may match an adjacent character, because it assumes
   it can step over as many bytes as the pattern contains.

   This however is not necessarily true because of case-folding, a
   multi-byte UTF-8 character can be considered equal to some
   single-byte value.

   Let's consider the pattern 'ſ' and the string 's'. When comparing and
   ignoring case, the single character 's' matches, and since it matches
   Vim will try to step over the match (by the amount of bytes of the
   pattern), assuming that since it matches, the length of both strings is
   the same.

   However in that case, it should only step over the single byte value
   's' by 1 byte and try to start matching after it again. So for the
   backtracking engine we need to ensure:
   * we try to match the correct length for the pattern and the text
   * in case of a match, we step over it correctly

   There is one tricky thing for the backtracing engine. We also need to
   calculate correctly the number of bytes to compare the 2 different
   utf-8 strings s1 and s2. So we will count the number of characters in
   s1 that the byte len specified. Then we count the number of bytes to
   step over the same number of characters in string s2 and then we can
   correctly compare the 2 utf-8 strings.

2) A similar thing can happen for the NFA engine, when skipping to the
   next character to test for a match. We are skipping over the regstart
   pointer, however we do not consider the case that because of
   case-folding we may need to adjust the number of bytes to skip over.
   So this needs to be adjusted in find_match_text() as well.

3) A related issue turned out, when prog->match_text is actually empty.
   In that case we should try to find the next match and skip this
   condition.

4) When comparing characters using collections, we must also apply case
   folding to each character in the collection and not just to the
   current character from the search string.  This doesn't apply to the
   NFA engine, because internally it converts collections to branches
   [abc] -> a\|b\|c

fixes: vim/vim#14294
closes: vim/vim#14756

22e8e12d9f

N/A patches:
vim-patch:9.0.1771: regex: combining chars in collections not handled
vim-patch:9.0.1777: patch 9.0.1771 causes problems

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-07-31 08:03:31 +08:00
Christian Clason
1dd2bf926d vim-patch:df9f67e: runtime(html): update syntax script to sync by 250 minlines by default
closes: vim/vim#14071

df9f67e10d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-07-31 00:18:32 +02:00
zeertzjq
0af056ebce vim-patch:49cdd62: runtime(doc): list of new/changed features in version9.txt
closes: vim/vim#13753

49cdd629a3

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-07-30 12:18:44 +08:00
Riley Bruins
1af55bfcf2 feat(treesitter): allow get_node to return anonymous nodes
Adds a new field `include_anonymous` to the `get_node` options to allow
anonymous nodes to be returned.
2024-07-29 17:15:46 +02:00
Riley Bruins
bd3b6ec836 feat(treesitter): add node_for_range function
This is identical to `named_node_for_range` except that it includes
anonymous nodes. This maintains consistency in the API because we
already have `descendant_for_range` and `named_descendant_for_range`.
2024-07-29 17:15:46 +02:00
zeertzjq
fe5030c05e
vim-patch:partial:52e7cc2: runtime(doc): tweak documentation style a bit (#29897)
closes: vim/vim#15371

52e7cc26d8

Co-authored-by: h-east <h.east.727@gmail.com>
2024-07-29 00:02:31 +00:00
Christian Clason
5aa1a9532c docs(treesitter): don't quote metadata 2024-07-28 16:13:11 +02:00
zeertzjq
aee4254b76
Merge pull request #29876 from glepnir/vim-patch
vim-patch:9.1.{0618,0619,0629}: cannot mark deprecated attributes in completion menu
2024-07-27 22:12:30 +08:00
zeertzjq
b8b0e9db3f vim-patch:9.1.0629: Rename of pum hl_group is incomplete
Problem:  Rename of pum hl_group is incomplete in source.
Solution: Also rename the test function.  Rename to user_hlattr in code
          to avoid confusion with pum_extra.  Add test with matched text
          highlighting (zeertzjq).

closes: vim/vim#15348

4100852e09
2024-07-27 21:56:44 +08:00
glepnir
f132f8e9d4 vim-patch:9.1.0618: cannot mark deprecated attributes in completion menu
Problem:  cannot mark deprecated attributes in completion menu
Solution: add hl_group to the Dictionary of supported completion fields
          (glepnir)

closes: vim/vim#15314

508e7856ec

Co-authored-by: glepnir <glephunter@gmail.com>
2024-07-27 18:05:37 +08:00
zeertzjq
60967cd9aa
vim-patch:9.1.0616: filetype: Make syntax highlighting off for MS Makefiles (#29874)
Problem:  filetype: Make syntax highlighting off for MS Makefiles
Solution: Try to detect MS Makefiles and adjust syntax rules to it.
          (Ken Takata)

Highlighting of variable expansion in Microsoft Makefile can be broken.
E.g.:
2979cfc262/src/Make_mvc.mak (L1331)

Don't use backslash as escape characters if `make_microsoft` is set.
Also fix that `make_no_comments` was not considered if `make_microsoft`
was set.

Also add description for `make_microsoft` and `make_no_comments` to the
documentation and include a very simple filetype test

closes: vim/vim#15341

eb4b903c9b

Co-authored-by: Ken Takata <kentkt@csc.jp>
2024-07-27 16:48:29 +08:00
Christian Clason
108d2bf74b vim-patch:e73e5b8: runtime(java): Optionally highlight the :: token for method references
This token will be highlighted, similar to the arrow of
lambda expressions, whenever "g:java_highlight_functions" is
defined.

Also:

- Improve the recognition of _switch-case_ labels
  (D-Cysteine).
- Remove insignificant empty statements in syntax test
  files.

closes: vim/vim#15322

References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-15.html#jls-15.13
https://github.com/fleiner/vim/pull/1

e73e5b889b

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: D-Cysteine <54219287+D-Cysteine@users.noreply.github.com>
2024-07-25 10:01:35 +02:00
zeertzjq
0cdeb06db0
vim-patch:ddbb6fe: runtime(vim): Update base-syntax, improve :set highlighting (#29850)
- Match bang, "all" and "termcap" options, and trailing command
  separator "|".
- Highlight set assignment operators.
- Match multiline :set and multiline option values.
- Mention the newer "0o" octal prefix at :help :set=.

closes: vim/vim#15329

ddbb6fe2d0

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-07-25 09:55:59 +08:00
Christian Clason
80eda9726f docs(lua): clarify assumptions on luajit vs. puc lua
Problem: Plugin authors and distribution packagers are confused about
the role of LuaJIT vs. PUC Lua.

Solution: Clarify that LuaJIT is preferred but not required (extensions
should not be assumed but checked for) and that vanilla Lua 5.1 should
be used without language extensions such as `goto`.
2024-07-21 16:11:28 +02:00
zeertzjq
f73904f9d6
vim-patch:eb6d733: runtime(doc): fix more inconsistencies in assert function docs (#29796)
related: https://github.com/vim/vim/pull/15280#issuecomment-2233771449

closes: vim/vim#15285

eb6d733bef
2024-07-19 04:12:13 +00:00
Evgeni Chasnovski
f61efe3fe7
perf(filetype): implement parent pattern pre-matching (#29660)
Problem: calling `vim.filetype.match()` has performance bottleneck in
  that it has to match a lot of Lua patterns against several versions of
  input file name. This might be the problem if users need to call it
  synchronously a lot of times.

Solution: add "parent pattern pre-matching" which can be used to quickly
  reject several potential pattern matches at (usually rare) cost of
  adding time for one extra Lua pattern match.

  "Parent pattern" is a manually added/tracked grouping of filetype
  patterns which should have two properties:
    - Match at least the same set of strings as its filetype patterns.
      But not too much more.
    - Be fast to match.

  For them to be effective, group should consist from at least three
  filetype patterns.

  Example: for a filetpye pattern ".*/etc/a2ps/.*%.cfg", both "/etc/"
  and "%.cfg" are good parent patterns (prefer the one which can group
  more filetype patterns).

  After this commit, `vim.filetype.match()` on most inputs runs ~3.4
  times faster (while some inputs may see less impact if they match
  many parent patterns).
2024-07-18 10:26:27 -05:00
zeertzjq
18f1a3aaa5
vim-patch:c1b3984: runtime(doc): minor updates. (#29778)
closes: vim/vim#15280

c1b3984a7b

Co-authored-by: Shane Harper <shane@shaneharper.net>
2024-07-18 08:08:56 +08:00
Christian Clason
8e590cae83 vim-patch:9.1.0593: filetype: Asymptote files are not recognized
Problem:  filetype: Asymptote files are not recognized
Solution: detect '*.asy' files as asy filetype, include
          ftplugin and syntax plugin (AvidSeeker).

Reference: https://asymptote.sourceforge.io/

closes: vim/vim#15252

3088ef094d

Co-authored-by: AvidSeeker <avidseeker7@protonmail.com>
2024-07-17 11:11:58 +02:00
Christian Clason
5d8220bda0 vim-patch:3e07d5a: runtime(go): add recommended indent options to ftplugin
related: vim/vim#15264

3e07d5aef1

Co-authored-by: markmacode <code@mamo.aleeas.com>
2024-07-17 11:11:58 +02:00
Christian Clason
c146580e9d vim-patch:6a54dcb: runtime(gdscript): add recommended indent options to ftplugin
related: vim/vim#15264

6a54dcbbd6

Co-authored-by: markmacode <code@mamo.aleeas.com>
2024-07-17 11:11:58 +02:00
Christian Clason
61ea466591 vim-patch:9.1.0592: runtime: filetype: Mediawiki files are not recognized
Problem:  filetype: Mediawiki files are not recognized
Solution: detect "*.mw" and "*.wiki" as mediawiki filetype,
          include basic syntax and filetype plugins.
          (AvidSeeker)

closes: vim/vim#15266

b5844104ab

Co-authored-by: AvidSeeker <avidseeker7@protonmail.com>
2024-07-17 11:11:58 +02:00
altermo
118ae7e5ed fix(tohtml): support ranges again 2024-07-16 15:07:40 +02:00
Christian Clason
a0fd51c1e2 vim-patch:1cc4cae: runtime(typst): Add typst runtime files
closes: vim/vim#15234

1cc4cae961

Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-07-16 09:43:57 +02:00
zeertzjq
c2b51e6c41
vim-patch:df62c62: runtime(doc): grammar fixes in options.txt (#29729)
closes: vim/vim#15265

df62c62177

Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com>
2024-07-15 22:24:02 +00:00
Maria José Solano
8703e7bd12 docs(lpeg): merge upstream changes 2024-07-15 21:16:29 +01:00
dundargoc
04c158fbec
docs: misc (#29622)
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-07-15 06:54:45 +08:00
zeertzjq
8b7c8a0994
vim-patch:27c5598: runtime(doc): Add hint how to load termdebug from vimrc (#29704)
fixes: vim/vim#15256

27c55984de

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-07-14 18:15:50 +08:00
zeertzjq
ba36742211 vim-patch:9.1.0574: ex: wrong handling of commands after bar
Problem:  ex: wrong handling of commands after bar
Solution: for :append, :insert and :change use the text after the bar
          as input for those commands. This is what POSIX requests.
          (Mohamed Akram)

See the POSIX Spec:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_13_03
Section 12.c

closes: vim/vim#15229

8c446da349

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
2024-07-14 13:39:40 +08:00
zeertzjq
9093fbdd02 vim-patch:9.1.0573: ex: no implicit print for single addresses
Problem:  ex: no implicit print for single addresses
Solution: explicitly print even during single addresses,
          as requested by POSIX (Mohamed Akram)

See the POSIX behaviour here:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_13_03
Section 6b

closes: vim/vim#15230

c25a7084e9

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
2024-07-14 13:39:40 +08:00
Amit Singh
970a27927e
fix(lua)!: do not use typed table for empty dict
Problem:
Empty dictionaries are converted into typed tables of the form `{ [true]
= 6}` instead of an empty dictionary representation `{}`. This leads to
incorrect table representation, along with failure in JSON encoding of
such tables as currently tables with only string and number type keys
can be encoded.

Solution:
The typed table logic has been removed from `nlua_push_Dictionary`. The
typed table logic is required only for float value conversions which is
already handled in `nlua_push_Float`. So, it is(was) no longer required
here.

Fixes neovim/neovim#29218
2024-07-13 16:42:28 +05:30