-
Notifications
You must be signed in to change notification settings - Fork 627
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
Rename structs, enums and components #7143
Conversation
2b38861
to
e249c82
Compare
e249c82
to
47188ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test which contains different variation of -
and _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also would make sense to have a test that checks that symbols that shouldn't be replace don't get replaces.
enum XyZ { Foo }
struct Abc { Foo: Xyz }
struct Foo { }
component T1 {
property <Abc> Foo;
function f() {
Foo.Foo == Xyz.Foo;
}
}
component T2 {
function Foo(Foo: int) { Foo + 1; }
function F() { Foo() }
}
component T3 {
Foo := Rectangle { }
}
and so on.
Todo: * More tests * as suggested by @ogoffart in slint-ui#7143 * Rename based on InternalName and ExportName
Todo: * More tests * as suggested by @ogoffart in slint-ui#7143 * Rename based on InternalName and ExportName
47188ce
to
9a8f323
Compare
Thinking about this a bit more: I do need to normalize names when looking for places I need to change. I do not want to normalize when actually replacing the text though. |
9a8f323
to
3412297
Compare
New and improved: With tests for renaming types with names that normalize :-) |
db3db0c
to
714610c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a bunch of -
and _
in the tests that have exports as well.
714610c
to
7c6e6c3
Compare
... and with export/import tests full of |
Nice feature |
... but only when directly on the name of the struct when it is declared.
7c6e6c3
to
16f054b
Compare
The last push is just a rebase as Github would not let me merge the old state :-/ |
This adds renaming of structs... in a limited fashion though: You have to be in the declaration of the component/struct or enum you want to rename.
This PR handles significantly more corner cases than the old component renaming code we used to have and comes with a few more tests to cover those.
Up next and building on this code: Trigger renaming based on any use of any of these types.