File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed 
src/fr/adrienbrault/idea/symfony2plugin/templating/util Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -180,30 +180,30 @@ public static String getDomainTrans(PsiElement psiElement) {
180180 // search in twig project for regex 
181181 // check for better solution; think of nesting 
182182
183-  String  domainName  = null ;
184- 
185183 PsiElement  parentPsiElement  = psiElement .getParent ();
186184 if (parentPsiElement  == null ) {
187-  return  domainName ;
185+  return  null ;
188186 }
189187
190188 String  str  = parentPsiElement .getText ();
191189
192-  String  regex  = "\\ |\\ s?trans\\ s?\\ (\\ {.*?\\ },\\ s?['\" ](\\ w+)['\" ]\\ s?\\ )" ;
190+  // @TODO: in another life dont use regular expression to find twig parameter :) 
191+ 
192+  String  regex  = "\\ |\\ s*trans\\ s*\\ (\\ s*\\ {.*?\\ }\\ s*,\\ s*['\" ]([\\ w-]+)['\" ]\\ s*\\ )" ;
193193 Matcher  matcher  = Pattern .compile (regex ).matcher (str .replace ("\r \n " , " " ).replace ("\n " , " " ));
194194
195195 if  (matcher .find ()) {
196196 return  matcher .group (1 );
197197 }
198198
199-  regex  = "\\ |\\ s? transchoice\\ s? \\ (\\ d+\\ s? ,\\ s? \\ {.*?\\ },\\ s? ['\" ](\\ w+)['\" ]\\ s? \\ )" ;
199+  regex  = "\\ |\\ s* transchoice\\ s* \\ (\\ s* \\ d+\\ s* ,\\ s* \\ {.*?\\ }\\ s* ,\\ s* ['\" ]([ \\ w-] +)['\" ]\\ s* \\ )" ;
200200 matcher  = Pattern .compile (regex ).matcher (str .replace ("\r \n " , " " ).replace ("\n " , " " ));
201201
202202 if  (matcher .find ()) {
203203 return  matcher .group (1 );
204204 }
205205
206-  return  domainName ;
206+  return  null ;
207207 }
208208
209209 public  static  ArrayList <TwigMacro > getImportedMacros (PsiFile  psiFile ) {
                                 You can’t perform that action at this time. 
               
                  
0 commit comments