From 25acff06d7784fbb68eff528118dd9e771b401a7 Mon Sep 17 00:00:00 2001 From: Nisarg Jasani Date: Sun, 30 Aug 2026 16:30:16 -0400 Subject: [PATCH] Fix Tab-to-accept crashing for user-defined function completions buildVarOrFunctionOption() expects state and pos as separate positional arguments (matching its sibling builders), but its call site was bundling them inside the options object instead, leaving both undefined. The resulting apply() closure then threw "Cannot read properties of undefined (reading 'doc')" when accepting a user-defined function completion via Tab, which the Tab keymap handler swallowed as "unhandled" and fell through without inserting anything. Fixes #4272 --- client/utils/contextAwareHinter.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/utils/contextAwareHinter.js b/client/utils/contextAwareHinter.js index 1562424e0b..1a8c86b3cd 100644 --- a/client/utils/contextAwareHinter.js +++ b/client/utils/contextAwareHinter.js @@ -262,15 +262,17 @@ export default function contextAwareHinter(context, { hints = [] } = {}) { (!scopeToDeclaredVarsMap[currentContext]?.[varName] && scopeToDeclaredVarsMap.global?.[varName] === 'fun'); - return buildVarOrFunctionOption({ - name: varName, - isFunc, - userDefinedFunctionMetadata, - blacklist, - range: wordInfo, + return buildVarOrFunctionOption( + { + name: varName, + isFunc, + userDefinedFunctionMetadata, + blacklist, + range: wordInfo + }, state, pos - }); + ); }); const globalOptions = hints