From 33b148752008aef20b460ebd61d71a3cd850a0da Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 28 Sep 2026 14:19:41 +0100 Subject: fix(editorconfig): handle root separately from properties Problem: A child root=false masks a parent root=true during merging. Solution: Return the search boundary separately from string properties. Exclude root from property callbacks and b:editorconfig. AI-assisted --- test/functional/plugin/editorconfig_spec.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/functional/plugin/editorconfig_spec.lua') diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua index 7e7b8b9220..769355428f 100644 --- a/test/functional/plugin/editorconfig_spec.lua +++ b/test/functional/plugin/editorconfig_spec.lua @@ -136,6 +136,23 @@ describe('editorconfig', function() clear({ args = { '--clean' } }) end) + it('stops at root even when a child sets root=false', function() + local root = testdir .. pathsep .. 'root' + local child = root .. pathsep .. 'child' + n.mkdir_p(child) + t.write_file(root .. pathsep .. '.editorconfig', 'root = true\n[*]\nindent_style = space\n') + t.write_file(child .. pathsep .. '.editorconfig', 'root = false\n[*]\ntab_width = 5\n') + + command('set shiftwidth=4') + -- The outer .editorconfig sets indent_size=3 for this filename. + test_case('root' .. pathsep .. 'child' .. pathsep .. '3_space.txt', { + expandtab = true, + shiftwidth = 4, + tabstop = 5, + }) + eq({ indent_style = 'space', tab_width = '5' }, fn.luaeval('vim.b.editorconfig')) + end) + it('sets indent options', function() test_case('3_space.txt', { expandtab = true, -- cgit