mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -306,6 +306,10 @@ target(name: "compile", description: "Compile module python") {
|
||||
patternset(refid: "resources.pt")
|
||||
type(type: "file")
|
||||
}
|
||||
fileset(dir: "${pluginHome}/psi-api/resources") {
|
||||
patternset(refid: "resources.pt")
|
||||
type(type: "file")
|
||||
}
|
||||
connectorPlugins.each {
|
||||
fileset(dir: "${pluginHome}/${it}/resources") {
|
||||
patternset(refid: "resources.pt")
|
||||
|
||||
+308
-380
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@ package com.jetbrains.python;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -187,7 +188,7 @@ public class PyNames {
|
||||
private static final BuiltinDescription _self_item_descr = new BuiltinDescription("(self, item)");
|
||||
private static final BuiltinDescription _self_key_descr = new BuiltinDescription("(self, key)");
|
||||
|
||||
public static final ImmutableMap<String, BuiltinDescription> BuiltinMethods = ImmutableMap.<String, BuiltinDescription>builder()
|
||||
private static final ImmutableMap<String, BuiltinDescription> BuiltinMethods = ImmutableMap.<String, BuiltinDescription>builder()
|
||||
.put("__abs__", _only_self_descr)
|
||||
.put("__add__", _self_other_descr)
|
||||
.put("__and__", _self_other_descr)
|
||||
@@ -260,7 +261,6 @@ public class PyNames {
|
||||
.put("__ne__", _self_other_descr)
|
||||
.put("__neg__", _only_self_descr)
|
||||
.put(NEW, new BuiltinDescription("(cls, *args, **kwargs)"))
|
||||
.put("__nonzero__", _only_self_descr)
|
||||
.put("__oct__", _only_self_descr)
|
||||
.put("__or__", _self_other_descr)
|
||||
//_BuiltinMethods.put("__path__", _only_self_descr);
|
||||
@@ -297,6 +297,20 @@ public class PyNames {
|
||||
.put("__xor__", _self_other_descr)
|
||||
.build();
|
||||
|
||||
public static ImmutableMap<String, BuiltinDescription> PY2_BUILTIN_METHODS = ImmutableMap.<String, BuiltinDescription>builder()
|
||||
.putAll(BuiltinMethods)
|
||||
.put("__nonzero__", _only_self_descr)
|
||||
.build();
|
||||
|
||||
public static ImmutableMap<String, BuiltinDescription> PY3_BUILTIN_METHODS = ImmutableMap.<String, BuiltinDescription>builder()
|
||||
.putAll(BuiltinMethods)
|
||||
.put("__bool__", _only_self_descr)
|
||||
.build();
|
||||
|
||||
public static ImmutableMap<String, BuiltinDescription> getBuiltinMethods(LanguageLevel level) {
|
||||
return level.isPy3K() ? PY3_BUILTIN_METHODS : PY2_BUILTIN_METHODS;
|
||||
}
|
||||
|
||||
// canonical names, not forced by interpreter
|
||||
public static final String CANONICAL_SELF = "self";
|
||||
public static final String BASESTRING = "basestring";
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
<lang.formatter language="ReST" implementationClass="com.jetbrains.rest.formatter.RestFormattingModelBuilder"/>
|
||||
<codeInsight.fillParagraph language="ReST" implementationClass="com.jetbrains.rest.actions.RestFillParagraphHandler"/>
|
||||
|
||||
<additionalTextAttributes scheme="Default" file="colorSchemes/RestDefault.xml"/>
|
||||
<additionalTextAttributes scheme="Darcula" file="colorSchemes/RestDarcula.xml"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.spellchecker">
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<list>
|
||||
<option name="REST.BOLD">
|
||||
<value>
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="REST.FIXED">
|
||||
<value>
|
||||
<option name="BACKGROUND" value="a3a08" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="REST.INLINE">
|
||||
<value>
|
||||
<option name="BACKGROUND" value="236423" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="REST.INTERPRETED">
|
||||
<value>
|
||||
<option name="BACKGROUND" value="15463c" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="REST.ITALIC">
|
||||
<value>
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
</value>
|
||||
</option>
|
||||
</list>
|
||||
@@ -0,0 +1,27 @@
|
||||
<list>
|
||||
<option name="REST.BOLD">
|
||||
<value>
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="REST.FIXED">
|
||||
<value>
|
||||
<option name="BACKGROUND" value="D9D9F0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="REST.INLINE">
|
||||
<value>
|
||||
<option name="BACKGROUND" value="EDFCED" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="REST.INTERPRETED">
|
||||
<value>
|
||||
<option name="BACKGROUND" value="CADABA" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="REST.ITALIC">
|
||||
<value>
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
</value>
|
||||
</option>
|
||||
</list>
|
||||
@@ -18,15 +18,13 @@ package com.jetbrains.rest;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.SyntaxHighlighterColors;
|
||||
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.jetbrains.rest.lexer.RestFlexLexer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -35,49 +33,49 @@ import java.util.Map;
|
||||
public class RestSyntaxHighlighter extends SyntaxHighlighterBase implements RestTokenTypes {
|
||||
public static final TextAttributesKey REST_COMMENT = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.LINE_COMMENT",
|
||||
SyntaxHighlighterColors.LINE_COMMENT.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.LINE_COMMENT
|
||||
);
|
||||
|
||||
public static final TextAttributesKey REST_SECTION_HEADER = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.SECTION.HEADER",
|
||||
SyntaxHighlighterColors.NUMBER.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.NUMBER
|
||||
);
|
||||
|
||||
public static final TextAttributesKey REST_BOLD = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.BOLD",
|
||||
new TextAttributes(Color.black, null, null, null, Font.BOLD)
|
||||
DefaultLanguageHighlighterColors.IDENTIFIER
|
||||
);
|
||||
public static final TextAttributesKey REST_ITALIC = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.ITALIC",
|
||||
new TextAttributes(Color.black, null, null, null, Font.ITALIC)
|
||||
DefaultLanguageHighlighterColors.IDENTIFIER
|
||||
);
|
||||
public static final TextAttributesKey REST_FIXED = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.FIXED",
|
||||
new TextAttributes(Color.black, new Color(217, 217, 240), null, null, Font.PLAIN)
|
||||
DefaultLanguageHighlighterColors.IDENTIFIER
|
||||
);
|
||||
|
||||
public static final TextAttributesKey REST_INTERPRETED = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.INTERPRETED",
|
||||
new TextAttributes(Color.black, new Color(202, 218, 186), null, null, Font.PLAIN)
|
||||
DefaultLanguageHighlighterColors.IDENTIFIER
|
||||
);
|
||||
|
||||
public static final TextAttributesKey REST_REF_NAME = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.REF.NAME",
|
||||
SyntaxHighlighterColors.STRING.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.STRING
|
||||
);
|
||||
|
||||
public static final TextAttributesKey REST_EXPLICIT= TextAttributesKey.createTextAttributesKey(
|
||||
"REST.EXPLICIT",
|
||||
SyntaxHighlighterColors.KEYWORD.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.KEYWORD
|
||||
);
|
||||
public static final TextAttributesKey REST_FIELD = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.FIELD",
|
||||
SyntaxHighlighterColors.KEYWORD.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.KEYWORD
|
||||
);
|
||||
|
||||
public static final TextAttributesKey REST_INLINE = TextAttributesKey.createTextAttributesKey(
|
||||
"REST.INLINE",
|
||||
new TextAttributes(null, new Color(237, 252, 237), null, null, Font.PLAIN)
|
||||
DefaultLanguageHighlighterColors.IDENTIFIER
|
||||
);
|
||||
private static final Map<IElementType, TextAttributesKey> ATTRIBUTES = Maps.newHashMap();
|
||||
|
||||
|
||||
@@ -462,6 +462,9 @@
|
||||
<statistics.usagesCollector implementation="com.jetbrains.python.statistics.PyInterpreterUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.jetbrains.python.statistics.PyPackageUsagesCollector"/>
|
||||
|
||||
<additionalTextAttributes scheme="Default" file="colorSchemes/PythonDefault.xml"/>
|
||||
<additionalTextAttributes scheme="Darcula" file="colorSchemes/PythonDarcula.xml"/>
|
||||
|
||||
<!-- Cython -->
|
||||
<lang.parserDefinition language="Cython" implementationClass="com.jetbrains.cython.parser.CythonParserDefinition"/>
|
||||
<lang.syntaxHighlighterFactory key="Cython" implementationClass="com.jetbrains.cython.CythonSyntaxHighlighterFactory"/>
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jetbrains.python.buildout.config;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||
import com.intellij.openapi.editor.SyntaxHighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
|
||||
@@ -41,34 +42,34 @@ public class BuildoutCfgSyntaxHighlighter extends SyntaxHighlighterBase implemen
|
||||
|
||||
|
||||
public static final TextAttributesKey BUILDOUT_SECTION_NAME =
|
||||
TextAttributesKey.createTextAttributesKey("BUILDOUT.SECTION_NAME", SyntaxHighlighterColors.NUMBER.getDefaultAttributes().clone());
|
||||
TextAttributesKey.createTextAttributesKey("BUILDOUT.SECTION_NAME", SyntaxHighlighterColors.NUMBER);
|
||||
|
||||
public static final TextAttributesKey BUILDOUT_KEY = TextAttributesKey.createTextAttributesKey(
|
||||
"BUILDOUT.KEY",
|
||||
SyntaxHighlighterColors.KEYWORD.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.KEYWORD
|
||||
);
|
||||
|
||||
public static final TextAttributesKey BUILDOUT_VALUE = TextAttributesKey.createTextAttributesKey(
|
||||
"BUILDOUT.VALUE",
|
||||
SyntaxHighlighterColors.STRING.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.STRING
|
||||
);
|
||||
|
||||
public static final TextAttributesKey BUILDOUT_COMMENT = TextAttributesKey.createTextAttributesKey(
|
||||
"BUILDOUT.LINE_COMMENT",
|
||||
SyntaxHighlighterColors.LINE_COMMENT.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.LINE_COMMENT
|
||||
);
|
||||
|
||||
public static final TextAttributesKey BUILDOUT_KEY_VALUE_SEPARATOR = TextAttributesKey.createTextAttributesKey(
|
||||
"BUILDOUT.KEY_VALUE_SEPARATOR",
|
||||
SyntaxHighlighterColors.OPERATION_SIGN.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.OPERATION_SIGN
|
||||
);
|
||||
public static final TextAttributesKey BUILDOUT_VALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey(
|
||||
"BUILDOUT.VALID_STRING_ESCAPE",
|
||||
SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE
|
||||
);
|
||||
public static final TextAttributesKey BUILDOUT_INVALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey(
|
||||
"BUILDOUT.INVALID_STRING_ESCAPE",
|
||||
SyntaxHighlighterColors.INVALID_STRING_ESCAPE.getDefaultAttributes()
|
||||
DefaultLanguageHighlighterColors.INVALID_STRING_ESCAPE
|
||||
);
|
||||
|
||||
|
||||
|
||||
+4
-3
@@ -8,6 +8,7 @@ import com.intellij.codeInsight.lookup.TailTypeDecorator;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PythonLanguage;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.psi.PyClass;
|
||||
import com.jetbrains.python.psi.PyFunction;
|
||||
import icons.PythonIcons;
|
||||
@@ -45,9 +46,9 @@ public class PySpecialMethodNamesCompletionContributor extends CompletionContrib
|
||||
protected void addCompletions(
|
||||
@NotNull final CompletionParameters parameters, final ProcessingContext context, @NotNull final CompletionResultSet result
|
||||
) {
|
||||
for (Map.Entry<String, PyNames.BuiltinDescription> entry: PyNames.BuiltinMethods.entrySet()) {
|
||||
LookupElementBuilder item;
|
||||
item = LookupElementBuilder
|
||||
LanguageLevel languageLevel = LanguageLevel.forElement(parameters.getOriginalFile());
|
||||
for (Map.Entry<String, PyNames.BuiltinDescription> entry: PyNames.getBuiltinMethods(languageLevel).entrySet()) {
|
||||
LookupElementBuilder item = LookupElementBuilder
|
||||
.create(entry.getKey() + entry.getValue().getSignature())
|
||||
.bold()
|
||||
.withTypeText("predefined")
|
||||
|
||||
+3
-1
@@ -10,6 +10,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PyTokenTypes;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.psi.PyClass;
|
||||
import com.jetbrains.python.psi.PyFunction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -44,7 +45,8 @@ public class PySuperMethodCompletionContributor extends CompletionContributor {
|
||||
for (PyFunction function : containingClass.getMethods()) {
|
||||
seenNames.add(function.getName());
|
||||
}
|
||||
seenNames.addAll(PyNames.BuiltinMethods.keySet());
|
||||
LanguageLevel languageLevel = LanguageLevel.forElement(parameters.getOriginalFile());
|
||||
seenNames.addAll(PyNames.getBuiltinMethods(languageLevel).keySet());
|
||||
for (PyClass ancestor : containingClass.iterateAncestorClasses()) {
|
||||
for (PyFunction superMethod : ancestor.getMethods()) {
|
||||
if (!seenNames.contains(superMethod.getName())) {
|
||||
|
||||
@@ -159,34 +159,42 @@ public class PythonEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
DataContext dataContext,
|
||||
int offset,
|
||||
Document doc) {
|
||||
boolean autoWrapInProgress = DataManager.getInstance().loadFromDataContext(dataContext,
|
||||
AutoHardWrapHandler.AUTO_WRAP_LINE_IN_PROGRESS_KEY) != null;
|
||||
if (needInsertBackslash(file, offset, autoWrapInProgress)) {
|
||||
doc.insertString(offset, "\\");
|
||||
caretOffset.set(caretOffset.get() + 1);
|
||||
}
|
||||
return Result.Continue;
|
||||
}
|
||||
|
||||
public static boolean needInsertBackslash(PsiFile file, int offset, boolean autoWrapInProgress) {
|
||||
if (offset > 0) {
|
||||
final PsiElement beforeCaret = file.findElementAt(offset - 1);
|
||||
if (beforeCaret instanceof PsiWhiteSpace && beforeCaret.getText().indexOf('\\') >= 0) {
|
||||
// we've got a backslash at EOL already, don't need another one
|
||||
return Result.Continue;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PsiElement statementBefore = findStatementBeforeCaret(file, offset);
|
||||
PsiElement statementAfter = findStatementAfterCaret(file, offset);
|
||||
if (statementBefore != statementAfter) { // Enter pressed at statement break
|
||||
return Result.Continue;
|
||||
return false;
|
||||
}
|
||||
if (statementBefore == null) { // empty file
|
||||
return Result.Continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (PsiTreeUtil.hasErrorElements(statementBefore)) {
|
||||
final Boolean autoWrapping =
|
||||
DataManager.getInstance().loadFromDataContext(dataContext, AutoHardWrapHandler.AUTO_WRAP_LINE_IN_PROGRESS_KEY);
|
||||
if (autoWrapping == null) {
|
||||
if (!autoWrapInProgress) {
|
||||
// code is already bad, don't mess it up even further
|
||||
return Result.Continue;
|
||||
return false;
|
||||
}
|
||||
// if we're in middle of typing, it's expected that we will have error elements
|
||||
}
|
||||
|
||||
if (inFromImportParentheses(statementBefore, offset)) {
|
||||
return Result.Continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
PsiElement wrappableBefore = findWrappable(file, offset, true);
|
||||
@@ -210,13 +218,9 @@ public class PythonEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
}
|
||||
}
|
||||
if (wrappableBefore instanceof PsiComment || wrappableAfter instanceof PsiComment) {
|
||||
return Result.Continue;
|
||||
return false;
|
||||
}
|
||||
if (wrappableAfter == null || wrappableBefore != wrappableAfter) {
|
||||
doc.insertString(offset, "\\");
|
||||
caretOffset.set(caretOffset.get() + 1);
|
||||
}
|
||||
return Result.Continue;
|
||||
return wrappableAfter == null || wrappableBefore != wrappableAfter;
|
||||
}
|
||||
|
||||
private static void insertDocStringStub(Editor editor, PsiElement element) {
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.jetbrains.python.editor.selectWord;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.ExtendWordSelectionHandler;
|
||||
import com.intellij.codeInsight.editorActions.SelectWordUtil;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.python.PyTokenTypes;
|
||||
import com.jetbrains.python.lexer.PyStringLiteralLexer;
|
||||
import com.jetbrains.python.psi.PyStringLiteralExpression;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -26,10 +29,18 @@ public class PyLiteralSelectionHandler implements ExtendWordSelectionHandler {
|
||||
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
|
||||
final PyStringLiteralExpression literal = PsiTreeUtil.getParentOfType(e, PyStringLiteralExpression.class);
|
||||
if (literal != null) {
|
||||
for (TextRange stringRange : literal.getStringValueTextRanges()) {
|
||||
List<TextRange> ranges = literal.getStringValueTextRanges();
|
||||
List<ASTNode> nodes = literal.getStringNodes();
|
||||
for (int i = 0; i < ranges.size(); i++) {
|
||||
TextRange stringRange = ranges.get(i);
|
||||
TextRange offsetRange = stringRange.shiftRight(literal.getTextRange().getStartOffset());
|
||||
if (offsetRange.contains(cursorOffset) && offsetRange.getLength() > 1) {
|
||||
return Collections.singletonList(offsetRange);
|
||||
List<TextRange> result = new ArrayList<TextRange>();
|
||||
SelectWordUtil.addWordHonoringEscapeSequences(editorText, nodes.get(i).getTextRange(), cursorOffset,
|
||||
new PyStringLiteralLexer(nodes.get(i).getElementType()),
|
||||
result);
|
||||
result.add(offsetRange);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public class PyLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettin
|
||||
"SPACE_AROUND_MULTIPLICATIVE_OPERATORS",
|
||||
"SPACE_AROUND_SHIFT_OPERATORS",
|
||||
"SPACE_WITHIN_METHOD_CALL_PARENTHESES",
|
||||
"SPACE_WITHIN_METHOD_PARENTHESES",
|
||||
"SPACE_WITHIN_BRACKETS",
|
||||
"SPACE_AFTER_COMMA",
|
||||
"SPACE_BEFORE_COMMA",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.jetbrains.python.formatter;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.formatter.StaticSymbolWhiteSpaceDefinitionStrategy;
|
||||
import com.jetbrains.python.editor.PythonEnterHandler;
|
||||
import gnu.trove.TIntIntHashMap;
|
||||
import gnu.trove.TIntProcedure;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -17,6 +20,21 @@ public class PyWhiteSpaceFormattingStrategy extends StaticSymbolWhiteSpaceDefini
|
||||
super('\\');
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence adjustWhiteSpaceIfNecessary(@NotNull CharSequence whiteSpaceText,
|
||||
@NotNull PsiElement startElement,
|
||||
int startOffset,
|
||||
int endOffset,
|
||||
CodeStyleSettings codeStyleSettings) {
|
||||
CharSequence whiteSpace = super.adjustWhiteSpaceIfNecessary(whiteSpaceText, startElement, startOffset, endOffset, codeStyleSettings);
|
||||
if (whiteSpace.length() > 0 && whiteSpace.charAt(0) == '\n' && !StringUtil.contains(whiteSpace, 0, whiteSpace.length(), '\\') &&
|
||||
PythonEnterHandler.needInsertBackslash(startElement.getContainingFile(), startOffset, false)) {
|
||||
PyCodeStyleSettings settings = codeStyleSettings.getCustomSettings(PyCodeStyleSettings.class);
|
||||
return (settings.SPACE_BEFORE_BACKSLASH ? " \\" : "\\") + whiteSpace.toString();
|
||||
}
|
||||
return whiteSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Python uses backslashes at the end of the line as indication that next line is an extension of the current one.
|
||||
* <p/>
|
||||
|
||||
@@ -96,6 +96,7 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
|
||||
.around(DOT).spaces(0)
|
||||
.before(SEMICOLON).spaceIf(commonSettings.SPACE_BEFORE_SEMICOLON)
|
||||
.withinPairInside(LPAR, RPAR, ARGUMENT_LIST).spaceIf(commonSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES)
|
||||
.withinPairInside(LPAR, RPAR, PARAMETER_LIST).spaceIf(commonSettings.SPACE_WITHIN_METHOD_PARENTHESES)
|
||||
.before(LBRACKET).spaceIf(pySettings.SPACE_BEFORE_LBRACKET)
|
||||
|
||||
.withinPair(LBRACE, RBRACE).spaceIf(pySettings.SPACE_WITHIN_BRACES)
|
||||
|
||||
@@ -3,9 +3,7 @@ package com.jetbrains.python.highlighting;
|
||||
import com.intellij.lexer.LayeredLexer;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.HighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
|
||||
import com.intellij.psi.StringEscapesTokenTypes;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -16,11 +14,10 @@ import com.jetbrains.python.lexer.PythonHighlightingLexer;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.intellij.openapi.editor.SyntaxHighlighterColors.*;
|
||||
import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.*;
|
||||
|
||||
/**
|
||||
* Colors and lexer(s) needed for highlighting.
|
||||
@@ -56,72 +53,50 @@ public class PyHighlighter extends SyntaxHighlighterBase {
|
||||
return new PythonHighlightingLexer(myLanguageLevel);
|
||||
}
|
||||
|
||||
private static TextAttributesKey _copy(String name, TextAttributesKey src) {
|
||||
return TextAttributesKey.createTextAttributesKey(name, src.getDefaultAttributes().clone());
|
||||
}
|
||||
public static final TextAttributesKey PY_KEYWORD = TextAttributesKey.createTextAttributesKey("PY.KEYWORD", KEYWORD);
|
||||
|
||||
public static final TextAttributesKey PY_KEYWORD = _copy("PY.KEYWORD", KEYWORD);
|
||||
public static final TextAttributesKey PY_BYTE_STRING = TextAttributesKey.createTextAttributesKey("PY.STRING.B", STRING);
|
||||
public static final TextAttributesKey PY_UNICODE_STRING = TextAttributesKey.createTextAttributesKey("PY.STRING.U", STRING);
|
||||
public static final TextAttributesKey PY_NUMBER = TextAttributesKey.createTextAttributesKey("PY.NUMBER", NUMBER);
|
||||
|
||||
public static final TextAttributesKey PY_BYTE_STRING = _copy("PY.STRING.B", STRING);
|
||||
public static final TextAttributesKey PY_UNICODE_STRING = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.STRING.U",
|
||||
new TextAttributes(new Color(0, 128, 128), null, null, null, STRING.getDefaultAttributes().getFontType())
|
||||
);
|
||||
public static final TextAttributesKey PY_NUMBER = _copy("PY.NUMBER", NUMBER);
|
||||
static final TextAttributesKey PY_LINE_COMMENT = TextAttributesKey.createTextAttributesKey("PY.LINE_COMMENT", LINE_COMMENT);
|
||||
|
||||
static final TextAttributesKey PY_LINE_COMMENT = _copy("PY.LINE_COMMENT", LINE_COMMENT);
|
||||
static final TextAttributesKey PY_OPERATION_SIGN = TextAttributesKey.createTextAttributesKey("PY.OPERATION_SIGN", OPERATION_SIGN);
|
||||
|
||||
static final TextAttributesKey PY_OPERATION_SIGN = _copy("PY.OPERATION_SIGN", OPERATION_SIGN);
|
||||
static final TextAttributesKey PY_PARENTHS = TextAttributesKey.createTextAttributesKey("PY.PARENTHS", PARENTHESES);
|
||||
|
||||
static final TextAttributesKey PY_PARENTHS = _copy("PY.PARENTHS", PARENTHS);
|
||||
static final TextAttributesKey PY_BRACKETS = TextAttributesKey.createTextAttributesKey("PY.BRACKETS", BRACKETS);
|
||||
|
||||
static final TextAttributesKey PY_BRACKETS = _copy("PY.BRACKETS", BRACKETS);
|
||||
static final TextAttributesKey PY_BRACES = TextAttributesKey.createTextAttributesKey("PY.BRACES", BRACES);
|
||||
|
||||
static final TextAttributesKey PY_BRACES = _copy("PY.BRACES", BRACES);
|
||||
static final TextAttributesKey PY_COMMA = TextAttributesKey.createTextAttributesKey("PY.COMMA", COMMA);
|
||||
|
||||
static final TextAttributesKey PY_COMMA = _copy("PY.COMMA", COMMA);
|
||||
static final TextAttributesKey PY_DOT = TextAttributesKey.createTextAttributesKey("PY.DOT", DOT);
|
||||
|
||||
static final TextAttributesKey PY_DOT = _copy("PY.DOT", DOT);
|
||||
public static final TextAttributesKey PY_DOC_COMMENT = TextAttributesKey.createTextAttributesKey("PY.DOC_COMMENT", DOC_COMMENT);
|
||||
|
||||
public static final TextAttributesKey PY_DOC_COMMENT = _copy("PY.DOC_COMMENT", DOC_COMMENT);
|
||||
public static final TextAttributesKey PY_DOC_COMMENT_TAG = TextAttributesKey.createTextAttributesKey("PY.DOC_COMMENT_TAG", DOC_COMMENT_TAG);
|
||||
|
||||
public static final TextAttributesKey PY_DOC_COMMENT_TAG = _copy("PY.DOC_COMMENT_TAG", DOC_COMMENT_TAG);
|
||||
public static final TextAttributesKey PY_DECORATOR = TextAttributesKey.createTextAttributesKey("PY.DECORATOR", IDENTIFIER);
|
||||
|
||||
public static final TextAttributesKey PY_DECORATOR = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.DECORATOR", new TextAttributes(Color.blue.darker(), null, null, null, Font.PLAIN)
|
||||
);
|
||||
public static final TextAttributesKey PY_CLASS_DEFINITION = TextAttributesKey.createTextAttributesKey("PY.CLASS_DEFINITION", CLASS_NAME);
|
||||
|
||||
public static final TextAttributesKey PY_CLASS_DEFINITION = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.CLASS_DEFINITION", new TextAttributes(Color.black, null, null, null, Font.BOLD)
|
||||
);
|
||||
public static final TextAttributesKey PY_FUNC_DEFINITION = TextAttributesKey.createTextAttributesKey("PY.FUNC_DEFINITION", FUNCTION_DECLARATION);
|
||||
|
||||
public static final TextAttributesKey PY_FUNC_DEFINITION = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.FUNC_DEFINITION", new TextAttributes(Color.black, null, null, null, Font.BOLD)
|
||||
);
|
||||
public static final TextAttributesKey PY_PREDEFINED_DEFINITION = TextAttributesKey.createTextAttributesKey("PY.PREDEFINED_DEFINITION", PREDEFINED_SYMBOL);
|
||||
|
||||
public static final TextAttributesKey PY_PREDEFINED_DEFINITION = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.PREDEFINED_DEFINITION", new TextAttributes(Color.magenta.darker(), null, null, null, Font.BOLD)
|
||||
);
|
||||
public static final TextAttributesKey PY_PREDEFINED_USAGE = TextAttributesKey.createTextAttributesKey("PY.PREDEFINED_USAGE", PREDEFINED_SYMBOL);
|
||||
|
||||
public static final TextAttributesKey PY_PREDEFINED_USAGE = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.PREDEFINED_USAGE", new TextAttributes(Color.magenta.darker(), null, null, null, Font.PLAIN)
|
||||
);
|
||||
public static final TextAttributesKey PY_BUILTIN_NAME = TextAttributesKey.createTextAttributesKey("PY.BUILTIN_NAME", PREDEFINED_SYMBOL);
|
||||
|
||||
public static final TextAttributesKey PY_BUILTIN_NAME = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.BUILTIN_NAME",
|
||||
new TextAttributes(KEYWORD.getDefaultAttributes().getForegroundColor(), null, null, null, Font.PLAIN)
|
||||
);
|
||||
public static final TextAttributesKey PY_PARAMETER = TextAttributesKey.createTextAttributesKey("PY.PARAMETER", PARAMETER);
|
||||
public static final TextAttributesKey PY_SELF_PARAMETER = TextAttributesKey.createTextAttributesKey( "PY.SELF_PARAMETER", PARAMETER);
|
||||
|
||||
public static final TextAttributesKey PY_PARAMETER =_copy("PY.PARAMETER", CodeInsightColors.PARAMETER_ATTRIBUTES);
|
||||
public static final TextAttributesKey PY_SELF_PARAMETER = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.SELF_PARAMETER", new TextAttributes(new Color(148, 85, 141), null, null, null, Font.PLAIN));
|
||||
public static final TextAttributesKey PY_KEYWORD_ARGUMENT = TextAttributesKey.createTextAttributesKey("PY.KEYWORD_ARGUMENT", PARAMETER);
|
||||
|
||||
public static final TextAttributesKey PY_KEYWORD_ARGUMENT = TextAttributesKey.createTextAttributesKey(
|
||||
"PY.KEYWORD_ARGUMENT", new TextAttributes(new Color(102, 0, 153), null, null, null, Font.PLAIN));
|
||||
public static final TextAttributesKey PY_VALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey("PY.VALID_STRING_ESCAPE", VALID_STRING_ESCAPE);
|
||||
|
||||
public static final TextAttributesKey PY_VALID_STRING_ESCAPE = _copy("PY.VALID_STRING_ESCAPE", VALID_STRING_ESCAPE);
|
||||
|
||||
public static final TextAttributesKey PY_INVALID_STRING_ESCAPE = _copy("PY.INVALID_STRING_ESCAPE", INVALID_STRING_ESCAPE);
|
||||
public static final TextAttributesKey PY_INVALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey("PY.INVALID_STRING_ESCAPE", INVALID_STRING_ESCAPE);
|
||||
|
||||
/**
|
||||
* The 'heavy' constructor that initializes everything. PySyntaxHighlighterFactory caches such instances per level.
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
|
||||
|
||||
public static PyUnresolvedReferencesInspection getInstance(PsiElement element) {
|
||||
final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(element.getProject()).getInspectionProfile();
|
||||
return inspectionProfile.getUnwrappedTool(SHORT_NAME_KEY, element);
|
||||
return (PyUnresolvedReferencesInspection)inspectionProfile.getUnwrappedTool(SHORT_NAME_KEY.toString(), element);
|
||||
}
|
||||
|
||||
@Nls
|
||||
|
||||
+5
-3
@@ -44,10 +44,12 @@ public class AddIgnoredIdentifierQuickFix implements LocalQuickFix, LowPriorityA
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
final PsiElement context = descriptor.getPsiElement();
|
||||
InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
|
||||
profile.modifyToolSettings(PyUnresolvedReferencesInspection.SHORT_NAME_KEY, context, new Consumer<PyUnresolvedReferencesInspection>() {
|
||||
InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile(context);
|
||||
profile.modifyProfile(new Consumer<ModifiableModel>() {
|
||||
@Override
|
||||
public void consume(PyUnresolvedReferencesInspection inspection) {
|
||||
public void consume(ModifiableModel model) {
|
||||
PyUnresolvedReferencesInspection inspection =
|
||||
(PyUnresolvedReferencesInspection)model.getUnwrappedTool(PyUnresolvedReferencesInspection.class.getSimpleName(), context);
|
||||
String name = myIdentifier.toString();
|
||||
if (myIgnoreAllAttributes) {
|
||||
name += END_WILDCARD;
|
||||
|
||||
@@ -185,6 +185,15 @@ public abstract class AbstractPythonRunConfiguration<T extends AbstractRunConfig
|
||||
return sdkHome;
|
||||
}
|
||||
|
||||
public Sdk getSdk() {
|
||||
if (myUseModuleSdk) {
|
||||
return PythonSdkType.findPythonSdk(getModule());
|
||||
}
|
||||
else {
|
||||
return PythonSdkType.findSdkByPath(getSdkHome());
|
||||
}
|
||||
}
|
||||
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
super.readExternal(element);
|
||||
myInterpreterOptions = JDOMExternalizerUtil.readField(element, "INTERPRETER_OPTIONS");
|
||||
@@ -303,13 +312,13 @@ public abstract class AbstractPythonRunConfiguration<T extends AbstractRunConfig
|
||||
* @param commandLine what to patch
|
||||
*/
|
||||
public void patchCommandLine(GeneralCommandLine commandLine) {
|
||||
final String sdk_home = getSdkHome();
|
||||
Sdk sdk = PythonSdkType.findPythonSdk(getModule());
|
||||
if (sdk != null && sdk_home != null) {
|
||||
patchCommandLineFirst(commandLine, sdk_home);
|
||||
patchCommandLineForVirtualenv(commandLine, sdk_home);
|
||||
patchCommandLineForBuildout(commandLine, sdk_home);
|
||||
patchCommandLineLast(commandLine, sdk_home);
|
||||
final String interpreterPath = getInterpreterPath();
|
||||
Sdk sdk = getSdk();
|
||||
if (sdk != null && interpreterPath != null) {
|
||||
patchCommandLineFirst(commandLine, interpreterPath);
|
||||
patchCommandLineForVirtualenv(commandLine, interpreterPath);
|
||||
patchCommandLineForBuildout(commandLine, interpreterPath);
|
||||
patchCommandLineLast(commandLine, interpreterPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
|
||||
@Nullable
|
||||
public PythonSdkFlavor getSdkFlavor() {
|
||||
return PythonSdkFlavor.getFlavor(myConfig.getSdkHome());
|
||||
return PythonSdkFlavor.getFlavor(myConfig.getInterpreterPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,7 +153,7 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
PythonRunConfigurationExtensionsManager.getInstance()
|
||||
.patchCommandLine(myConfig, runnerSettings, commandLine, getConfigurationSettings().getRunnerId());
|
||||
|
||||
Sdk sdk = PythonSdkType.findSdkByPath(myConfig.getSdkHome());
|
||||
Sdk sdk = PythonSdkType.findSdkByPath(myConfig.getInterpreterPath());
|
||||
|
||||
|
||||
final ProcessHandler processHandler;
|
||||
|
||||
@@ -48,9 +48,7 @@ public class PythonRunner extends DefaultProgramRunner {
|
||||
}
|
||||
if (executionResult == null) return null;
|
||||
|
||||
final RunContentBuilder contentBuilder = new RunContentBuilder(project, this, executor);
|
||||
contentBuilder.setExecutionResult(executionResult);
|
||||
contentBuilder.setEnvironment(env);
|
||||
final RunContentBuilder contentBuilder = new RunContentBuilder(project, this, executor, executionResult, env);
|
||||
return contentBuilder.showRunContent(contentToReuse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.codeInspection.ModifiableModel;
|
||||
import com.intellij.codeInspection.ex.CustomEditInspectionToolsSettingsAction;
|
||||
import com.intellij.execution.process.ProcessOutput;
|
||||
import com.intellij.lang.annotation.Annotation;
|
||||
@@ -99,7 +100,7 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator<Pep8ExternalAnnotat
|
||||
if (!profile.isToolEnabled(key)) {
|
||||
return null;
|
||||
}
|
||||
final PyPep8Inspection inspection = profile.getUnwrappedTool(PyPep8Inspection.KEY, file);
|
||||
final PyPep8Inspection inspection = (PyPep8Inspection)profile.getUnwrappedTool(PyPep8Inspection.KEY.toString(), file);
|
||||
final List<String> ignoredErrors = inspection.ignoredErrors;
|
||||
final int margin = CodeStyleSettingsManager.getInstance(file.getProject()).getCurrentSettings().RIGHT_MARGIN;
|
||||
return new State(homePath, file.getText(), profile.getErrorLevel(key, file), ignoredErrors, margin);
|
||||
@@ -233,10 +234,10 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator<Pep8ExternalAnnotat
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, final PsiFile file) throws IncorrectOperationException {
|
||||
InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
|
||||
profile.modifyToolSettings(PyPep8Inspection.KEY, file, new Consumer<PyPep8Inspection>() {
|
||||
InspectionProjectProfileManager.getInstance(project).getInspectionProfile(file).modifyProfile(new Consumer<ModifiableModel>() {
|
||||
@Override
|
||||
public void consume(PyPep8Inspection tool) {
|
||||
public void consume(ModifiableModel model) {
|
||||
PyPep8Inspection tool = (PyPep8Inspection)model.getUnwrappedTool(PyPep8Inspection.INSPECTION_SHORT_NAME, file);
|
||||
tool.ignoredErrors.add(myCode);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,7 +52,8 @@ public class PyBuiltinAnnotator extends PyAnnotator {
|
||||
* @return true iff the node was highlighted.
|
||||
*/
|
||||
private boolean highlightAsAttribute(PyQualifiedExpression node, String name) {
|
||||
if (PyNames.UnderscoredAttributes.contains(name) || PyNames.BuiltinMethods.containsKey(name)) {
|
||||
LanguageLevel languageLevel = LanguageLevel.forElement(node);
|
||||
if (PyNames.UnderscoredAttributes.contains(name) || PyNames.getBuiltinMethods(languageLevel).containsKey(name)) {
|
||||
// things like __len__
|
||||
if (
|
||||
(node.getQualifier() != null) // foo.__len__
|
||||
|
||||
@@ -6,10 +6,7 @@ import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.highlighting.PyHighlighter;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.psi.PyClass;
|
||||
import com.jetbrains.python.psi.PyDecorator;
|
||||
import com.jetbrains.python.psi.PyDecoratorList;
|
||||
import com.jetbrains.python.psi.PyFunction;
|
||||
import com.jetbrains.python.psi.*;
|
||||
|
||||
/**
|
||||
* Highlights class definitions, functrion definitions, and decorators.
|
||||
@@ -33,7 +30,8 @@ public class PyDefinitionsAnnotator extends PyAnnotator {
|
||||
if (name_node != null) {
|
||||
Annotation ann = getHolder().createInfoAnnotation(name_node, null);
|
||||
final String name = node.getName();
|
||||
if (PyNames.UnderscoredAttributes.contains(name) || PyNames.BuiltinMethods.containsKey(name)) {
|
||||
LanguageLevel languageLevel = LanguageLevel.forElement(node);
|
||||
if (PyNames.UnderscoredAttributes.contains(name) || PyNames.getBuiltinMethods(languageLevel).containsKey(name)) {
|
||||
PyClass cls = node.getContainingClass();
|
||||
if (PyNames.NEW.equals(name)) {
|
||||
boolean new_style_class = false;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
def foo(x, y):
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
def foo( x, y ):
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
num_synapses = nest.GetDefaults("excitatory")["num_connections"] + nest.GetDefaults("inhibitory")["num_connections"]
|
||||
@@ -0,0 +1,2 @@
|
||||
num_synapses = nest.GetDefaults("excitatory")["num_connections"] + \
|
||||
nest.GetDefaults("inhibitory")["num_connections"]
|
||||
@@ -0,0 +1 @@
|
||||
s = 'Hello\n<selection>World</selection>!'
|
||||
@@ -0,0 +1 @@
|
||||
s = 'Hello\nWo<caret>rld!'
|
||||
@@ -312,6 +312,16 @@ public class PyFormatterTest extends PyTestCase {
|
||||
doTestPy3();
|
||||
}
|
||||
|
||||
public void testWrapInBinaryExpression() { // PY-9032
|
||||
settings().RIGHT_MARGIN = 80;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSpaceWithinDeclarationParentheses() { // PY-8818
|
||||
settings().SPACE_WITHIN_METHOD_PARENTHESES = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
|
||||
@@ -31,6 +31,10 @@ public class PySelectWordTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEscapeSequence() { // PY-9014
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
@NonNls final String path = "selectWord/" + getTestName(true);
|
||||
myFixture.copyDirectoryToProject(path, path);
|
||||
|
||||
Reference in New Issue
Block a user