Skip to content

Conversation

@danvervlad
Copy link
Contributor

Summary

  • Adds the ability to mark actions, conditions, and expressions as deprecated in extension functions
  • Displays visual deprecation warnings in the Events Sheet when deprecated functions are used
  • Allows extension authors to provide a deprecation message explaining what to use instead

Changes

Core/GDCore:

  • Added SetDeprecationMessage and IsDeprecated methods to InstructionMetadata, ExpressionMetadata, and MultipleInstructionMetadata
  • Added DeprecatedExpression error type to ExpressionParserError
  • Extended InstructionValidator with ValidateParameter that returns both validity and deprecation status via new ParameterValidationResult struct
  • Added deprecation fields to EventsFunction model (isDeprecated, deprecationMessage)

Events Sheet (UI):

  • Displays [DEPRECATED] prefix for deprecated actions and conditions
  • Shows deprecation message in tooltips
  • Highlights deprecated expressions with visual styling (background highlight)
  • Respects the existing showDeprecatedInstructionWarning preference flag

Extension Editor:

  • Added "Deprecated" checkbox in function properties
  • Added "Deprecation message" text field when function is marked deprecated

@danvervlad danvervlad requested a review from 4ian as a code owner January 21, 2026 14:59
@danvervlad
Copy link
Contributor Author

Function properties

With Deprecated = true

83955

With Deprecated = false

26225

With Show a warning on deprecated actions and conditions = true

7619

In event sheet

62048

In action/condition details

47019

In expression details

81063

With Show a warning on deprecated actions and conditions = false

17845

In event sheet

92429

In action/condition details

45701

In expression details

28916

@danvervlad
Copy link
Contributor Author

In extension json, for serialization
99362

@4ian
Copy link
Owner

4ian commented Jan 26, 2026

Hello! Thanks for opening this PR.

The extension editor UI is still a bit rough today (the extension editor has changed a lot lately and we still try to improve it). The "Private" checkbox should have been named "Hidden": when you check it, you will see that existing usages of the function appear in yellow. So I wonder if this would have fitted your need?

More context: We try to make depreciation as transparent as possible for users. This means:

  • "Deprecated" functions are never removed from reviewed extensions to ensure compatibility with old projects
  • "Deprecated" functions are no longer visible to users when they add new actions, but the name of the new action is usually the same so they only notice that the list of parameter has changed

In your case, I guess you want to have the deprecation explanation shown to your users?
I will discuss this a bit more with the rest of the team.

@danvervlad
Copy link
Contributor Author

Hello! Thanks for opening this PR.

The extension editor UI is still a bit rough today (the extension editor has changed a lot lately and we still try to improve it). The "Private" checkbox should have been named "Hidden": when you check it, you will see that existing usages of the function appear in yellow. So I wonder if this would have fitted your need?

More context: We try to make depreciation as transparent as possible for users. This means:

  • "Deprecated" functions are never removed from reviewed extensions to ensure compatibility with old projects
  • "Deprecated" functions are no longer visible to users when they add new actions, but the name of the new action is usually the same so they only notice that the list of parameter has changed

In your case, I guess you want to have the deprecation explanation shown to your users? I will discuss this a bit more with the rest of the team.

Hi, I know about the "Hidden" checkbox, but it's intended for use within the extension itself, isn't it?
The main idea for deprecated functions is that they should be clearly marked as such and highlighted everywhere (event sheets, detailed view) with a deprecation explanation, while being hidden from search results.

if (showDeprecatedInstructionWarning) {
hasDeprecationWarning = validationResult.hasDeprecationWarning();
}
validationResult.delete();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably create a crash/memory corruption. Indeed, the JS/C++ bindings are using a [Value]:
[Value] ParameterValidationResult STATIC_ValidateParameter

This means (you can check that in glue.cpp, in the C function generated for interfacing) that the returned object is a static object in C++. There is always one living in memory, which is reused across calls. Which means:

  • Multiple calls will refer to the same object (the second call "erases" the first one)
  • If you delete it, you actually destroyed static memory which is basically undefined behavior I guess in C++/wasm. In short, it's a crash next time this memory is accessed.

This fix is simple: don't delete it :) This is sadly the hard to find/detect bugs with the C++/JS bindings (unclear lifetime of returned C++ objects).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right, removed delete call for static object

};

gd::String MetadataDeclarationHelper::GetFreeFunctionSentence(const gd::EventsFunction &eventsFunction) {
// Note: [DEPRECATED] prefix is now added in the UI layer (Instruction.js)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this note is useful? This seems like a detail for the reader of the code, this could be removed I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, removed

Copy link
Owner

@4ian 4ian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I left a comment. My main other comment is that "[DEPRECATED]" is very "heavy" on the screen and I would rather have it as an additional preference (or we remove the existing preference and replace it by a preference which is an enum: "showDeprecatedOrHiddenWarning": "no" | "icon" | "icon-and-deprecated-warning-text").

Let me know if you can rework or introduce this preference :)

@danvervlad
Copy link
Contributor Author

danvervlad commented Feb 11, 2026

Hi @4ian, the idea sounds great! I've made appropriate changes, please take a look.
9128

@danvervlad danvervlad force-pushed the feat/mark-function-as-deprecated branch from 767fcc1 to 81330bd Compare February 11, 2026 15:11
@danvervlad danvervlad force-pushed the feat/mark-function-as-deprecated branch from 81330bd to a0277ab Compare February 11, 2026 15:11
@danvervlad danvervlad requested a review from 4ian February 11, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants