Merge branch 'master' of git.labs.intellij.net:idea/ultimate

This commit is contained in:
Ekaterina Tuzova
2011-05-18 16:48:02 +04:00
11 changed files with 42 additions and 12 deletions
@@ -43,7 +43,6 @@ public class PyClassNameCompletionContributor extends CompletionContributor {
@NotNull final CompletionResultSet resultSet) {
addVariantsFromIndex(resultSet, parameters.getOriginalFile(), PyClassNameIndex.KEY, CLASS_INSERT_HANDLER, Conditions.<PyClass>alwaysTrue());
addVariantsFromIndex(resultSet, parameters.getOriginalFile(), PyFunctionNameIndex.KEY, FUNCTION_INSERT_HANDLER, TOPLEVEL_FUNCTION);
ProjectScope.getAllScope(parameters.getOriginalFile().getProject());
}
});
}
@@ -141,7 +141,7 @@ public class PyBlock implements ASTBlock {
childIndent = Indent.getNoneIndent();
}
else {
childIndent = Indent.getContinuationIndent();
childIndent = Indent.getNormalIndent();
}
}
else if (parentType == PyElementTypes.ARGUMENT_LIST) {
@@ -152,7 +152,7 @@ public class PyBlock implements ASTBlock {
childIndent = Indent.getNormalIndent();
}
}
else if (parentType == PyElementTypes.DICT_LITERAL_EXPRESSION) {
else if (parentType == PyElementTypes.DICT_LITERAL_EXPRESSION || parentType == PyElementTypes.SET_LITERAL_EXPRESSION) {
if (childType == PyTokenTypes.RBRACE) {
childIndent = Indent.getNoneIndent();
}
@@ -211,7 +211,9 @@ public class PyBlock implements ASTBlock {
private boolean needListAlignment(ASTNode child) {
IElementType childType = child.getElementType();
if (PyTokenTypes.OPEN_BRACES.contains(childType)) {
ASTNode firstGrandchild = child.getFirstChildNode();
IElementType firstGrandchildType = firstGrandchild == null ? null : firstGrandchild.getElementType();
if (PyTokenTypes.OPEN_BRACES.contains(childType) || PyTokenTypes.OPEN_BRACES.contains(firstGrandchildType)) {
return false;
}
if (PyTokenTypes.CLOSE_BRACES.contains(childType)) {
@@ -97,15 +97,15 @@ public class PyFromImportStatementImpl extends PyBaseElementImpl<PyFromImportSta
if (stub != null) {
return stub.getRelativeLevel();
}
// crude but OK for reasonable cases, and in unreasonably complex error cases this number is moot anyway.
int result = 0;
PsiElement import_kwd = findChildByType(PyTokenTypes.IMPORT_KEYWORD);
if (import_kwd != null) {
ASTNode seeker = import_kwd.getNode();
while (seeker != null) {
if (seeker.getElementType() == PyTokenTypes.DOT) result += 1;
seeker = seeker.getTreePrev();
}
ASTNode seeker = getNode().getFirstChildNode();
while(seeker != null && (seeker.getElementType() == PyTokenTypes.FROM_KEYWORD || seeker.getElementType() == TokenType.WHITE_SPACE)) {
seeker = seeker.getTreeNext();
}
while (seeker != null && seeker.getElementType() == PyTokenTypes.DOT) {
result++;
seeker = seeker.getTreeNext();
}
return result;
}
@@ -0,0 +1 @@
from ..subpackage2.moduleZ import <caret>
@@ -0,0 +1 @@
from ..subpackage2.mo<caret>
@@ -192,6 +192,26 @@ public class PyIndentTest extends PyLightFixtureTestCase {
" <caret>params=1)");
}
public void testEnterInSet() { // PY-1947
doTest("test_set = {<caret>'some_value'}",
"test_set = {\n" +
" <caret>'some_value'}");
}
public void testEnterInList() { // PY-1947
doTest("test_list = [<caret>'some_value']",
"test_list = [\n" +
" <caret>'some_value']");
}
public void testEnterInDictInTuple() { // PY-1947
doTest("td = ({<caret>})",
"td = ({\n" +
" <caret>\n" +
"})");
}
public void testIndentAfterComment() { // PY-641
doTest("def foo():\n #some_call()<caret>\n another_call()", "def foo():\n #some_call()\n <caret>\n another_call()");
}
@@ -352,4 +352,11 @@ public class PythonCompletionTest extends PyLightFixtureTestCase {
public void testNoneInArgList() { // PY-3464
doTest3K();
}
public void testPep328Completion() { // PY-3409
myFixture.copyDirectoryToProject("completion/pep328", "pep328");
myFixture.configureByFile("pep328/package/subpackage1/moduleX.py");
myFixture.completeBasic();
myFixture.checkResultByFile("completion/pep328/package/subpackage1/moduleX.after.py");
}
}