generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Feature/Automated Key Naming Convention Suggestion for Localize-It Action #399
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New methods have been added to convert keys to either camel or snake case depending on a boolean flag. These methods are used to format the text that is input into the Add Dialog in 'LocalizeItAction' class. This improves the versatility of key handling within the project.
Implemented a new setting, `getCaseFormat`, in the `ProjectSettings` interface, returning the naming convention used. Also extended corresponding implementations (`DefaultPreset`, `VueI18nPreset`, `ReactI18NextPreset`, `SettingsTestPreset`) to return `NamingConvention.CAMEL_CASE`. A new enum `NamingConvention` was created for this, with options `SNAKE_CASE` and `CAMEL_CASE`.
This update enables the user to specify a key naming convention (Camel Case or Snake Case) for extracted translations. This option is made available in the settings panel, and has been included in the project-specific configuration and state management for the project settings component.
… to NamingConvention This commit adds a new attribute, `caseFormat`, to the `ProjectSettingsState` class. It also introduces a static method `fromSelector` in the `NamingConvention` class to transform a string into a NamingConvention enum. The transformation in `ProjectSettingsComponentState` has been updated to use this new method.
Refactored convertKeyToNamingCase method to include project-specific naming conventions. Now, it adapts to the naming convention specified in the project settings. This change enhances flexibility by catering to individual project preferences.
Updated naming convention features by simplifying key case formatter construction and expanding the naming convention enum. Also performed a refactor to layout and formatting across various files for improved readability. Added new test cases to validate the update to naming convention.
Moved key naming convention conversion logic into NamingConvention enum. This simplifies the code in LocalizeItAction and makes the conversion function easily reusable. Also added support for uppercase snake and camel cases.
Moved `NamingConvention` from the settings package to a new settings.presets package. This involved modifying various import statements across the application and updating methods that utilised this enum. Increased the `KeyCaseFormater` minimum and preferred width to 200 for better UI rendering.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #399 +/- ##
==========================================
+ Coverage 31.32% 31.41% +0.09%
==========================================
Files 104 108 +4
Lines 1874 1897 +23
Branches 317 323 +6
==========================================
+ Hits 587 596 +9
- Misses 1215 1235 +20
+ Partials 72 66 -6 ☔ View full report in Codecov by Sentry. |
The main modification is in `NamingConvention.java` replacing the enumeration `CAMEL_CASE_UPPERCASE` with `PASCAL_CASE`. This change can help to improve the readability of the code by reducing the verbosity of names and ensure convention consistency. Also, a new test file `NamingConventionTest.java` has been introduced to ensure correctness and stability of the code against these modifications.
@marhali check this out |
Thanks for your contribution 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Description
This pull request introduces an enhancement to the Localize-It Action, addressing the manual adjustment requirement for key naming conventions during string extraction. The implemented feature automates key naming convention suggestions, significantly improving user experience and code consistency.
Changes Implemented:
Automated Key Naming Convention Suggestions: Integrated functionality to automatically suggest key naming conventions based on user preferences or project settings.
Support for CamelCase , PascalCase and Snake_case: Initial implementation covers CamelCase and Snake_case naming conventions.
Future Considerations:
Next Steps:
Show Case:
Before
After