-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
Improve dragging items from Scene Preview into source code #661
Conversation
The right-click action, that drops the node-path into your clipboard already provides close to the same utility of the drag-n-drop feature - only missing a `$`. To complement this and to add another QoL change, I refactored the drop-edit functionality to include a full `@onready` template. This will now create a variable name based on the node-name and provides the full convention, inspired by the same feature in the godot editor: godotengine/godot-proposals#4482
🤯 great Idea |
Added behavior for % syntax and also a few comments on why we check for the empty line there |
Will do. I am not too experienced with VsCode extensions - how would we test this automatically? It feels like the edgecases are starting to pile up and I would feel more comfortable with my changes if I would add a few tests on them |
Originally, we used and split the path of a node to get its name. This ran into issues with the root-node of a scene though, as a root node has no path. This logic has been replaced by directly getting the name of the node from its `label` attribute, which is now passed directly to the drag handler.
This extension does have a test suite, but I have no idea how to programmatically invoke behavior like dragging and dropping. Personally, I think what we have here is extremely straightforward and doesn't really need testing anyways. |
Alright then, not going to start a religious discussion on that 😄 |
Sounds good. I'll review this again later today and probably merge it. Thanks for starting this feature, I think it's a solid upgrade! |
Commit message:
The mentioned feature in the godot editor by default drops the $-import aswell, but allows dropping a full onready template when holding ctrl.
As far as I understand, VsCode does not allow fetching which keys the user may be pressing, so duplicating this feature 1:1 is not possible.
The extension already has amazing support for autocompleting $-imports in intellisense, so for me a big timesaver would be to be able to drag-n-drop the entire onready statement from the scene tree.
I have added this change as a reference implementation in this Pull Request. As far as I understand, there is no equivalent to this in C#, so I left the GetNode string there untouched.
Is this a feature to consider as the default? If not, would you be open to add it as a config option to the app?