<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/test/functional/lua/json_spec.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>test(harness): migrate away from magic globals</title>
<updated>2026-07-21T11:22:39+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-07-20T15:16:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=6d8c8b18d551d0be0490640c00fabb816727ec10'/>
<id>6d8c8b18d551d0be0490640c00fabb816727ec10</id>
<content type='text'>
Problem:
The magic globals `it`, `describe`, etc., are more trouble than they are
worth.

- Hooking into `after_each` requires `getfenv()` hacks.
- They confuse luals/emmylua, because the top-level `.luarc.json` isn't
  merged with `test/.luarc.json` (apparently a luals limitation?)
- They totally defeat discoverability because the user just has to
  "know" about the various magic symbols.

So they harm DX, which means they serve no purpose at all.

Solution:
- Expose the test API from `testutil`, so tests can call `t.it()`,
  `t.describe()`, etc., in the conventional way.
- Drop `getfenv()` hacks.
- Drop the `setfenv()` injection in `load_chunk`.
- Drop `test/_meta.lua`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
The magic globals `it`, `describe`, etc., are more trouble than they are
worth.

- Hooking into `after_each` requires `getfenv()` hacks.
- They confuse luals/emmylua, because the top-level `.luarc.json` isn't
  merged with `test/.luarc.json` (apparently a luals limitation?)
- They totally defeat discoverability because the user just has to
  "know" about the various magic symbols.

So they harm DX, which means they serve no purpose at all.

Solution:
- Expose the test API from `testutil`, so tests can call `t.it()`,
  `t.describe()`, etc., in the conventional way.
- Drop `getfenv()` hacks.
- Drop the `setfenv()` injection in `load_chunk`.
- Drop `test/_meta.lua`.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lua): give nicer error message when trying to index vim.NIL</title>
<updated>2026-06-29T12:20:09+00:00</updated>
<author>
<name>bfredl</name>
<email>bjorn.linse@gmail.com</email>
</author>
<published>2026-06-29T12:16:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=71b28da0f41e7389247a3421c38f0a83d8010c90'/>
<id>71b28da0f41e7389247a3421c38f0a83d8010c90</id>
<content type='text'>
The added test shows the context, one expected a JSON field
to be a Object but it was a null value

pros: shows `vim.NIL` instead of `a userdata`
cons: the context `field 'foo'` is lost. I think this is generated
with internal magic which is hard to replicate.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The added test shows the context, one expected a JSON field
to be a Object but it was a null value

pros: shows `vim.NIL` instead of `a userdata`
cons: the context `field 'foo'` is lost. I think this is generated
with internal magic which is hard to replicate.
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(stdlib): vim.json.decode() can allow comments #37795</title>
<updated>2026-02-11T11:54:57+00:00</updated>
<author>
<name>skewb1k</name>
<email>skewb1kunix@gmail.com</email>
</author>
<published>2026-02-11T11:54:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=6b4ec2264e1d8ba027b85f3883d532c5068be92a'/>
<id>6b4ec2264e1d8ba027b85f3883d532c5068be92a</id>
<content type='text'>
Problem:
`vim.json.decode()` could not parse JSONC (JSON with Comments)
extension, which is commonly used in configuration files.

Solution:
Introduce an `skip_comments` option, which is disabled by default. When
enabled, allows JavaScript-style comments within JSON data.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
`vim.json.decode()` could not parse JSONC (JSON with Comments)
extension, which is commonly used in configuration files.

Solution:
Introduce an `skip_comments` option, which is disabled by default. When
enabled, allows JavaScript-style comments within JSON data.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(json): vim.json.encode() sort_keys #35574</title>
<updated>2025-09-14T04:17:07+00:00</updated>
<author>
<name>skewb1k</name>
<email>skewb1kunix@gmail.com</email>
</author>
<published>2025-09-14T04:17:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=a897cc17a5ee9a3bf9a22eb105b15d2c162f7176'/>
<id>a897cc17a5ee9a3bf9a22eb105b15d2c162f7176</id>
<content type='text'>
Problem: There is no way to ensure a stable key order when encoding a JSON string,
which can be useful for comparisons and producing cleaner diffs.

Solution: Introduce a `sort_keys` option for `vim.json.encode()`,which
is disabled by default. When enabled, object keys are sorted in
alphabetical order.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: There is no way to ensure a stable key order when encoding a JSON string,
which can be useful for comparisons and producing cleaner diffs.

Solution: Introduce a `sort_keys` option for `vim.json.encode()`,which
is disabled by default. When enabled, object keys are sorted in
alphabetical order.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(json): pretty-format (indent) with vim.json.encode() #35424</title>
<updated>2025-09-07T21:38:27+00:00</updated>
<author>
<name>skewb1k</name>
<email>skewb1kunix@gmail.com</email>
</author>
<published>2025-09-07T21:38:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=448f15ca396aa7007eb2c5cb82dd2ea6c5c82953'/>
<id>448f15ca396aa7007eb2c5cb82dd2ea6c5c82953</id>
<content type='text'>
Problem:
There is no straightforward way to pretty-print objects as JSON.
The existing `vim.inspect` outputs LON.

Solution:
Introduce an `indent` option for `vim.json.encode()` which enables
human-readable output with configurable indentation.

Adapts PR to upstream: openresty/lua-cjson#114</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
There is no straightforward way to pretty-print objects as JSON.
The existing `vim.inspect` outputs LON.

Solution:
Introduce an `indent` option for `vim.json.encode()` which enables
human-readable output with configurable indentation.

Adapts PR to upstream: openresty/lua-cjson#114</pre>
</div>
</content>
</entry>
<entry>
<title>fix(vim.json): loss of precision on integers &gt;14 digits #34876</title>
<updated>2025-07-11T02:07:56+00:00</updated>
<author>
<name>jade</name>
<email>jadel@mercury.com</email>
</author>
<published>2025-07-11T02:07:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=7a69fefdb95daba355aa1b05ebfdf4d0b0d51ec2'/>
<id>7a69fefdb95daba355aa1b05ebfdf4d0b0d51ec2</id>
<content type='text'>
Problem: multiple DAP servers keep assuming they can have internal IDs
         up to 2**52, which get corrupted by the Neovim JSON encoder.
Solution: change (1) constant and add a test so nobody breaks it while
          updating the library.

Fixes: https://github.com/neovim/neovim/issues/24532
Fixes: https://github.com/mfussenegger/nvim-dap/issues/1534
Fixes: https://github.com/facebook/buck2/issues/1032</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: multiple DAP servers keep assuming they can have internal IDs
         up to 2**52, which get corrupted by the Neovim JSON encoder.
Solution: change (1) constant and add a test so nobody breaks it while
          updating the library.

Fixes: https://github.com/neovim/neovim/issues/24532
Fixes: https://github.com/mfussenegger/nvim-dap/issues/1534
Fixes: https://github.com/facebook/buck2/issues/1032</pre>
</div>
</content>
</entry>
<entry>
<title>docs: misc #31479</title>
<updated>2025-01-01T20:29:51+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2025-01-01T20:29:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=dc692f553aae367a03f286e0d59561247941f96c'/>
<id>dc692f553aae367a03f286e0d59561247941f96c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(stdlib): vim.json.encode(...,{escape_slash:boolean}) #30561</title>
<updated>2024-12-06T20:43:41+00:00</updated>
<author>
<name>Bartłomiej Maryńczak</name>
<email>marynczak.bartlomiej@gmail.com</email>
</author>
<published>2024-12-06T20:43:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=517ecb85f58ed6ac8b4d5443931612e75e7c7dc2'/>
<id>517ecb85f58ed6ac8b4d5443931612e75e7c7dc2</id>
<content type='text'>
Problem:
vim.json.encode escapes every slash in string values (for example in
file paths), and is not optional. Use-case is for preventing HTML
injections (eg. injecting `&lt;/script&gt;` closing tag); in the context of
Nvim this is rarely useful.

Solution:
- Add a `escape_slash` flag to `vim.json.encode`.
- Defaults to `false`. (This is a "breaking" change, but more like
  a bug fix.)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
vim.json.encode escapes every slash in string values (for example in
file paths), and is not optional. Use-case is for preventing HTML
injections (eg. injecting `&lt;/script&gt;` closing tag); in the context of
Nvim this is rarely useful.

Solution:
- Add a `escape_slash` flag to `vim.json.encode`.
- Defaults to `false`. (This is a "breaking" change, but more like
  a bug fix.)</pre>
</div>
</content>
</entry>
<entry>
<title>fix(vim.json): properly treat luanil options as booleans (#28622)</title>
<updated>2024-05-03T11:26:56+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2024-05-03T11:26:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=e15991c8116cc7fa1c0ccf65b544199ec6ffa7e8'/>
<id>e15991c8116cc7fa1c0ccf65b544199ec6ffa7e8</id>
<content type='text'>
Note: Upstream doesn't have this. It's an Nvim addition.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Note: Upstream doesn't have this. It's an Nvim addition.</pre>
</div>
</content>
</entry>
<entry>
<title>test: improve test conventions</title>
<updated>2024-04-23T16:17:04+00:00</updated>
<author>
<name>dundargoc</name>
<email>gocdundar@gmail.com</email>
</author>
<published>2024-04-20T15:44:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=052498ed42780a76daea589d063cd8947a894673'/>
<id>052498ed42780a76daea589d063cd8947a894673</id>
<content type='text'>
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
</pre>
</div>
</content>
</entry>
</feed>
