<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/src/cjson, branch fix_repeatcmdline</title>
<subtitle>Neovim fork with Rahm's personal hacks.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/'/>
<entry>
<title>fix(vim.json)!: remove global options, "null", "array_mt" #24070</title>
<updated>2023-06-21T08:10:32+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2023-06-21T08:10:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=8d4a53fe6e20652946948170f2436ec520f9bdfe'/>
<id>8d4a53fe6e20652946948170f2436ec520f9bdfe</id>
<content type='text'>
Problem:
- `vim.json` exposes various global options which:
  - affect all Nvim Lua plugins (especially the LSP client)
  - are undocumented and untested
  - can cause confusing problems such as: https://github.com/codota/tabnine-nvim/commit/cc76ae3abe2f129d44b5a8edee2529e0ee0dcf69
- `vim.json` exposes redundant mechanisms:
  - `vim.json.null` is redundant with `vim.NIL`.
  - `array_mt` is redundant because Nvim uses a metatable
    (`vim.empty_dict()`) for empty dict instead, which `vim.json` is
    configured to use by default (see `as_empty_dict`).
    Example:
    ```
    :lua vim.print(vim.json.decode('{"bar":[],"foo":{}}'))
    --&gt; { bar = {},  foo = vim.empty_dict() }
    ```
    Thus we don't need to also decorate empty arrays with `array_mt`.

Solution:
Remove the functions from the public vim.json interface.
Comment-out the implementation code to minimize drift from upstream.

TODO:
- Expose the options as arguments to `vim.json.new()`</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
- `vim.json` exposes various global options which:
  - affect all Nvim Lua plugins (especially the LSP client)
  - are undocumented and untested
  - can cause confusing problems such as: https://github.com/codota/tabnine-nvim/commit/cc76ae3abe2f129d44b5a8edee2529e0ee0dcf69
- `vim.json` exposes redundant mechanisms:
  - `vim.json.null` is redundant with `vim.NIL`.
  - `array_mt` is redundant because Nvim uses a metatable
    (`vim.empty_dict()`) for empty dict instead, which `vim.json` is
    configured to use by default (see `as_empty_dict`).
    Example:
    ```
    :lua vim.print(vim.json.decode('{"bar":[],"foo":{}}'))
    --&gt; { bar = {},  foo = vim.empty_dict() }
    ```
    Thus we don't need to also decorate empty arrays with `array_mt`.

Solution:
Remove the functions from the public vim.json interface.
Comment-out the implementation code to minimize drift from upstream.

TODO:
- Expose the options as arguments to `vim.json.new()`</pre>
</div>
</content>
</entry>
<entry>
<title>fix: Add missing void as function argument (#22317)</title>
<updated>2023-02-18T20:35:27+00:00</updated>
<author>
<name>Andreas Schneider</name>
<email>asn@cryptomilk.org</email>
</author>
<published>2023-02-18T20:35:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=53841df58d44b64637d6400abd7d4ace9c018be8'/>
<id>53841df58d44b64637d6400abd7d4ace9c018be8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>refactor: fix clang-tidy bugprone-signed-char-misuse warnings</title>
<updated>2022-03-04T18:52:41+00:00</updated>
<author>
<name>Dundar Göc</name>
<email>gocdundar@gmail.com</email>
</author>
<published>2022-02-27T11:29:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=4d2744ffe30c785ff19624831e36d01e3f6a6089'/>
<id>4d2744ffe30c785ff19624831e36d01e3f6a6089</id>
<content type='text'>
Prefer to declare variables with correct type instead of explicit casts
wherever possible.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prefer to declare variables with correct type instead of explicit casts
wherever possible.
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lua): add proper support of luv threads</title>
<updated>2022-02-26T13:01:38+00:00</updated>
<author>
<name>erw7</name>
<email>erw7.github@gmail.com</email>
</author>
<published>2021-09-11T02:48:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=b87867e69e94d9784468a126f21c721446f080de'/>
<id>b87867e69e94d9784468a126f21c721446f080de</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lsp): improve json deserialization performance (#15854)</title>
<updated>2021-10-05T15:37:20+00:00</updated>
<author>
<name>Michael Lingelbach</name>
<email>m.j.lbach@gmail.com</email>
</author>
<published>2021-10-05T15:37:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=912a6e5a9c58fce74134f9f8c2801373928e8289'/>
<id>912a6e5a9c58fce74134f9f8c2801373928e8289</id>
<content type='text'>
* Add optional second table argument to vim.json.decode which takes
  a table 'luanil' which can include the 'object' and/or 'array' keys. These
  options use luanil when converting NULL in json objects and arrays
  respectively. The default behavior matches the original lua-cjson.
* Remove recursive_convert_NIL function from rpc.lua, use
  vim.json.decode with luanil = { object = true } instead. This removes a hotpath
  in the json deserialization pipeline by dropping keys with json NULL
  values throughout the deserialized table.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Add optional second table argument to vim.json.decode which takes
  a table 'luanil' which can include the 'object' and/or 'array' keys. These
  options use luanil when converting NULL in json objects and arrays
  respectively. The default behavior matches the original lua-cjson.
* Remove recursive_convert_NIL function from rpc.lua, use
  vim.json.decode with luanil = { object = true } instead. This removes a hotpath
  in the json deserialization pipeline by dropping keys with json NULL
  values throughout the deserialized table.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lua): expose lua-cjson as vim.json</title>
