mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
Merge pull request #14318 from ToolJet/fix/codehinter-apply
Fixed incorrect anchor placement on selecting a suggestion
This commit is contained in:
commit
6a9d40f4e1
1 changed files with 11 additions and 10 deletions
|
|
@ -162,13 +162,11 @@ export const generateHints = (hints, totalReferences = 1, input, searchText) =>
|
|||
changes: pickedCompletionConfig,
|
||||
};
|
||||
|
||||
const actualInput = removeNestedDoubleCurlyBraces(doc.toString());
|
||||
|
||||
if (actualInput.length === 0) {
|
||||
dispatchConfig.selection = {
|
||||
anchor: anchorSelection,
|
||||
};
|
||||
}
|
||||
dispatchConfig.selection = {
|
||||
anchor:
|
||||
pickedCompletionConfig.from +
|
||||
(completion.type === 'js_methods' ? completion.label.length - 1 : completion.label.length),
|
||||
};
|
||||
|
||||
view.dispatch(dispatchConfig);
|
||||
},
|
||||
|
|
@ -331,11 +329,14 @@ export const getSuggestionsForMultiLine = (context, allHints, hints = {}, lang,
|
|||
break;
|
||||
}
|
||||
}
|
||||
dispacthConfig.selection = {
|
||||
anchor: pickedCompletionConfig.from + completion.label.length - 1,
|
||||
};
|
||||
}
|
||||
|
||||
dispacthConfig.selection = {
|
||||
anchor:
|
||||
pickedCompletionConfig.from +
|
||||
(completion.type === 'js_methods' ? completion.label.length - 1 : completion.label.length),
|
||||
};
|
||||
|
||||
view.dispatch(dispacthConfig);
|
||||
};
|
||||
return hint;
|
||||
|
|
|
|||
Loading…
Reference in a new issue