-
Notifications
You must be signed in to change notification settings - Fork 621
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
base: master
Are you sure you want to change the base?
Conversation
394d702
to
2b38861
Compare
2b38861
to
e249c82
Compare
... but only when directly on the name of the struct when it is declared.
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 _
input.child_token(SyntaxKind::Identifier) | ||
} | ||
|
||
fn main_identifier_text(input: &i_slint_compiler::parser::SyntaxNode) -> String { |
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.
Looks like i_slint_compiler::parser::identifier_text
Only that it normalize _ and -, which i think should be done.
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.
Ah! I was almost sure there was something.... I was looking for something like that starting with parse_
though :-)
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
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.