<updated>2021-09-26T07:35:55+00:00</updated>
<author>
<name>Michael Lingelbach</name>
<email>m.j.lbach@gmail.com</email>
</author>
<published>2021-09-23T17:39:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=30fed27241cc2a8f930212375f994a7fa6c99008'/>
<id>30fed27241cc2a8f930212375f994a7fa6c99008</id>
<content type='text'>
* add vim.json.encode and vim.json.decode
* use vim.NIL instead of cjson.null
* resolve strict-prototypes warnings

* The following benchmark shows an approximately 2.5x (750 ms vs 300 ms) improvement in deserialization performance over
  vim.fn.json_decode on a medium package.json

  ```lua
  local uv = vim.loop
  local function readfile(path)
    return
  end

  local json_url = "https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/b24c8d5c89ee93d1172b4127564f5da3b0c88dad/editors/code/package.json"
  io.popen(string.format('curl -v -f -L -O %q &amp;&gt; /dev/null', json_url))

  local json_string = io.open('package.json'):read '*a'

  uv.update_time()
  local start = uv.hrtime()

  for i = 1,1000 do
    vim.fn.json_decode(json_string)
  end

  uv.update_time()
  print(string.format("Deserialization time vim.fn.json_decode: %s ms", (uv.hrtime() - start) * (1e-6)))

  uv.update_time()
  local start = uv.hrtime()

  for i = 1,1000 do
    vim.json.decode(json_string)
  end
  uv.update_time()
  print(string.format("Deserialization time vim.json.decode: %s ms", (uv.hrtime() - start) * (1e-6)))
  ```

Co-Authored-By: Björn Linse &lt;bjorn.linse@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* add vim.json.encode and vim.json.decode
* use vim.NIL instead of cjson.null
* resolve strict-prototypes warnings

* The following benchmark shows an approximately 2.5x (750 ms vs 300 ms) improvement in deserialization performance over
  vim.fn.json_decode on a medium package.json

  ```lua
  local uv = vim.loop
  local function readfile(path)
    return
  end

  local json_url = "https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/b24c8d5c89ee93d1172b4127564f5da3b0c88dad/editors/code/package.json"
  io.popen(string.format('curl -v -f -L -O %q &amp;&gt; /dev/null', json_url))

  local json_string = io.open('package.json'):read '*a'

  uv.update_time()
  local start = uv.hrtime()

  for i = 1,1000 do
    vim.fn.json_decode(json_string)
  end

  uv.update_time()
  print(string.format("Deserialization time vim.fn.json_decode: %s ms", (uv.hrtime() - start) * (1e-6)))

  uv.update_time()
  local start = uv.hrtime()

  for i = 1,1000 do
    vim.json.decode(json_string)
  end
  uv.update_time()
  print(string.format("Deserialization time vim.json.decode: %s ms", (uv.hrtime() - start) * (1e-6)))
  ```

Co-Authored-By: Björn Linse &lt;bjorn.linse@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lua): add lua-cjson as vendored dependency</title>
<updated>2021-09-26T07:35:47+00:00</updated>
<author>
<name>Michael Lingelbach</name>
<email>m.j.lbach@gmail.com</email>
</author>
<published>2021-09-23T17:36:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=8decc9f52d7dbd8eeed3afdf86f800b3677d25ab'/>
<id>8decc9f52d7dbd8eeed3afdf86f800b3677d25ab</id>
<content type='text'>
Derived from the openresty lua-cjson fork at commit https://github.com/openresty/lua-cjson/commit/3d93d297092172eac3d52a1b3b6c1d479da5341a
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Derived from the openresty lua-cjson fork at commit https://github.com/openresty/lua-cjson/commit/3d93d297092172eac3d52a1b3b6c1d479da5341a
</pre>
</div>
</content>
</entry>
</feed>
