-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add support for extracting styles to tss #1177
Add support for extracting styles to tss #1177
Conversation
…o a tss file Implements a code action that allows extract styles from an xml node into a tss document. It can be triggered using the usual refactor shortcut, menu item, or lightbulb and supports running on an entire line or just the selected properties. Some known todos are: * Support nested properties (font stuff) * Multiline properties * Better handling of class merging * Tests!
This is awesome! Regarding nested properties: All that we know are font and center (x and y). @m1ga Do you maybe have more? I wonder if they are somehow registered in Alloy already somewhere. |
Nice feature 👍 @hansemannn sorry, don't know. Didn't even know that the font part was merged 😄 Not using that many inline styles at all. It looks like it is this PR tidev/alloy#765 and I would say that it supports all |
Yep, handling them in general (detect a |
Some more small improvements (can definitely be moved to a later stage as it's super low prio):
|
@hansemannn I've ticked off everything in that list other than the spaces/tabs one, that'll need some digging into the vscode docs to see if I can get that information or if there's a way to have them handle it when applying the edits. |
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.
The code looks good, the changes work very well! Just to be sure: Is the version bumped automatically, or should it be adjusted in the package.json? EDIT: Okay, it seems like the CI does that, cool!
* build: update node related build settings to use newer syntax * feat(providers/codeaction): allow extracting styles from an xml tag to a tss file Implements a code action that allows extract styles from an xml node into a tss document. It can be triggered using the usual refactor shortcut, menu item, or lightbulb and supports running on an entire line or just the selected properties. Some known todos are: * Support nested properties (font stuff) * Multiline properties * Better handling of class merging * Tests! * feat: handle extracting object style properties * fix: handle multi-line strings * fix: allow percentages in values * fix: handle not wrapping numbers, Alloy, Titanium APIs, wrap using correct quotes for file * fix: handle “$.args” in attributes, show number-properties without quotes * chore: add comma after new property * fix: fix typo * chore: remove last comma --------- Co-authored-by: Hans Knöchel <h.knoechel@lambus.com>
# [1.3.0](v1.2.1...v1.3.0) (2023-10-29) ### Features * add support for extracting styles to tss from views ([#1177](#1177)) ([67fa837](67fa837))
Implements a new refactoring action for views that allows extracting the properties from a tag and inserting them into the related TSS document. This can be triggered via the usual refactor shortcut, menu item, or lightbulb.
Some known todos (hence draft status) are:
Support nested properties (font only?)Multiline propertiesA demonstration is below, it first demonstrates extracting a select group of properties and then extract properties from the current line the cursor is on.
Screen.Recording.2023-10-17.at.22.11.17.mov