|
34 | 34 | import org.jetbrains.annotations.NotNull;
|
35 | 35 |
|
36 | 36 | import java.util.*;
|
| 37 | +import java.util.function.BiConsumer; |
37 | 38 | import java.util.regex.Matcher;
|
38 | 39 | import java.util.regex.Pattern;
|
39 | 40 | import java.util.stream.Collectors;
|
@@ -148,7 +149,7 @@ public static Collection<TwigTypeContainer> resolveTwigMethodName(@NotNull PsiEl
|
148 | 149 | Collection<List<TwigTypeContainer>> previousElements = new ArrayList<>();
|
149 | 150 | previousElements.add(new ArrayList<>(type));
|
150 | 151 |
|
151 |
| - String[] typeNames = types.toArray(new String[types.size()]); |
| 152 | + String[] typeNames = types.toArray(new String[0]); |
152 | 153 | for (int i = 1; i <= typeNames.length - 1; i++ ) {
|
153 | 154 | type = resolveTwigMethodName(type, typeNames[i], previousElements);
|
154 | 155 | previousElements.add(new ArrayList<>(type));
|
@@ -252,7 +253,16 @@ public static Map<String, PsiVariable> collectScopeVariables(@NotNull PsiElement
|
252 | 253 |
|
253 | 254 | TwigFileVariableCollectorParameter collectorParameter = new TwigFileVariableCollectorParameter(psiElement, visitedFiles);
|
254 | 255 | for(TwigFileVariableCollector collector: TWIG_FILE_VARIABLE_COLLECTORS.getExtensions()) {
|
255 |
| - collector.collect(collectorParameter, globalVars); |
| 256 | + Map<String, Set<String>> globalVarsScope = new HashMap<>(); |
| 257 | + collector.collect(collectorParameter, globalVarsScope); |
| 258 | + |
| 259 | + // @TODO: resolve this in change extension point, so that its only possible to provide data and dont give full scope to break / overwrite other variables |
| 260 | + globalVarsScope.forEach((s, strings) -> { |
| 261 | + globalVars.putIfAbsent(s, new HashSet<>()); |
| 262 | + globalVars.get(s).addAll(strings); |
| 263 | + }); |
| 264 | + |
| 265 | + // @TODO: provide merge for multiple matches |
256 | 266 | collector.collectPsiVariables(collectorParameter, controllerVars);
|
257 | 267 | }
|
258 | 268 |
|
|
0 commit comments