Skip to content

Ansible Support #2370

Open
Open
@fourjay

Description

@fourjay

This more properly belongs in a discussion forum, but as near as I can tell, github issues is the de-facto discussion forum (I apologize if there is a better place).

I'm working on adding better (read "link traversing") ansible support.
The primary use case, vars: and set_fact: should end up targets when the var is referenced later.

So far I've worked out:

# keywords to ignore
--regex-ansible=/^\s*(become|set_fact|args|shell|remote|repo|warn|debug|include_tasks):.*///{placeholder}{exclusive}
--regex-ansible=/^\s*(register|creates|dest|mode|port|owner|state|force):.*///{placeholder}{exclusive}
--regex-ansible=/^\s*(become|set_fact|args|shell|remote|repo|warn|debug|include_tasks):.*///{placeholder}{exclusive}
--regex-ansible=/^\s*(register|creates|dest|mode|port|owner|state|force):.*///{placeholder}{exclusive}
# "empty" tag (typically a larger vertical task keyword
--regex-ansible=/^\s*[a-zA-x]+:$///{placeholder}{exclusive}

# match all keys that were not ignored previously
--regex-ansible=/^\s*([a-zA-Z_]+):.*/\1/v,var/

Basically:

  1. a longish list of keywords to ignore.
  2. a generic rule to capture the key part of yaml key: val statement.

This works (coupled with an iniconf rule to trim off :children from a section head).
When I find a variable, I can jump to a definition (my goal)
Are there recommendations for how to better handle this. Among other things the list of keywords is only my common keywords, and is quite incomplete.

I did try using the new mtables regex support, but ran into the issue of not being able to terminate a table/section. My instincts were to match an empty line, but (as I understand it) there's no way to match EOL in mtable.

FWIW, part of my reason for posting this ticket is to offer google a more useful answer for searches for ctags ansible then the answers aimed at generating a useful table of contents for Tagbar or similar vim utility, which are completely useless for tag linking

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions