List of twig variables in file

Is there a way to see all the Twig Variable in a twig file?

I am looking for a list of all the variable that are between {%%} and also {{}}.

Is there such a function?

 

Thanks

0
2 comments

Looks like, there is a pretty close request exists already:

https://youtrack.jetbrains.com/issue/WI-15166

 

And on request for Twig variable refactoring as well:

https://youtrack.jetbrains.com/issue/WI-24990

 

I was wondering if you could check it and confirm that this is related to your concern.

0
Avatar
Permanently deleted user
Thanks for looking, but no, it's not what I need.
 
I have many uses for this, but in this case I want to paste the list of vars into an email and explain to my colleagues what each var is used for.
 
for example, suppose I have this:
 
Lorem ipsum dolor sit amet, consectetur adipiscing elit, {{  myFirstVar }}sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris{{  myVar2 }} nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat {{  myVar4 }}nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui{{  myVar3 }} officia deserunt mollit anim id est laborum.  
 
I would want a list like:
 
myFirstVar
myVar2
myVar3
myVar4
 
 
Also, I need to enter each var into a db table with other information.
 
So it won't be using it in a programming sense. 
 
I know that I could highlight all the vars using regex.  Is it possible to copy all the highlighted text snippets?
 
Thanks for your help.
0

Please sign in to leave a comment.