haxe icon indicating copy to clipboard operation
haxe copied to clipboard

[ide] Wrong autocomplete suggestions in some circumstances

Open haxiomic opened this issue 5 years ago • 10 comments

This reproduces with development branch 526bd66 but not 4.1.2 or 4.0.5

See video, I'm trying to write: new Uniform(new Vector4()) but it replaces it with another random type, in the video it's Landscape but I've get other types if the compiler server has been running longer (see second video):

gif is 8MB so may take a moment to load autocomplete-bug-landscape

Another case when server was running longer, notice it replaces items with HTMLDocument when I try to select Vector4 autocomplete bug-longer

Here's what I know:

  • Reproduces the same way between restarts of vscode
  • If I start typing from new Uniform| the bug occurs, but if I backspace to new Uniform(| and try again, the bug doesn't occur
  • ~~This bug happens when I create a new class that's not yet referenced anywhere else in the codebase. If I try that same line in a class referenced by Main.hx, the bug doesn't happen~~ Seems to happen elsewhere too

I have a reproducing project but it's not open source, let me know if you're investigating and I'll send a copy

haxiomic avatar Jul 04 '20 11:07 haxiomic

Random thought: does increasing the "haxe.maxCompletionItems" limit help?

Gama11 avatar Jul 04 '20 11:07 Gama11

Tried setting "haxe.maxCompletionItems" to 100000, restarted vscode but got the same result

haxiomic avatar Jul 04 '20 11:07 haxiomic

Update: I thought this only happened with modules not linked from Main, but it seems to happen in other modules. Here's another example. I'm trying to type new Box2(), first time it works, second time I get a random class (again testing with haxe 4.2.0).

Screen Recording 2020-07-07 at 16 57 14

Tried restarting vscode but got the same result

haxiomic avatar Jul 07 '20 16:07 haxiomic

Update: I can reproduce in 4.1.2 and 4.0.5, maybe it's a vshaxe bug? In 4.0.5: 4 0 5

When Vector2 is fully typed out, it gives only a single incorrect suggestion, which presumably haxe-side is actually Vector2

haxiomic avatar Jul 17 '20 12:07 haxiomic

I've found this bug occurs with a trivial Main.hx haxe file in 4.0.5, 4.1.3 and latest development commit

@Gama11 does this reproduce for you? Screen Recording 2020-08-14 at 18 34 18

  • I create a new Main.hx file
  • write an empty main class and try to write new Main() but it autocomplete replaces my text with some random class when I press (

I'm on macOS 10.14 with vshaxe 2.22.0

Is there a flag in vshaxe I can turn on to check the display output is correct?

haxiomic avatar Aug 14 '20 17:08 haxiomic

@haxiomic That's not a bug, ( is a commit character for functions (which includes constructors). You can control that with the "editor.acceptSuggestionOnCommitCharacter" setting.

Gama11 avatar Aug 14 '20 17:08 Gama11

@Gama11 I don't mean the ( being commit is an issue (that's great :)) the bug is the autocompletion: I type new Main( and I get new IntMap() – because this example is so minimal I'm curious if it happens for you too

haxiomic avatar Aug 14 '20 17:08 haxiomic

Well, that's a side effect of that being the selected completion item, because Main doesn't have a constructor that could appear before it.

Gama11 avatar Aug 14 '20 17:08 Gama11

Omgg I need to get more sleep, you're absolutely right – I decided main had a constructor for some reason, sorry to bother you

Will hide the comments because they're off topic from the original bug :X

haxiomic avatar Aug 14 '20 17:08 haxiomic

This is tentatively looking fixed in development builds! Will update when I'm certain

haxiomic avatar May 24 '22 11:05 haxiomic

I think this might be fixed! Thanks everyone <3

Testing with 4.3

haxiomic avatar Apr 10 '23 20:04 haxiomic