-
Notifications
You must be signed in to change notification settings - Fork 638
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
vscode: add "wrap in element" code action #3420
Conversation
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.
Nice, thank you!
Co-authored-by: Olivier Goffart <olivier@woboq.com>
A cool feature, indeed. Thanks for implementing it. |
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.
Still some CI failures that seem to be related to the change.
@@ -621,7 +621,7 @@ fn set_binding_on_known_property( | |||
|
|||
// Find the indentation of the element itself as well as the indentation of properties inside the | |||
// element. Returns the element indent followed by the block indent | |||
fn find_element_indent(element: &ElementRc) -> Option<String> { | |||
pub fn find_element_indent(element: &ElementRc) -> Option<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.
This should probably get moved to a more discoverable place, now that it got promoted to a generic utility function.
That can be a separate patch and does not need to be done in here.
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.
Sounds good. The comment looks outdated too. I can follow up with a separate PR.
thanks! |
A little productivity booster for editing .slint files in VS Code:
vscode-wrap-in-element.mov
Notice that LSP code actions and workspace edits do not yet natively support snippets or allow specifying the cursor position (microsoft/language-server-protocol#724), which is necessary for pre-selecting "element" for conveniently typing in the desired type name. This limitation is worked around by registering an experimental "snippet text edit" capability for the client, guarding the snippet code action with a capability check on the server side, and finally, detecting and inserting the snippet on the client side (inspired by rust-analyzer and Dart-Code).