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: Comment colours are incorrect when multiple types are defined on JSDoc param lines #8704

Closed
Lukanibal opened this issue Dec 15, 2024 — with GM Bug Reporter · 8 comments
Assignees
Labels
ide-bug Bugs with the GameMaker IDE project This issue has a sample project attached
Milestone

Comments

@Lukanibal
Copy link

Description

When defining parameters for functions, using the comma or vertical bar breaks the color coding and it goes back to the default color only after the comma/vertical bar.
Image
Picture because I'm bad with words.
I also included a package with this script.

Steps To Reproduce

  1. Start GameMaker
  2. Define a Function
  3. Define a parameter that can accept multiple types
  4. See the issue

Which version of GameMaker are you reporting this issue for?

IDE v2024.1100.0.713 Runtime v2024.1100.0.726

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

Windows 10.0.26100.0

cc5261ac-625c-4abc-be1c-2018aa1e1e0d

@gm-bug-reporter gm-bug-reporter bot added ide-bug Bugs with the GameMaker IDE project This issue has a sample project attached labels Dec 15, 2024
@stuckie stuckie assigned stuckie and zreedy and unassigned stuckie Dec 16, 2024
@stuckie stuckie moved this from Triage to Todo in Team Workload Dec 16, 2024
@stuckie stuckie added this to the 2024.13 milestone Dec 16, 2024
@zreedy zreedy moved this from Todo to In Progress in Team Workload Dec 17, 2024
@zreedy
Copy link

zreedy commented Dec 17, 2024

Fixed. Additional bug where the * in any* was not highlighted.

Image

@PrismaticRealms
Copy link

PrismaticRealms commented Dec 18, 2024

Also, it seems the @func doesn't get coloured like the other JSDoc directives.

@bocoboc
Copy link

bocoboc commented Dec 18, 2024

Also, it seems the @func doesn't get coloured like the other JSDoc directives.

Function directive has been deprecated for CE2 as it's created by the function name and parameters automatically.

@zreedy zreedy closed this as completed Jan 7, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Team Workload Jan 7, 2025
@gurpreetsinghmatharoo gurpreetsinghmatharoo moved this from Done to Ready for QA in Team Workload Jan 8, 2025
@mgeddesGM
Copy link

verified as of IDE v2024.1300.0.714 Runtime v2024.1300.0.727

@mgeddesGM mgeddesGM moved this from Ready for QA to Verified in Team Workload Jan 9, 2025
@PrismaticRealms
Copy link

PrismaticRealms commented Jan 14, 2025

Also, it seems the @func doesn't get coloured like the other JSDoc directives.

Function directive has been deprecated for CE2 as it's created by the function name and parameters automatically.

A question about this.

Since the @func directive is deprecated in CE2, how would one define a JSDoc header for a function/method that has a variable number of parameters? With @func, it would be sometihng like this:

/// @func MyFunction(param1, param2, param3, ...)

How would we accomplish this without the @func directive in CE2 so that it is obvious in the Feather popup?

@bocoboc
Copy link

bocoboc commented Jan 14, 2025

Also, it seems the @func doesn't get coloured like the other JSDoc directives.

Function directive has been deprecated for CE2 as it's created by the function name and parameters automatically.

A question about this.

Since the @func directive is deprecated in CE2, how would one define a JSDoc header for a function/method that has a variable number of parameters? With @func, it would be sometihng like this:

/// @func MyFunction(param1, param2, param3, ...)

How would we accomplish this without the @func directive in CE2 so that it is obvious in the Feather popup?

You can use an Array as an argument type or use 'Any' as a type, check if the argument is an array, and cycle through it.

/// @param {Any} value
function newFunc(_values) {
    if(is_array(_values) {
        for(var i = 0; i < array_length(_values); i++) {
            ...
        }
    }
    else {
        ...
    }
}

or something like

/// @param {Real, Array<Real>} value    -    for type restriction checking

@PrismaticRealms
Copy link

PrismaticRealms commented Jan 14, 2025

You can use an Array as an argument type or use 'Any' as a type, check if the argument is an array, and cycle through it.

This requires changing the function signature, which I don't want to do. Let me ask a different question with the same goal in mind. How will the JSDocs for the GM runtime function choose be defined going forward without using the @func directive such that it is communicated to the programmer that it requires a variable number of parameters as part of its signature? Image below for reference.



@bocoboc
Copy link

bocoboc commented Jan 14, 2025

I totally understand this. But from what I tried you can't properly replicate the behavior of built-in functions even now.

Feather tooltip already ignores @func, it's just added as a description (that's why I have stopped using it).

Image

But the bottom bar (which is removed in CE2 and we want it back #7688) does show variable argument count when @func is omitted.

Image

Anyway, it's still ignored by the first line in the tooltip.

Image

You could make a new Issue about it.

@YYDan YYDan changed the title CE2 Breaks color coding when multiple types are defined in JSDoc Code Editor 2: Comment colours are incorrect when multiple types are defined on JSDoc param lines Jan 16, 2025
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: Verified
Development

No branches or pull requests

6 participants