Skip to content
Open
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased
<!-- Add all new changes here. They will be moved under a version at release -->
* `NEW` Added `completion.maxFieldCount` which lets you increase the amount of fields to analyze before requiring more specific input

## 3.16.0
`2025-12-2`
Expand Down
2 changes: 2 additions & 0 deletions locale/en-us/setting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ config.completion.showWord.Disable =
"Do not display context words."
config.completion.autoRequire =
"When the input looks like a file name, automatically `require` this file."
config.completion.maxFieldCount =
"Maximum number of fields to analyze for completions. When an object has more fields than this limit, completions will require more specific input to appear."
config.completion.showParams =
"Display parameters in completion list. When the function has multiple definitions, they will be displayed separately."
config.completion.requireSeparator =
Expand Down
1 change: 1 addition & 0 deletions script/config/template.lua
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ local template = {
'Disable',
},
['Lua.completion.autoRequire'] = Type.Boolean >> true,
['Lua.completion.maxFieldCount'] = Type.Integer >> 100,
['Lua.completion.showParams'] = Type.Boolean >> true,
['Lua.completion.requireSeparator'] = Type.String >> '.',
['Lua.completion.postfix'] = Type.String >> '@',
Expand Down
3 changes: 2 additions & 1 deletion script/core/completion/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,9 @@ local function checkFieldOfRefs(refs, state, word, startPos, position, parent, o
local fields = {}
local funcs = {}
local count = 0
local maxFieldCount = config.get(state.uri, 'Lua.completion.maxFieldCount')
for _, src in ipairs(refs) do
if count > 100 then
if count > maxFieldCount then
results.incomplete = true
break
end
Expand Down
Loading