Editor bugs - enums and structs ("Go to def"/"Find all instances"/auto-complete)

Started by Snarky, Thu 09/11/2017 11:40:05

Previous topic - Next topic

Snarky

I've noticed that a few functions in the editor don't work for enums, and one other thing for user-defined structs (I'm testing in version 3.4.0.16).

Enums

  • Auto-complete doesn't work for enum types. For example, if you want to use the built-in enum CharacterDirection, the auto-complete list pops up once you type "Cha", but CharacterDirection does not appear in the list. This is also true of user-defined enum types.
  • The "Go to definition" function (available by right-clicking on an instance of the enum name in the editor) doesn't work for user-defined enum types (and obviously not for built-in enum types). Nothing happens. However, "Find all usages" does work, with the definition included in the list of results.
  • A smaller matter, but if you declare an enum variable and try to set it on the same line, the auto-complete dropdown with the valid values doesn't appear right away when you type "=". Once you start typing a name, the regular auto-complete (with all other matching tokens as well) shows up after three characters as usual. Again, this applies both to built-in and user-defined enums. So, for example:
Code: ags
  CharacterDirection exitDirection = eDirectionLeft;


You get no dropdown after "=". After "eDi" you get the full list with "eDirectionDown" (the first matching token) highlighted. But:

Code: ags
  CharacterDirection exitDirection;
  exitDirection = eDirectionLeft;


On the second line you get a dropdown after "=" with just the CharacterDirection values.

Ideally you would get a list with all the CharacterDirection values AND all the CharacterDirection variables only. Alternatively the list of values could show up after the =, but if you type something else it could disappear and after three characters you'd get the the full list. In any case, it should probably behave the same way whether you define and set the variable on one line or multiple.

Structs

  • For user-defined structs, the right-click situation is reversed. "Go to definition" works, but "Show all instances" doesn't. Or rather, it only finds instances in the current script. This applies both to the data type and to variables of that type. So if you export a user-defined struct variable from your script and use it in some other script, "Show all instances" will incorrectly claim that it's not being used anywhere else. This is perhaps the most serious, since it's actively misleading. I've had a lot of failures to compile because of this.

SMF spam blocked by CleanTalk