From 0a5a0efda64ccc789cda25b90fa907f277006cd3 Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Sun, 2 Mar 2025 13:44:13 -0800 Subject: feat(lua): don't complete private (_) fields after dot (.) #32690 --- .../lua/command_line_completion_spec.lua | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/functional') diff --git a/test/functional/lua/command_line_completion_spec.lua b/test/functional/lua/command_line_completion_spec.lua index f8786a45bb..ae0ab19d6b 100644 --- a/test/functional/lua/command_line_completion_spec.lua +++ b/test/functional/lua/command_line_completion_spec.lua @@ -107,6 +107,30 @@ describe('nlua_expand_pat', function() eq({ { 'set' }, 11 }, get_completions('vim.keymap.se')) end) + it('should exclude private fields after "."', function() + eq( + { { 'bar' }, 4 }, + get_completions('foo.', { + foo = { + _bar = true, + bar = true, + }, + }) + ) + end) + + it('should include private fields after "._"', function() + eq( + { { '_bar' }, 4 }, + get_completions('foo._', { + foo = { + _bar = true, + bar = true, + }, + }) + ) + end) + it('should be able to interpolate globals', function() eq( { { -- cgit