Skip to content

.properties <-> .yml converter #739

Closed

Description

@javahacks

A command to automatically convert properties to YAML files (and vice versa) would be very handy.

Activity

  1. BoykoAlex commented on Feb 18, 2022

    @BoykoAlex
    Contributor

    Is this the request for Spring Boot Tools for vscode plugin?

  2. javahacks commented on Feb 18, 2022

    @javahacks
    Author

    Yes just a simple command that can be triggered from within the editor or context menu:

    image

  3. added
    for: eclipse
    for: vscode
    and removed on Mar 23, 2022
  4. martinlippert commented on Mar 24, 2022

    @martinlippert
    Member

    Here is another related feature request to have yml -> properties convention: spring-attic/spring-ide#331.

    It looks to me like we have three parts of this:

    • convert properties -> yml
    • convert yml -> properties
    • make both available in Eclipse as well as VSCode

    So this sounds to me like we should move the existing implementation for converting properties -> yml into the language server and make it available via a command to the client. Then, we could serve this as menu item / command in the various clients. Maybe the command can be generic in terms of which conversion should happen so that we can use the same command with different params for converting properties -> yml and then, down the line, for yml -> properties as well (so that the command is on the level of "convert" and the params specify the "to" format maybe. The input file would/could determine the "from" format.

  5. martinlippert commented on Mar 24, 2022

    @martinlippert
    Member

    Another thought here: If we allow the conversion to change the existing file (rename + content conversion), we would need to make sure that the conversion is exact and nothing gets lost in the conversion. This might be hard to achieve.

    As a consequence, we could also always create a new file (in addition to the existing one) and put the converted content in the new file without deleting the existing file. That would prevent the user from loosing something in case the conversion is not fully complete or missed something.

    We could also add a preference for this to switch between the modes ("delete file after property conversion") that would be disabled at the beginning and users could enable this if they think the old file should always be deleted.

  6. added this to the 4.15.0.RELEASE milestone on Mar 24, 2022
  7. manueljordan commented on Mar 25, 2022

    @manueljordan

    Has a lot of sense what you are proposing.

    In that way keeping the 2 files, the original and converted. Is assumed that in Spring Boot exists a priority about what file to choice if exists both with the same name but with different extension (.properties/.yml/.yaml). But it is other history and is assumed the developer knows what to do - either keep both files or delete the former when the latter was generated from the former (manually or automatically according with your propose).

  8. removed this from the 4.15.0.RELEASE milestone on Jul 1, 2022
  9. 15 remaining items

  10. manueljordan commented on Mar 26, 2024

    @manueljordan

    @BoykoAlex thanks for the quick update for Windows, pls let me know when is ready/built the new installer - it about to wait 1.5hrs

    Thanks for giving it a spin :-)

    Np - I enjoy this IDE

  11. manueljordan commented on Mar 26, 2024

    @manueljordan

    Report II

    Working with the installer for Linux (Ubuntu and Fedora):

    • spring-tool-suite-4-4.22.1.202403261702-SNAPSHOT-e4.32.0-linux.gtk.x86_64.tar.gz

    Unpacked and nothing more done prior to start it.

    Same instructions as indicated for Windows experience, it works fine, but appears the following:

    sts4-01

    sts4-02

    The warning message is the same for the three points

    And just in case, that Warning message appeared just once in Windows too, but not anymore, it remains in Linux/Ubuntu. I am assuming it would happen and should remain as in Linux, it based with the new installer

    As summary:

    • From .properties to .yaml works and the former file is deleted and replaced by the latter (and the message warning appears)
    • From .yaml to .properties works and the former file is deleted and replaced by the latter

    Thanks to your quick patch and I did do realize and confirmed that any comment disappears. And finally:

    • all the properties are sorted alphabetically
    • Any empty line dissappears too
  12. manueljordan commented on Mar 26, 2024

    @manueljordan

    It seems it is almost completed (I must re-test Windows), but I did do realize the following.

    1. After to did do a conversion, if within the opened file is do right click, appears the context menu as expected, but is enabled the item about Undo Ctrl + Z and it throws an error if is executed. Should be enabled that item/option?
    2. For any conversion scenario, all the properties keys are sorted alphabetically. But if from the scratch prior to do any conversion (take as reference my original .properties file), how is expected to sort that content? If within the opened file is done right click to open the context menu, there is no option to reach this goal. Pls confirm if once solved this Issue of conversion - I should create a new issue to request this feature.

    Thanks for your understanding

  13. BoykoAlex commented on Mar 26, 2024

    @BoykoAlex
    Contributor

    @manueljordan build has succeeded and ready to for testing

  14. manueljordan commented on Mar 27, 2024

    @manueljordan

    @BoykoAlex it works fine now, same behavior as Linux.

  15. BoykoAlex commented on Mar 27, 2024

    @BoykoAlex
    Contributor

    @manueljordan awesome!!! Thanks very much for testing!-) I'm moving the refactoring logic on the Boot LS side now to make yaml <-> props conversions available in both Eclipse and VSCode (and Theia therefore).

  16. manueljordan commented on Mar 27, 2024

    @manueljordan

    @BoykoAlex no problem :) - let me know your thoughts about points 1 and 2.

  17. BoykoAlex commented on Mar 27, 2024

    @BoykoAlex
    Contributor

    @manueljordan Regarding the two points:

    1. Is this about performing "Undo" action once conversion is applied? I did notice that it refuses to execute with a warning dialog that renamed file has been changed etc. Looks like this was the initial limitation with props -> yaml conversion. I'd treat this as a separate issue and curious if it is Eclipse only issue.
    2. I observer this only with props -> yaml. The yaml -> props seems to keep the initial order. I'll look into it but consider it as a low priority things which could factored out in a separate issue.
  18. manueljordan commented on Mar 27, 2024

    @manueljordan

    Thanks @BoykoAlex

    Understood. It seems they are candidates to create two new issues. And even would exist a 3rd one, it to suggest and apply a refactoring to solve the mentioned warning messages shown in the .yaml files - what do you think?

  19. BoykoAlex commented on Mar 27, 2024

    @BoykoAlex
    Contributor

    @manueljordan I'd create 2 additional issues once this issue is resolved as there is a chance to resolve them once conversion is an LS command. Is the 3rd issue about warnings/errors inside of the produced yaml files in a form of comments?

  20. manueljordan commented on Mar 27, 2024

    @manueljordan

    @BoykoAlex

    Is the 3rd issue about warnings/errors inside of the produced yaml files in a form of comments?

    Yes, about that

  21. BoykoAlex commented on Mar 28, 2024

    @BoykoAlex
    Contributor

    Pushed in the Boot LS based yaml <-> props conversion. It is now available on both VSCode and Eclipse. I was able to somewhat maintain the order of keys for props -> yaml conversion. The undo still didn't work properly in Eclipse therefore in Eclipse you'd be only able to create new file without replacing the old. The old file could be replaced in VSCode if preference setting for replacing the old file is on (by default it is off). The change is: aed2127

  22. manueljordan commented on Mar 28, 2024

    @manueljordan

    I was able to somewhat maintain the order of keys for props -> yaml conversion.

    Sounds great.

    The undo still didn't work properly in Eclipse therefore in Eclipse you'd be only able to create new file without replacing the old.

    Two files in parallel, right? .properties and .yaml?

  23. BoykoAlex commented on Mar 28, 2024

    @BoykoAlex
    Contributor

    @manueljordan Exactly - in the same folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetheme: property-editing-supporttype: enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions