GMEdit icon indicating copy to clipboard operation
GMEdit copied to clipboard

Variables being highlighted seemingly randomly

Open MangoDev1 opened this issue 2 years ago • 1 comments

I noticed in my project that some variables are different colors than others, yet I couldn't really notice a difference between them. Is there anything that I'm missing? I'm going to use my simple delta time code as an example.

Create event: image

Step event (starts to show seemingly random coloring): image

Also, here's another example with some structs I have for my player movement;

Move struct: image

Key.Move struct (different coloring? maybe from nested structs?): image

I'm just asking if this is supposed to be like this and if so then what this means.

I'm using the GMEdit Windows beta from the itch.io page, GMS2.3, and the One Dark theme from the list of community themes in the GMEdit wiki. How to reproduce: ??? (seems to be random, maybe try to just make a bunch of variables across a file until you see something like what is in this issue)

MangoDev1 avatar Nov 27 '21 08:11 MangoDev1

Current versions of GMEdit index variables that are assigned in Create event (optionally with types, if your linter settings say so) and use this information to color variables in object's other events (or scripts with @self tag set to that object). This helps to track down variable "leaks" (additional variables being introduced at some point and forgotten about) and variables that are being accessed without necessarily being assigned. I can add an option to disable this.

As for Move: in a struct declaration, that's the same as the other issue - the syntax highlighter cannot have knowledge of what context a word is used in unless it processes entirety of syntax (that's a few thousand more lines of code and a performance hit)

YellowAfterlife avatar Nov 28 '21 14:11 YellowAfterlife