Django: Extract Django/Jinja2 commons

GitOrigin-RevId: 3f6bb7b7cd80cbf6007e1930d4d018e1b1cff44a
This commit is contained in:
Alexey Sedunov
2022-09-23 10:47:37 +02:00
committed by intellij-monorepo-bot
parent f148162c19
commit c443410d79
19 changed files with 30 additions and 22 deletions

View File

@@ -69,6 +69,10 @@ class IntellijIconClassGeneratorConfig : IconsClasses() {
"intellij.grazie.core" -> IntellijIconClassGeneratorModuleConfig(className = "GrazieIcons", packageName = "com.intellij.grazie.icons")
"intellij.sh.core" -> IntellijIconClassGeneratorModuleConfig(className = "ShIcons", packageName = "com.intellij.sh")
"intellij.python.django.core" -> IntellijIconClassGeneratorModuleConfig(
className = "DjangoIcons",
packageName = "com.jetbrains.django"
)
else -> super.getConfigForModule(moduleName)
}
}

View File

@@ -20,5 +20,6 @@
<orderEntry type="module" module-name="intellij.platform.inspect" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.util.jdom" />
<orderEntry type="module" module-name="intellij.python.community.core.impl" />
</component>
</module>

View File

@@ -7,8 +7,12 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="intellij.python.community" exported="" />
<orderEntry type="module" module-name="intellij.platform.analysis.impl" exported="" />
<orderEntry type="module" module-name="intellij.python.psi" />
<orderEntry type="module" module-name="intellij.platform.analysis.impl" />
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
<orderEntry type="module" module-name="intellij.regexp" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="module" module-name="intellij.python.psi.impl" />
<orderEntry type="module" module-name="intellij.python.sdk" />
</component>
</module>

View File

@@ -33,7 +33,7 @@ import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.psi.resolve.*
import com.jetbrains.python.psi.stubs.PyModuleNameIndex
import com.jetbrains.python.psi.types.TypeEvalContext
import com.jetbrains.python.sdk.PythonSdkType
import com.jetbrains.python.sdk.PySdkUtil
import java.util.*
@@ -124,7 +124,7 @@ fun QualifiedName.getElementAndResolvableName(context: QNameResolveContext, stop
var psiDirectory: PsiDirectory? = null
var resolveContext = context.contextAnchor.qualifiedNameResolveContext?.copyWithMembers() ?: return null
if (PythonSdkType.getLanguageLevelForSdk(context.sdk).isPy3K || context.allowInaccurateResult) {
if (PySdkUtil.getLanguageLevelForSdk(context.sdk).isPy3K || context.allowInaccurateResult) {
resolveContext = resolveContext.copyWithPlainDirectories()
}

View File

@@ -9,7 +9,6 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.util.QualifiedName;
import com.intellij.util.PathUtil;
import com.jetbrains.python.psi.PyStringLiteralCoreUtil;
import com.jetbrains.python.psi.PyStringLiteralUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -106,7 +105,7 @@ public final class PythonStringUtil {
public static String replaceLastSuffix(String s, String separator, String newElementName) {
Pair<String, String> quotes = null;
if (PyStringLiteralUtil.isQuoted(s)) {
if (PyStringLiteralCoreUtil.isQuoted(s)) {
quotes = PyStringLiteralCoreUtil.getQuotes(s);
s = PyStringLiteralCoreUtil.stripQuotesAroundValue(s);
}

View File

@@ -12,5 +12,6 @@
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.util.ui" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="module" module-name="intellij.platform.analysis" />
</component>
</module>

View File

@@ -100,4 +100,17 @@ public class PyStringLiteralCoreUtil {
return text.substring(quotes.first.length(), text.length() - quotes.second.length());
}
/**
* Handles unicode and raw strings
*
* @return false if no quotes found, true otherwise
* sdfs -> false
* ur'x' -> true
* "string" -> true
*/
public static boolean isQuoted(@Nullable String text) {
return text != null && getQuotes(text) != null;
}
}

View File

@@ -33,6 +33,5 @@
<orderEntry type="module" module-name="intellij.platform.lvcs" />
<orderEntry type="module" module-name="intellij.platform.ide.core.impl" />
<orderEntry type="module" module-name="intellij.platform.util.jdom" />
<orderEntry type="module" module-name="intellij.python.community.core.impl" />
</component>
</module>

View File

@@ -68,19 +68,6 @@ public final class PyStringLiteralUtil extends PyStringLiteralCoreUtil {
PyTokenTypes.FSTRING_START == lexer.getTokenType();
}
/**
* Handles unicode and raw strings
*
* @return false if no quotes found, true otherwise
* sdfs -> false
* ur'x' -> true
* "string" -> true
*/
public static boolean isQuoted(@Nullable String text) {
return text != null && getQuotes(text) != null;
}
/**
* Returns the range of the string literal text between the opening quote and the closing one.
* If the closing quote is either missing or mismatched, this range spans until the end of the literal.

View File

@@ -22,7 +22,6 @@ import com.intellij.util.IncorrectOperationException;
import com.jetbrains.python.psi.PyElementGenerator;
import com.jetbrains.python.psi.PyStringLiteralCoreUtil;
import com.jetbrains.python.psi.PyStringLiteralExpression;
import com.jetbrains.python.psi.PyStringLiteralUtil;
import org.jetbrains.annotations.NotNull;
public class PyStringLiteralExpressionManipulator extends AbstractElementManipulator<PyStringLiteralExpressionImpl> {
@@ -57,7 +56,7 @@ public class PyStringLiteralExpressionManipulator extends AbstractElementManipul
String newContent) {
final String newText = range.replace(prevText, newContent);
if (PyStringLiteralUtil.isQuoted(newText)) {
if (PyStringLiteralCoreUtil.isQuoted(newText)) {
return newText;
}

View File

@@ -48,5 +48,6 @@
<orderEntry type="module" module-name="intellij.platform.ml" scope="TEST" />
<orderEntry type="library" scope="TEST" name="kotlinx-coroutines-jdk8" level="project" />
<orderEntry type="library" scope="TEST" name="jetbrains.kotlinx.coroutines.test" level="project" />
<orderEntry type="module" module-name="intellij.python.community.core.impl" scope="TEST" />
</component>
</module>