<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/runtime/lua/vim/glob.lua, branch extregs</title>
<subtitle>Neovim fork with Rahm's personal hacks.</subtitle>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/'/>
<entry>
<title>perf(watch): skip directories outside include glob prefixes</title>
<updated>2026-10-05T14:28:15+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2026-09-30T16:15:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=209b78e36b7e5aba3033c98242c31617f25e3f82'/>
<id>209b78e36b7e5aba3033c98242c31617f25e3f82</id>
<content type='text'>
Problem: watchdirs() scans and watches every directory that is not
excluded, even when a glob only matches files in one subtree. Some
language servers register absolute dependency filenames separately.
Neovim uses the workspace root for these string globs, so each extra
registration can scan and allocate libuv handles across the whole tree.

Solution: Keep each glob's literal directory prefix with its compiled
matcher. A directory must be allowed by both the include filter and at
least one watch rule. Skip unrelated subtrees, including new directories
created later. Keep ancestors watched so matching directories can still
be found. Report events only when they match the full patterns.

For example, watching /project for /project/src/**/*.lua only needs the
src tree and /project itself:

    /project/            watched
    |-- src/             watched
    |   `-- lib/         watched
    |-- tests/           skipped
    |   `-- fixtures/    skipped
    `-- vendor/          skipped
        `-- pkg/         skipped

With no exclusions, this uses three watches instead of seven.

The gain can be large, but depends on the server's patterns and the
workspace layout. Separate watches for absolute dependency filenames can
skip most directories.

For example, a test workspace has 213 directories, including 201 under
build/. The two dependency files in this example are under packages/ and
styles/, so their watches can skip build/. Before this change, each
watch starts at the workspace root, scans all 213 directories and
creates 213 libuv handles.

With this change:

- Haskell Language Server: a separate watch for
  /project/packages/demo/demo.cabal watches four directories: the
  project root, packages/, demo/ and its src/ child. This cuts that
  watch's scans and handles by 98%. With one broad source watch and this
  dependency watch, the total falls by 49%.
- Tailwind CSS v4: a separate watch for the imported
  /project/styles/themes/colors.css watches three directories: the
  project root, styles/ and themes/. This cuts that watch's scans and
  handles by 99%. With two broad watches and this dependency watch, the
  total falls by 33%.

The broad watches still cover all 213 directories. The saving comes from
avoiding repeated scans and extra handles for each dependency watch.

Most servers with watch registrations in the survey do not benefit.
Their patterns match throughout the watch root, or their watches already
start at the relevant directory. In both cases, the glob prefix cannot
exclude more directories.

AI-assisted
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: watchdirs() scans and watches every directory that is not
excluded, even when a glob only matches files in one subtree. Some
language servers register absolute dependency filenames separately.
Neovim uses the workspace root for these string globs, so each extra
registration can scan and allocate libuv handles across the whole tree.

Solution: Keep each glob's literal directory prefix with its compiled
matcher. A directory must be allowed by both the include filter and at
least one watch rule. Skip unrelated subtrees, including new directories
created later. Keep ancestors watched so matching directories can still
be found. Report events only when they match the full patterns.

For example, watching /project for /project/src/**/*.lua only needs the
src tree and /project itself:

    /project/            watched
    |-- src/             watched
    |   `-- lib/         watched
    |-- tests/           skipped
    |   `-- fixtures/    skipped
    `-- vendor/          skipped
        `-- pkg/         skipped

With no exclusions, this uses three watches instead of seven.

The gain can be large, but depends on the server's patterns and the
workspace layout. Separate watches for absolute dependency filenames can
skip most directories.

For example, a test workspace has 213 directories, including 201 under
build/. The two dependency files in this example are under packages/ and
styles/, so their watches can skip build/. Before this change, each
watch starts at the workspace root, scans all 213 directories and
creates 213 libuv handles.

With this change:

- Haskell Language Server: a separate watch for
  /project/packages/demo/demo.cabal watches four directories: the
  project root, packages/, demo/ and its src/ child. This cuts that
  watch's scans and handles by 98%. With one broad source watch and this
  dependency watch, the total falls by 49%.
- Tailwind CSS v4: a separate watch for the imported
  /project/styles/themes/colors.css watches three directories: the
  project root, styles/ and themes/. This cuts that watch's scans and
  handles by 99%. With two broad watches and this dependency watch, the
  total falls by 33%.

The broad watches still cover all 213 directories. The saving comes from
avoiding repeated scans and extra handles for each dependency watch.

Most servers with watch registrations in the survey do not benefit.
Their patterns match throughout the watch root, or their watches already
start at the relevant directory. In both cases, the glob prefix cannot
exclude more directories.

AI-assisted
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(glob): match leading hash characters literally</title>
<updated>2026-10-05T14:20:53+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2026-09-30T16:15:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=8577e795bfb66dbdf1808828576683bfa1ab400c'/>
<id>8577e795bfb66dbdf1808828576683bfa1ab400c</id>
<content type='text'>
Problem: Globs such as '#generated/*.lua' fail to match their literal
paths. The parser consumes a leading '#' as its internal in-segment
flag.

Solution: Pass the flag as an LPeg match argument instead of inserting
it into the glob text. Cover literal and braced patterns with leading
hashes.

AI-assisted
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: Globs such as '#generated/*.lua' fail to match their literal
paths. The parser consumes a leading '#' as its internal in-segment
flag.

Solution: Pass the flag as an LPeg match argument instead of inserting
it into the glob text. Cover literal and braced patterns with leading
hashes.

