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

Type and property renaming #3

Open
ctxppc opened this issue Jan 31, 2019 · 0 comments
Open

Type and property renaming #3

ctxppc opened this issue Jan 31, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ctxppc
Copy link
Owner

ctxppc commented Jan 31, 2019

Silica should try to re-associate localised string entries after a LocalisableString type (or a property thereof) has been renamed since the last run of the Silica tool. Currently any renames result in the previous localised string entries becoming disassociated (and marked with a “Unused” comment) and new (empty) localised string entries being created, requiring manual re-association.

Since Silica doesn’t retain source information and doesn’t participate in refactoring tools, it cannot know what renames have occurred. It can however heuristically determine what renames might have occurred by introspecting the unused localised string entries and trying to match them to newly created localised string entries. Silica should work pessimistically and only re-associate a localised string entry when either a single type, a single case, or a single property (across the whole codebase) has been renamed between runs of the Silica tool. In addition, it should emit a warning (once) notifying the developer that such re-association has been performed.

As an example, given the following code:

enum CarColour {
    case red
    case blue
}

Silica generates the following entries:

"CarColour.red" = "red";
"CarColour.blue" = "blue";

After renaming the type to CarColor (but no other LocalisableString type or a case or property thereof), Silica should generate the following entries:

"CarColor.red" = "red";
"CarColor.blue" = "blue";

and emit “warning: Silica re-associated string entries from type ‘CarColour’ to ‘CarColor’”.

@ctxppc ctxppc self-assigned this Jan 31, 2019
@ctxppc ctxppc added the enhancement New feature or request label Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant