refactor(lua): rename vim.diff => vim.text.diff #34864

Problem:
`vim.diff()` was introduced before we had the `vim.text` module, where
it obviously belongs.

Solution:
Move it.
This commit is contained in:
Justin M. Keyes
2025-07-12 18:36:07 -04:00
committed by GitHub
parent 430be9d01d
commit f3a54e7ccf
12 changed files with 177 additions and 174 deletions

View File

@ -133,7 +133,6 @@ local config = {
filename = 'lua.txt',
section_order = {
'hl.lua',
'diff.lua',
'mpack.lua',
'json.lua',
'base64.lua',
@ -185,7 +184,6 @@ local config = {
'runtime/lua/vim/text.lua',
'runtime/lua/vim/glob.lua',
'runtime/lua/vim/_meta/builtin.lua',
'runtime/lua/vim/_meta/diff.lua',
'runtime/lua/vim/_meta/mpack.lua',
'runtime/lua/vim/_meta/json.lua',
'runtime/lua/vim/_meta/base64.lua',
@ -230,7 +228,6 @@ local config = {
'mpack',
'json',
'base64',
'diff',
'spell',
'regex',
'lpeg',

View File

@ -761,9 +761,9 @@ void nlua_state_add_stdlib(lua_State *const lstate, bool is_thread)
lua_setfield(lstate, -2, "lpeg");
lua_pop(lstate, 4);
// vim.diff
// vim.text.diff
lua_pushcfunction(lstate, &nlua_xdl_diff);
lua_setfield(lstate, -2, "diff");
lua_setfield(lstate, -2, "_diff");
// vim.json
lua_cjson_new(lstate);

View File

@ -164,9 +164,7 @@ static int call_on_hunk_cb(int start_a, int count_a, int start_b, int count_b, v
lua_pushinteger(lstate, count_b);
if (lua_pcall(lstate, 4, 1, 0) != 0) {
api_set_error(err, kErrorTypeException,
"error running function on_hunk: %s",
lua_tostring(lstate, -1));
api_set_error(err, kErrorTypeException, "on_hunk: %s", lua_tostring(lstate, -1));
return -1;
}