AI-assisted
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(glob): handle numeric literals in pattern matching (#37257)</title>
<updated>2026-01-12T18:58:01+00:00</updated>
<author>
<name>Tristan Knight</name>
<email>admin@snappeh.com</email>
</author>
<published>2026-01-12T18:58:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=d2ca90d87e3246b5b827ed08f8c0dfc8ad6ae4c8'/>
<id>d2ca90d87e3246b5b827ed08f8c0dfc8ad6ae4c8</id>
<content type='text'>
Problem:
vim.glob.to_lpeg() errors when patterns contain numeric literals
(like the '1' in '.ps*1') because LPeg interprets numeric strings
as indexed grammar rule references. For example:
  vim.glob.to_lpeg('.ps*1')
  E5108: Lua: rule '1' undefined in given grammar

Solution:
Prefix all rule names with '_' in the end_seg() function to prevent
literal numbers from being interpreted as LPeg indexed rules. This
ensures pattern components like '1', '2', etc. are treated as
regular rule names rather than special references.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
vim.glob.to_lpeg() errors when patterns contain numeric literals
(like the '1' in '.ps*1') because LPeg interprets numeric strings
as indexed grammar rule references. For example:
  vim.glob.to_lpeg('.ps*1')
  E5108: Lua: rule '1' undefined in given grammar

Solution:
Prefix all rule names with '_' in the end_seg() function to prevent
literal numbers from being interpreted as LPeg indexed rules. This
ensures pattern components like '1', '2', etc. are treated as
regular rule names rather than special references.</pre>
</div>
</content>
</entry>
<entry>
<title>fix(glob): handling commas in letter pattern #34170</title>
<updated>2025-06-03T13:36:44+00:00</updated>
<author>
<name>Brynne Taylor</name>
<email>7542439+brynne8@users.noreply.github.com</email>
</author>
<published>2025-06-03T13:36:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=3991f146215ba974fad0ef22beb21e6c95e30138'/>
<id>3991f146215ba974fad0ef22beb21e6c95e30138</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(glob): new Glob implementation based on Peglob #33605</title>
<updated>2025-05-22T07:24:49+00:00</updated>
<author>
<name>Brynne Taylor</name>
<email>7542439+brynne8@users.noreply.github.com</email>
</author>
<published>2025-05-22T07:24:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=322a6d305d088420b23071c227af07b7c1beb41a'/>
<id>322a6d305d088420b23071c227af07b7c1beb41a</id>
<content type='text'>
|vim.glob.to_lpeg()| uses a new LPeg-based implementation (Peglob) that
provides ~50% speedup for complex patterns. The implementation restores
support for nested braces and follows LSP 3.17 specification with
additional constraints for improved correctness and resistance to
backtracking edge cases.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
|vim.glob.to_lpeg()| uses a new LPeg-based implementation (Peglob) that
provides ~50% speedup for complex patterns. The implementation restores
support for nested braces and follows LSP 3.17 specification with
additional constraints for improved correctness and resistance to
backtracking edge cases.</pre>
</div>
</content>
</entry>
<entry>
<title>fix: resolve all remaining LuaLS diagnostics</title>
<updated>2025-01-27T16:37:50+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2025-01-24T13:01:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=6aa42e8f92bd8bea49b7b2accfe4ab67a5344e41'/>
<id>6aa42e8f92bd8bea49b7b2accfe4ab67a5344e41</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix: another round of type annotation fixes</title>
<updated>2024-10-31T11:55:23+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2024-10-31T11:28:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=1d4ba8c1edba064421b34c1197c3470a09798218'/>
<id>1d4ba8c1edba064421b34c1197c3470a09798218</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(glob): avoid `subcapture nesting too deep` error (#29520)</title>
<updated>2024-07-06T09:40:08+00:00</updated>
<author>
<name>Zoltán Nyikos</name>
<email>nyikoszoltan0@gmail.com</email>
</author>
<published>2024-07-06T09:40:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=b109b1abce8c86f80aea06948b32e35a70daa0b0'/>
<id>b109b1abce8c86f80aea06948b32e35a70daa0b0</id>
<content type='text'>
Use Cmt to evaluate Cond and Elem during match to avoid building the
nested capture structure later.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use Cmt to evaluate Cond and Elem during match to avoid building the
nested capture structure later.</pre>
</div>
</content>
</entry>
<entry>
<title>fix(glob): handle overlapping `{}` condition elements #29236</title>
<updated>2024-06-10T11:23:03+00:00</updated>
<author>
<name>Jon Huhn</name>
<email>nojnhuh@users.noreply.github.com</email>
</author>
<published>2024-06-10T11:23:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=4bd86120d41e3b01433004bf761beccb7f3a0167'/>
<id>4bd86120d41e3b01433004bf761beccb7f3a0167</id>
<content type='text'>
This change fixes an issue where glob patterns like `{a,ab}` would not
match `ab` because the first option `a` matches, then the end of the
string is expected but `b` is found, and LPeg does not backtrack to try
the next option `ab` which would match. The fix here is to also append
the rest of the pattern to the generated LPeg pattern for each option.
This changes a glob `{a,ab}` from being parsed as

    ("a" or "ab") "end of string"

to

    ("a" "end of string" or "ab" "end of string")

Here, matching against `ab` would try the first option, fail to match,
then proceed to the next option, and match.

The sacrifice this change makes is dropping support for nested `{}`
conditions, which VSCode doesn't seem to support or test AFAICT.

Fixes #28931

Co-authored-by: Sergey Slipchenko &lt;faergeek@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change fixes an issue where glob patterns like `{a,ab}` would not
match `ab` because the first option `a` matches, then the end of the
string is expected but `b` is found, and LPeg does not backtrack to try
the next option `ab` which would match. The fix here is to also append
the rest of the pattern to the generated LPeg pattern for each option.
This changes a glob `{a,ab}` from being parsed as

    ("a" or "ab") "end of string"

to

    ("a" "end of string" or "ab" "end of string")

Here, matching against `ab` would try the first option, fail to match,
then proceed to the next option, and match.

The sacrifice this change makes is dropping support for nested `{}`
conditions, which VSCode doesn't seem to support or test AFAICT.

Fixes #28931

Co-authored-by: Sergey Slipchenko &lt;faergeek@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>refactor(lua): refactored glob</title>
<updated>2024-01-19T11:54:04+00:00</updated>
<author>
<name>altermo</name>
<email>unknown</email>
</author>
<published>2024-01-18T09:02:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=9707363b09dbadeb58966d6d45acca17bd74e527'/>
<id>9707363b09dbadeb58966d6d45acca17bd74e527</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
