Why is the quality of code autocomplete so low? | Lobsters

Consider this snippet of c:

void f(int *x); void g(void) { struct { int foo; char bar; struct foo *baz; int *biz; void (*booze)(void); struct { int foo; char bar; } bones; } x; f(&x.

The cursor is at the very end of the file, and the environment is prompted for an autompletion. To me, a human, it seems obvious that the most viable completions are foo and bones (or, maybe, bones.foo). Clangd, however, is blissfully unaware and simply lists all the members of x in order. (Maybe visual studio does better?)

But ok, that’s c. Java is known for its high-quality IDEs; how does it fare? Here’s a java snippet (with the cursor at the _):

public class Bar { int foo; byte bar; String baz; int[] booze; Bar boop;
} public class Foo { public static void main(String[] argv) { Bar bar = new Bar(); test(bar._ } static void test(int x) {}

Viable completions are foo, bar, boop, and booze. (Or, for bonus points, boop. and booze[.) I tried this in both intellij and eclipse, with the same result: foo and bar are both suggested, but boop and booze are not. (Also, foo is not preferred to bar, even though bar would have to be promoted, but this is not as big of a deal.)

This sort of structural introspection is effectively destructuring pattern matching which, when it’s an explicitly supported feature (as in MLs), compilers are great at. So why are they so bad at it in an interactive environment?