Skip to content

Commit bf42d5e

Browse files
authored
Merge pull request #3298 from halflifefan/max-fields-count
Made the hardcoded completion field limit configurable
2 parents e1c38e6 + b6f5daa commit bf42d5e

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44
<!-- Add all new changes here. They will be moved under a version at release -->
5+
* `NEW` Added `completion.maxSuggestCount` which lets you increase the amount of fields to analyze before requiring more specific input
56
* `New` Omit parameter hints when the argument name matches
67
* `FIX` Fix a typo in `no-unknown` diagnostic message
78
* `FIX` Autodoc generation so it does not include documentation for builtin Lua language features

locale/en-us/setting.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ config.completion.showWord.Disable =
178178
"Do not display context words."
179179
config.completion.autoRequire =
180180
"When the input looks like a file name, automatically `require` this file."
181+
config.completion.maxSuggestCount =
182+
"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."
181183
config.completion.showParams =
182184
"Display parameters in completion list. When the function has multiple definitions, they will be displayed separately."
183185
config.completion.requireSeparator =

script/config/template.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ local template = {
347347
'Disable',
348348
},
349349
['Lua.completion.autoRequire'] = Type.Boolean >> true,
350+
['Lua.completion.maxSuggestCount'] = Type.Integer >> 100,
350351
['Lua.completion.showParams'] = Type.Boolean >> true,
351352
['Lua.completion.requireSeparator'] = Type.String >> '.',
352353
['Lua.completion.postfix'] = Type.String >> '@',

script/core/completion/completion.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,9 @@ local function checkFieldOfRefs(refs, state, word, startPos, position, parent, o
565565
local fields = {}
566566
local funcs = {}
567567
local count = 0
568+
local maxSuggestCount = config.get(state.uri, 'Lua.completion.maxSuggestCount')
568569
for _, src in ipairs(refs) do
569-
if count > 100 then
570+
if count > maxSuggestCount then
570571
results.incomplete = true
571572
break
572573
end

0 commit comments

Comments
 (0)