PY-72185 disable reparseable leaves by default for further investigation

GitOrigin-RevId: 87a1d99a80415128b303f2b0cb343afd2c939b6a
This commit is contained in:
Daniil Kalinin
2024-08-19 15:23:56 +02:00
committed by intellij-monorepo-bot
parent eaf0d8ef16
commit 7ccfd3772d
3 changed files with 18 additions and 5 deletions

View File

@@ -11,7 +11,7 @@
extensions="pyi"
implementationClass="com.jetbrains.python.pyi.PyiFileType"
fieldName="INSTANCE"/>
<registryKey key="python.ast.leaves.incremental.reparse" defaultValue="true"
<registryKey key="python.ast.leaves.incremental.reparse" defaultValue="false"
description="Enables incremental reparse for Python leaf elements (string literals, identifiers, comments)"/>
</extensions>
<extensionPoints>

View File

@@ -11,7 +11,7 @@
extensions="pyi"
implementationClass="com.jetbrains.python.pyi.PyiFileType"
fieldName="INSTANCE"/>
<registryKey key="python.ast.leaves.incremental.reparse" defaultValue="true"
<registryKey key="python.ast.leaves.incremental.reparse" defaultValue="false"
description="Enables incremental reparse for Python leaf elements (string literals, identifiers, comments)"/>
</extensions>
<extensionPoints>

View File

@@ -2,6 +2,7 @@
package com.jetbrains.python.parsing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.testFramework.ParsingTestUtil;
import com.jetbrains.python.fixtures.PyTestCase;
import org.jetbrains.annotations.NotNull;
@@ -11,6 +12,9 @@ import java.io.IOException;
public abstract class PythonIncrementalParsingTestCase extends PyTestCase {
private static final String STATEMENTS_REGISTRY_KEY = "python.statement.lists.incremental.reparse";
private static final String AST_LEAVES_REGISTRY_KEY = "python.ast.leaves.incremental.reparse";
protected @NotNull String getFileExtension() {
return ".py";
}
@@ -35,20 +39,29 @@ public abstract class PythonIncrementalParsingTestCase extends PyTestCase {
@NotNull String newTextFileBaseName,
boolean checkInitialTreeForErrors,
boolean checkFinalTreeForErrors) {
boolean statementListsRegistryFlag = Registry.is(STATEMENTS_REGISTRY_KEY);
boolean leavesRegistryFlag = Registry.is(AST_LEAVES_REGISTRY_KEY);
var sourceFileName = sourceFileBaseName + "/" + sourceFileBaseName + getFileExtension();
myFixture.configureByFile(sourceFileName);
var newTextFileName = sourceFileBaseName + "/" + newTextFileBaseName + ".new";
String newText;
try {
Registry.get(STATEMENTS_REGISTRY_KEY).setValue(true);
Registry.get(AST_LEAVES_REGISTRY_KEY).setValue(true);
newText = FileUtil.loadFile(new File(getTestDataPath(), newTextFileName)).replace("\r", "");
ParsingTestUtil.testIncrementalParsing(myFixture.getFile(), newText, getAnswersFilePath(),
checkInitialTreeForErrors, checkFinalTreeForErrors);
}
catch (IOException e) {
fail(e.getMessage());
throw new RuntimeException();
}
ParsingTestUtil.testIncrementalParsing(myFixture.getFile(), newText, getAnswersFilePath(),
checkInitialTreeForErrors, checkFinalTreeForErrors);
finally {
Registry.get(STATEMENTS_REGISTRY_KEY).setValue(statementListsRegistryFlag);
Registry.get(AST_LEAVES_REGISTRY_KEY).setValue(leavesRegistryFlag);
}
}
protected String getAnswersFilePath() {