I am mostly working with Typescript and Python, so that I am not aware of the Situation in other languages.
Problem Statement
When calling functions or constructors, the proposed arguments of autocomplete are often hallucinated as cursor seems to only keep function and class definitions in context if they were in the editor recently.
This is especially confusing as, when hovering over a function call, the correct arguments from the definition are shown correctly as they are known deterministically from indexing.
Proposed Solution
If autocomplete predicts function/constructor calls, use the information from indexing as context to facilitate generation of correct arguments.
Example
Some function Definition in another file:
function add(x: number, y: number, z: number): number {
return x + y + z;
}
when attempting to use the function in another file by typing result = ad
the wrong autocomplete may look like
const result = add(my_var_x, my_var_y)
because cursor did hallucinate that add takes two arguments, in contradition to the actual definition.