* @param sourceModule
*/
public List<TemplateField> findTemplateVariables(ISourceModule sourceModule, String varName) {
String viewPath = PathUtils.createViewPathFromTemplate(sourceModule, false);
IDLTKSearchScope scope = SearchEngine.createSearchScope(sourceModule.getScriptProject());
ISearchEngine engine = ModelAccess.getSearchEngine(SymfonyLanguageToolkit.getDefault());
if (scope == null || engine == null) {
return null;
}
final List<TemplateField> variables = new ArrayList<TemplateField>();
final IElementResolver resolver = ModelAccess.getElementResolver(SymfonyLanguageToolkit.getDefault());
// handle twig variables
if (!varName.startsWith("$")) {
varName = "$" + varName;
}
engine.search(ISymfonyModelElement.TEMPLATE_VARIABLE, viewPath, varName, 0, 0, 100, SearchFor.REFERENCES, MatchRule.EXACT, scope, new ISearchRequestor() {
@Override
public void match(int elementType, int flags, int offset, int length,
int nameOffset, int nameLength, String elementName,
String metadata, String doc, String qualifier, String parent,
ISourceModule sourceModule, boolean isReference) {