Skip to content

Conversation

@TheRGuy9201
Copy link
Contributor

Summary

Array Indices Display Configuration Feature

Description

This PR adds functionality to the Randomness plugin to allow users to configure how array indices are displayed when generating arrays of schemes or templates. This pull request solves the problem related to issue #582. Users can now:

  1. Enable or disable index display
  2. Configure the format of indices using a template
  3. Use tuple-style indices for multi-dimensional arrays

Implementation Details

New Properties in ArrayDecorator

  • showIndices: Boolean to control if indices are displayed (default: false)
  • indicesFormat: String template for formatting indices (default: "{index}: {value}")
  • useTupleIndices: Boolean to enable tuple-style indices (default: false)

UI Changes in ArrayDecoratorEditor

  • Added "Show indices" checkbox
  • Added dropdown for selecting index format with predefined templates
  • Added "Use tuple indices" checkbox for multi-dimensional arrays
  • Added help text explaining format placeholders

Localization

  • Added appropriate bundle properties in randomness.properties
  • Added help text explaining the format template options

Example Outputs

With this feature, users can generate arrays in different formats, like:

  1. Default array (no indices):
    ["foo", "bar", "quz"]
  2. With standard indices:
    [0: "foo", 1: "bar", 2: "quz"]
  3. With JSON-style indices:
    ["0": "foo", "1": "bar", "2": "quz"]
  4. With tuple indices:
    [(0,0): "foo", (0,1): "bar", (0,2): "quz"]
  5. Custom formats (e.g., {index}={value}):
    [0="foo", 1="bar", 2="quz"]

Testing

  • Added unit tests for standard indices display
  • Added unit tests for the tuple indices display
  • Added tests for various format templates
  • Added UI tests for the new controls

@TheRGuy9201
Copy link
Contributor Author

Hi @fwdekker !! I don't know why this is showing as required verified signatures; no previous ones have shown this. Please help me resolve this issue. I have done the required modification with respect to the mentioned issue number

@fwdekker
Copy link
Owner

fwdekker commented Jun 12, 2025

Don't worry about the signatures stuff. I assume it's because I enabled a feature on this repo that requires all commits to be signed. (This page explains what signing a commit is and how it is done.) I'll probably disable that requirement, but even if I don't, I'm not suddenly going to reject your PR because of it!

At a first glance, your PR looks very good! Thank you for the effort :-) I don't really have a lot of time on my hands to do an in-depth review right now, but once I do (later this week? after next week? not sure), I'll let you know right away!

@fwdekker fwdekker self-assigned this Jun 12, 2025
@fwdekker fwdekker added the feature New feature or request label Jun 12, 2025
@fwdekker fwdekker changed the title Fixed the numbering of array element issue Implement numbering of array element issue Jul 16, 2025
@fwdekker fwdekker changed the title Implement numbering of array element issue Implement numbering of array elements Jul 16, 2025
@fwdekker
Copy link
Owner

It looks good! I've re-written some parts, most importantly combining all settings you added into a single setting, but in the end the core functionality is the same. :-)

@fwdekker fwdekker merged commit a6657de into fwdekker:main Jul 17, 2025
3 of 4 checks passed
@fwdekker fwdekker mentioned this pull request Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants