diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2026-09-28 14:19:41 +0100 |
|---|---|---|
| committer | Lewis Russell <lewis6991@gmail.com> | 2026-09-28 14:43:14 +0100 |
| commit | 33b148752008aef20b460ebd61d71a3cd850a0da (patch) | |
| tree | 1289bd0c10438fce1130051cd40b35c5dba2a2ca /test/functional/plugin/editorconfig_spec.lua | |
| parent | d51a6e2d55486b8ac3e352dc48f290884577dad9 (diff) | |
| download | rneovim-33b148752008aef20b460ebd61d71a3cd850a0da.tar.gz rneovim-33b148752008aef20b460ebd61d71a3cd850a0da.tar.bz2 rneovim-33b148752008aef20b460ebd61d71a3cd850a0da.zip | |
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
Diffstat (limited to 'test/functional/plugin/editorconfig_spec.lua')
| -rw-r--r-- | test/functional/plugin/editorconfig_spec.lua | 17 |
1 files changed, 17 insertions, 0 deletions
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, |