Skip to content
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 autocompletion for scene unique nodes #4593

Open
KoBeWi opened this issue May 25, 2022 · 2 comments
Open

Add autocompletion for scene unique nodes #4593

KoBeWi opened this issue May 25, 2022 · 2 comments

Comments

@KoBeWi
Copy link
Member

KoBeWi commented May 25, 2022

Describe the project you are working on

A couple of big projects. I started adapting the scene unique nodes into them.

Describe the problem or limitation you are having in your project

Scene Unique Names are a cool feature and works really good. There is one minor gripe though - no autocompletion. When you type $, you get autocompletion for nodes on the scene. But it only includes full paths. If I have e.g. 10 unique nodes, at different levels in the scene, I can't easily type them; I need to copy the name at best, which might be problematic in big scenes.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

When typing $"%, script editor should list all unique nodes on the current scene, so they can be easily selected.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

When doing normal path autocompletion and % is used, fetch the list of unique node names in the current scene and list them for autocompletion.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Not really, although script editor plugins are a thing. Maybe.

Is there a reason why this should be core and not an add-on in the asset library?

It completes a cool existing feature.

@hsandt
Copy link

hsandt commented Sep 5, 2023

And of course, when using shorthand $% too (works when node names have no spaces in them).

I tried to auto-complete with full path from root, but even that didn't work: it only detected path for autoloaded singleton + child nodes (it makes sense, how could a script know in which scene context it can appear at runtime? but I think it used to work with the currently opened scene for convenience anyway)

image

so I cannot even use the trick of showing full path then deleting the part before. Copy-pasting the node name seems the fastest workaround.

And just a screenshot to illustrate the current case, where no auto-completion popup shows at all after adding %:

image

@aXu-AP
Copy link

aXu-AP commented Sep 6, 2024

I'm not sure what was the state of this when this issue was first written, but currently (4.3) situation is as follows:

  • $ gives suggestions for unique nodes, but they are in quotes (eg $ -> $"%MyNode") made a pr to fix this: Remove unneeded quotes from autocomplete % nodes godot#96666
  • % gives suggestions after you write first letter (eg %m -> %MyNode)
  • $% is a bit broken; it gives the same suggestions as $ operator, and also waits for extra letter (eg $%m -> $%"%MyNode" [note the extra %, which is a bug] or $%MyNonUniqueNode)
  • get_node works, no problems here (since the path is anyways in quotes).

So all in all, some support is there, but it's not perfect yet. It seems that godotengine/godot#85384 is where the current support came to be.

Another thing is, paths like %MyUniqueNode/Child aren't supported at all by autocompletion, altough I'm not sure how widely used nodepaths relative to unique nodes are...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants