Skip to content

Commit

Permalink
Fix refreshing {templateType} variables when macro changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixafy committed May 5, 2024
1 parent ceb027b commit a50e490
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/nette/latte/psi/LatteFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,17 @@ public void subtreeChanged() {
variables = null;
sortedVariables = null;
templateType = null;
templateTypes = null;
contextData = null;
contexts = null;
linkResolver.reset();
}

public void resetTemplateTypes() {
templateTypes = null;
templateType = null;
}

public @NotNull List<LattePhpCachedVariable> getCachedVariables() {
loadVariables();
assert sortedVariables != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.nette.latte.php.LattePhpUtil;
import org.nette.latte.php.NettePhpType;
import org.nette.latte.psi.LatteElementFactory;
import org.nette.latte.psi.LatteFile;
import org.nette.latte.psi.elements.LattePhpClassUsageElement;
import org.nette.latte.psi.impl.LattePhpElementImpl;
import org.nette.latte.utils.LatteUtil;
Expand All @@ -29,6 +30,12 @@ public LattePhpClassUsageElementImpl(@NotNull ASTNode node) {
public void subtreeChanged() {
super.subtreeChanged();
reset();
if (isTemplateType()) {
LatteFile file = getLatteFile();
if (file != null) {
file.resetTemplateTypes();
}
}
}

@Override
Expand Down

0 comments on commit a50e490

Please sign in to comment.