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

"Go to Definition" for import/included resources (roles/playbook/etc) #1814

Open
jouve opened this issue Feb 7, 2025 · 1 comment
Open
Labels
feature New feature or request

Comments

@jouve
Copy link

jouve commented Feb 7, 2025

Problem

Image

"Go to Definition" does not work (import_playbook in this example, but it applies to other import/include)

Solution

"Go to Definition" open the imported/included yaml

- ansible.builtin.import_playbook: dir/foo.yml # F12 on foo.yml opens foo.yml
- ansible.builtin.include_role:
        name: bar                                            # F12 on bar opens roles/bar/tasks/main.yml
- ansible.builtin.include_role:
        name: bar                                            
        tasks_from: baz                                    # F12 on baz opens roles/bar/tasks/baz.yml
...

Alternatives

tried https://marketplace.visualstudio.com/items?itemName=BlauweLucht.ansible-go-to-definition, but it would be nice have this feature by default

Additional context

No response

@jouve jouve added feature New feature or request new labels Feb 7, 2025
@jouve jouve changed the title "Go to Definition" for import/include resources (roles/playbook/etc) "Go to Definition" for import/included resources (roles/playbook/etc) Feb 7, 2025
@alisonlhart alisonlhart removed the new label Feb 12, 2025
@alisonlhart
Copy link
Contributor

There are some limitations we have on retrieving context that makes this complicated. However, we are interested in looking into this further, especially with the existence of the marketplace item you linked.

Additionally, the extension currently is very limited on what it considers "ansible" files by default, since many of our functions depend on "ansible" files being playbooks. While we are evaluating this, that will need to change before we can move ahead with this.

I will leave this open for now, though there is no timeline on if/when we will be able to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants