mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
PY-61639 Move PyTrailingBlankLinesPostFormatProcessor to python.syntax.core
GitOrigin-RevId: a33777ac12163807f1395cbb8b03c58df506c3cf
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2c7f5b4b32
commit
d7630f0ef5
@@ -67,7 +67,6 @@
|
||||
implementationClass="com.jetbrains.python.psi.impl.references.PyKeywordPatternManipulator"/>
|
||||
<lang.parserDefinition language="Python" implementationClass="com.jetbrains.python.PythonParserDefinition"/>
|
||||
|
||||
<postFormatProcessor implementation="com.jetbrains.python.formatter.PyTrailingBlankLinesPostFormatProcessor"/>
|
||||
<postFormatProcessor implementation="com.jetbrains.python.formatter.PyFromImportPostFormatProcessor"/>
|
||||
<lang.lineWrapStrategy language="Python" implementationClass="com.jetbrains.python.formatter.PyLineWrapPositionStrategy"/>
|
||||
|
||||
|
||||
@@ -20,5 +20,6 @@
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.core.impl" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -11,5 +11,6 @@
|
||||
|
||||
<lang.formatter language="Python" implementationClass="com.jetbrains.python.formatter.PythonFormattingModelBuilder"/>
|
||||
<preFormatProcessor implementation="com.jetbrains.python.formatter.PyPreFormatProcessor"/>
|
||||
<postFormatProcessor implementation="com.jetbrains.python.formatter.PyTrailingBlankLinesPostFormatProcessor"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -10,7 +10,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.impl.source.codeStyle.PostFormatProcessor;
|
||||
import com.jetbrains.python.PythonLanguage;
|
||||
import com.jetbrains.python.psi.PyUtil;
|
||||
import com.jetbrains.python.ast.impl.PyUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public final class PyTrailingBlankLinesPostFormatProcessor implements PostFormat
|
||||
|
||||
// Do not add extra blank line in an empty file
|
||||
if (!realWhitespace.equals(desiredWhitespace) && (whitespaceRange.getStartOffset() != 0 || desiredWhitespace.isEmpty())) {
|
||||
TextRange updatedRange = PyUtil.updateDocumentUnblockedAndCommitted(pyFile, document -> {
|
||||
TextRange updatedRange = PyUtilCore.updateDocumentUnblockedAndCommitted(pyFile, document -> {
|
||||
document.replaceString(whitespaceRange.getStartOffset(), whitespaceRange.getEndOffset(), desiredWhitespace);
|
||||
return TextRange.from(whitespaceRange.getStartOffset(), desiredWhitespace.length());
|
||||
});
|
||||
Reference in New Issue
Block a user