nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

Deprecate `helpers.mkRaw` in favour of `lib.generators.mkLuaInline`

Open MattSturgeon opened this issue 1 year ago • 7 comments

Overview

Historically we have used our own mkRaw which produces an attrset that looks like { __raw = expr; }, however nixpkgs has had mkLuaInline for a while now (for use with its toLua generator). The nixpkgs function produces an attrset that looks like { _type = "lua-inline"; inherit expr; }.

We should add support for this in our toLua and begin transitioning usage of mkRaw to mkLuaInline.

Eventually we can deprecate our function in favour of mkLuaInline.

Even further in the future, we can deprecate __raw support in toLua.

See upstream usage in lib.generators.toLua and lib.generators.mkLuaInline definition.

TODO

  • [x] helpers.lua.mkLua should support nixpkg's "lua-inline" type. #2012
  • [ ] Transition internal __raw to use mkLuaInline
  • [ ] Documentation should recommend mkLuaInline
  • [ ] Add a deprecation warning to helpers.mkRaw
  • [ ] (eventually) Add a deprecation warning to toLua when encountering __raw

Note: there's now also a lib.generators.toLua in nixpkgs, however we currently can't use it, because it has no support for mixed list+attrs tables.

MattSturgeon avatar Jul 27 '24 02:07 MattSturgeon