Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code editor 2: Global functions that use instance variables show them all in global color #6809

Open
KormexGit opened this issue Jul 20, 2024 — with GM Bug Reporter · 3 comments
Assignees
Labels
ide-bug Bugs with the GameMaker IDE project This issue has a sample project attached
Milestone

Comments

@KormexGit
Copy link

KormexGit commented Jul 20, 2024

Description

If you have a global function that uses instance variables, either built in or user defined, CE2 colors them as if the variables were put directly in the script and not inside a function. As a result, they're all in global variable color.

image

Steps To Reproduce

Define a function that sets instance variables, either built in ones or your own.

Which version of GameMaker are you reporting this issue for?

IDE v2024.800.0.593 Runtime v2024.800.0.617

Which operating system(s) are you seeing the problem on?

Windows 10.0.22631.0

cba263c3-17f3-466b-bd79-9e9b75dbeee1

@gm-bug-reporter gm-bug-reporter bot added ide-bug Bugs with the GameMaker IDE project This issue has a sample project attached labels Jul 20, 2024
@stuckie stuckie moved this from Triage to Todo in Team Workload Jul 22, 2024
@stuckie stuckie added this to the 2024.8 milestone Jul 22, 2024
@stuckie
Copy link

stuckie commented Jul 26, 2024

These are best assumed to be global variables, unless the function is called from an instance, in which case the scope belongs to the instance, rather than the global scope.

@stuckie stuckie closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Team Workload Jul 26, 2024
@YYDan YYDan moved this from Done to Not a bug in Team Workload Jul 29, 2024
@YYDan YYDan removed this from the 2024.8 milestone Jul 29, 2024
@rwkay
Copy link

rwkay commented Dec 10, 2024

These should be instance variables... not globals...

@rwkay rwkay reopened this Dec 10, 2024
@github-project-automation github-project-automation bot moved this from Not a bug to Triage in Team Workload Dec 10, 2024
@rwkay rwkay added this to the 2024.13 milestone Dec 10, 2024
@stuckie stuckie moved this from Triage to Todo in Team Workload Dec 11, 2024
@zreedy zreedy moved this from Todo to In Progress in Team Workload Dec 12, 2024
@zreedy
Copy link

zreedy commented Dec 12, 2024

These variables are now marked as "Instance Variables". This is persistent event in cases where these are globals such as the example below.

/// Script1

function test() {
    wow = 1234;
}

test(); // No other calls

If this is not acceptable we can kind of intuit if a variable is global by checking the CallingContext's ParentContent to see if it's global but this still would not be a perfect solution. For now the heuristic is that instance variables are highlighted as globals if LocalContext.Type is Script and SelfContext is Global.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ide-bug Bugs with the GameMaker IDE project This issue has a sample project attached
Projects
Status: In Progress
Development

No branches or pull requests

5 participants