diff --git a/java/manifest/src/META-INF/ManifestSupport.xml b/java/manifest/src/META-INF/ManifestSupport.xml index b80da9f4a520..3c26334bbbb5 100644 --- a/java/manifest/src/META-INF/ManifestSupport.xml +++ b/java/manifest/src/META-INF/ManifestSupport.xml @@ -17,6 +17,6 @@ + enabledByDefault="true" level="WEAK WARNING" implementationClass="org.jetbrains.lang.manifest.highlighting.MisspelledHeaderInspection"/> \ No newline at end of file diff --git a/java/manifest/test/org/jetbrains/lang/manifest/MisspelledHeaderInspectionTest.java b/java/manifest/test/org/jetbrains/lang/manifest/MisspelledHeaderInspectionTest.java index 844ed05f625d..c86149f15ca4 100644 --- a/java/manifest/test/org/jetbrains/lang/manifest/MisspelledHeaderInspectionTest.java +++ b/java/manifest/test/org/jetbrains/lang/manifest/MisspelledHeaderInspectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.jetbrains.lang.manifest; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; -import junit.framework.Assert; import org.jetbrains.lang.manifest.highlighting.MisspelledHeaderInspection; import java.util.List; @@ -31,13 +30,13 @@ public class MisspelledHeaderInspectionTest extends LightCodeInsightFixtureTestC public void testNoProblem() { myFixture.configureByText(ManifestFileTypeFactory.MANIFEST, "Manifest-Version: 1.0\n"); - Assert.assertEquals(0, myFixture.getAvailableIntentions().size()); + assertEquals(0, myFixture.getAvailableIntentions().size()); } public void testFix() { myFixture.configureByText(ManifestFileTypeFactory.MANIFEST, "ManifestVersion: 1.0\n"); List intentions = myFixture.filterAvailableIntentions("Change to"); - Assert.assertTrue(intentions.size() > 0); + assertTrue(intentions.size() > 0); myFixture.launchAction(intentions.get(0)); myFixture.checkResult("Manifest-Version: 1.0\n"); } diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java index a40e23b956be..6403f7300f6f 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java @@ -102,12 +102,12 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt warningLabel = createHTMLLabel("Enables Vim-keymap and 'insert' mode for editing. " + "Not recommended if you are unfamiliar with Vim."); - if (SystemInfo.isMac) UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, warningLabel); + if (!SystemInfo.isWindows) UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, warningLabel); } final CardLayout wrapperLayout = new CardLayout(); final JPanel buttonWrapper = new JPanel(wrapperLayout); - final JButton installButton = new JButton(isVIM ? "Install and Enable Vim Editor" : "Install"); + final JButton installButton = new JButton(isVIM ? "Install and Enable" : "Install"); final JProgressBar progressBar = new JProgressBar(0, 100); progressBar.setStringPainted(true); @@ -234,7 +234,7 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt JPanel warningPanel = new JPanel(new BorderLayout()) { @Override public Color getBackground() { - return new JBColor(ColorUtil.fromHex("F6F199"), ColorUtil.fromHex("52503A")); + return new JBColor(new Color(252, 254, 200), ColorUtil.fromHex("52503A")); } }; warningPanel.setBorder(new EmptyBorder(5, 10, 5, 10)); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ComplexFocusedComponentWrapper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ComplexFocusedComponentWrapper.java index fba70607588e..dc287817654b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ComplexFocusedComponentWrapper.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ComplexFocusedComponentWrapper.java @@ -18,11 +18,12 @@ package com.intellij.openapi.vcs.changes.ui; import org.jetbrains.annotations.NotNull; import javax.swing.*; +import java.awt.*; public class ComplexFocusedComponentWrapper extends JPanel { public ComplexFocusedComponentWrapper(@NotNull JComponent component) { - super(); + super(new BorderLayout()); add(component); } diff --git a/python/helpers/python-skeletons/numpy/core/multiarray.py b/python/helpers/python-skeletons/numpy/core/multiarray.py index f7f106ac31cb..193c51c97686 100644 --- a/python/helpers/python-skeletons/numpy/core/multiarray.py +++ b/python/helpers/python-skeletons/numpy/core/multiarray.py @@ -131,7 +131,7 @@ class ndarray(object): def __rmul__(self, y): # real signature unknown; restored from __doc__ """ - x.__rmul__(y) <==> x*y + x.__rmul__(y) <==> y*x Returns ------- @@ -159,6 +159,16 @@ class ndarray(object): """ pass + def __radd__(self, y): # real signature unknown; restored from __doc__ + """ + x.__radd__(y) <==> y+x + + Returns + ------- + out : ndarray + """ + pass + def __copy__(self, order=None): # real signature unknown; restored from __doc__ """ a.__copy__([order]) @@ -179,7 +189,6 @@ class ndarray(object): """ pass - def __div__(self, y): # real signature unknown; restored from __doc__ """ x.__div__(y) <==> x/y @@ -190,6 +199,215 @@ class ndarray(object): """ pass + def __rdiv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rdiv__(y) <==> y/x + + Returns + ------- + out : ndarray + """ + pass + + def __truediv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__truediv__(y) <==> x/y + + Returns + ------- + out : ndarray + """ + pass + + def __rtruediv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rtruediv__(y) <==> y/x + + Returns + ------- + out : ndarray + """ + pass + + def __floordiv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__floordiv__(y) <==> x//y + + Returns + ------- + out : ndarray + """ + pass + + def __rfloordiv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rfloordiv__(y) <==> y//x + + Returns + ------- + out : ndarray + """ + pass + + def __mod__(self, y): # real signature unknown; restored from __doc__ + """ + x.__mod__(y) <==> x%y + + Returns + ------- + out : ndarray + """ + pass + + def __rmod__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rmod__(y) <==> y%x + + Returns + ------- + out : ndarray + """ + pass + + def __lshift__(self, y): # real signature unknown; restored from __doc__ + """ + x.__lshift__(y) <==> x< y< x>>y + + Returns + ------- + out : ndarray + """ + pass + + def __rrshift__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rrshift__(y) <==> y>>x + + Returns + ------- + out : ndarray + """ + pass + + def __and__(self, y): # real signature unknown; restored from __doc__ + """ + x.__and__(y) <==> x&y + + Returns + ------- + out : ndarray + """ + pass + + def __rand__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rand__(y) <==> y&x + + Returns + ------- + out : ndarray + """ + pass + + def __or__(self, y): # real signature unknown; restored from __doc__ + """ + x.__or__(y) <==> x|y + + Returns + ------- + out : ndarray + """ + pass + + def __ror__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ror__(y) <==> y|x + + Returns + ------- + out : ndarray + """ + pass + + def __xor__(self, y): # real signature unknown; restored from __doc__ + """ + x.__xor__(y) <==> x^y + + Returns + ------- + out : ndarray + """ + pass + + def __rxor__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rxor__(y) <==> y^x + + Returns + ------- + out : ndarray + """ + pass + + def __ge__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ge__(y) <==> x>=y + + Returns + ------- + out : ndarray + """ + pass + + def __rge__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rge__(y) <==> y>=x + + Returns + ------- + out : ndarray + """ + pass + + def __eq__(self, y): # real signature unknown; restored from __doc__ + """ + x.__eq__(y) <==> x==y + + Returns + ------- + out : ndarray + """ + pass + + def __req__(self, y): # real signature unknown; restored from __doc__ + """ + x.__req__(y) <==> y==x + + Returns + ------- + out : ndarray + """ + pass def __sub__(self, y): # real signature unknown; restored from __doc__ """ @@ -199,4 +417,354 @@ class ndarray(object): ------- out : ndarray """ + pass + + def __rsub__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rsub__(y) <==> y-x + + Returns + ------- + out : ndarray + """ + pass + + def __lt__(self, y): # real signature unknown; restored from __doc__ + """ + x.__lt__(y) <==> x y x<=y + + Returns + ------- + out : ndarray + """ + pass + + def __rle__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rle__(y) <==> y<=x + + Returns + ------- + out : ndarray + """ + pass + + def __gt__(self, y): # real signature unknown; restored from __doc__ + """ + x.__gt__(y) <==> x>y + + Returns + ------- + out : ndarray + """ + pass + + def __rgt__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rgt__(y) <==> y>x + + Returns + ------- + out : ndarray + """ + pass + + def __ne__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ne__(y) <==> x!=y + + Returns + ------- + out : ndarray + """ + pass + + def __rne__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rne__(y) <==> y!=x + + Returns + ------- + out : ndarray + """ + pass + + def __iadd__(self, y): # real signature unknown; restored from __doc__ + """ + x.__iadd__(y) <==> x+=y + + Returns + ------- + out : ndarray + """ + pass + + def __riadd__(self, y): # real signature unknown; restored from __doc__ + """ + x.__riadd__(y) <==> y+=x + + Returns + ------- + out : ndarray + """ + pass + + def __isub__(self, y): # real signature unknown; restored from __doc__ + """ + x.__isub__(y) <==> x-=y + + Returns + ------- + out : ndarray + """ + pass + + def __risub__(self, y): # real signature unknown; restored from __doc__ + """ + x.__risub__(y) <==> y-=x + + Returns + ------- + out : ndarray + """ + pass + + def __imul__(self, y): # real signature unknown; restored from __doc__ + """ + x.__imul__(y) <==> x*=y + + Returns + ------- + out : ndarray + """ + pass + + def __rimul__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rimul__(y) <==> y*=x + + Returns + ------- + out : ndarray + """ + pass + + def __idiv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__idiv__(y) <==> x/=y + + Returns + ------- + out : ndarray + """ + pass + + def __ridiv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ridiv__(y) <==> y/=x + + Returns + ------- + out : ndarray + """ + pass + + def __itruediv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__itruediv__(y) <==> x/y + + Returns + ------- + out : ndarray + """ + pass + + def __ritruediv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ritruediv__(y) <==> y/x + + Returns + ------- + out : ndarray + """ + pass + + def __ifloordiv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ifloordiv__(y) <==> x//y + + Returns + ------- + out : ndarray + """ + pass + + def __rifloordiv__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rifloordiv__(y) <==> y//x + + Returns + ------- + out : ndarray + """ + pass + + def __imod__(self, y): # real signature unknown; restored from __doc__ + """ + x.__imod__(y) <==> x%=y + + Returns + ------- + out : ndarray + """ + pass + + def __rimod__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rimod__(y) <==> y%=x + + Returns + ------- + out : ndarray + """ + pass + + def __ipow__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ipow__(y) <==> x**=y + + Returns + ------- + out : ndarray + """ + pass + + def __ripow__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ripow__(y) <==> y**=x + + Returns + ------- + out : ndarray + """ + pass + + def __ilshift__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ilshift__(y) <==> x<<=y + + Returns + ------- + out : ndarray + """ + pass + + def __rilshift__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rilshift__(y) <==> y<<=x + + Returns + ------- + out : ndarray + """ + pass + + def __irshift__(self, y): # real signature unknown; restored from __doc__ + """ + x.__irshift__(y) <==> x>>=y + + Returns + ------- + out : ndarray + """ + pass + + def __rirshift__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rirshift__(y) <==> y>>=x + + Returns + ------- + out : ndarray + """ + pass + + def __iand__(self, y): # real signature unknown; restored from __doc__ + """ + x.__iand__(y) <==> x&=y + + Returns + ------- + out : ndarray + """ + pass + + def __riand__(self, y): # real signature unknown; restored from __doc__ + """ + x.__riand__(y) <==> y&=x + + Returns + ------- + out : ndarray + """ + pass + + def __ior__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ior__(y) <==> x|=y + + Returns + ------- + out : ndarray + """ + pass + + def __rior__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rior__(y) <==> y|=x + + Returns + ------- + out : ndarray + """ + pass + + def __ixor__(self, y): # real signature unknown; restored from __doc__ + """ + x.__ixor__(y) <==> x^=y + + Returns + ------- + out : ndarray + """ + pass + + def __rixor__(self, y): # real signature unknown; restored from __doc__ + """ + x.__rixor__(y) <==> y^=x + + Returns + ------- + out : ndarray + """ pass \ No newline at end of file diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/PyResolveResultRater.java b/python/psi-api/src/com/jetbrains/python/psi/impl/PyResolveResultRater.java index 39afca532be0..6ea921b1ab98 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/impl/PyResolveResultRater.java +++ b/python/psi-api/src/com/jetbrains/python/psi/impl/PyResolveResultRater.java @@ -17,10 +17,14 @@ package com.jetbrains.python.psi.impl; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.psi.PsiElement; +import com.jetbrains.python.psi.types.PyType; +import com.jetbrains.python.psi.types.TypeEvalContext; import org.jetbrains.annotations.NotNull; public interface PyResolveResultRater { ExtensionPointName EP_NAME = ExtensionPointName.create("Pythonid.resolveResultRater"); - int getRate(@NotNull final PsiElement target); + int getImportElementRate(@NotNull final PsiElement target); + + int getMemberRate(PsiElement member, PyType type, TypeEvalContext context); } diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/PyResolveResultRaterBase.java b/python/psi-api/src/com/jetbrains/python/psi/impl/PyResolveResultRaterBase.java new file mode 100644 index 000000000000..a0f6d621ce8f --- /dev/null +++ b/python/psi-api/src/com/jetbrains/python/psi/impl/PyResolveResultRaterBase.java @@ -0,0 +1,32 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jetbrains.python.psi.impl; + +import com.intellij.psi.PsiElement; +import com.jetbrains.python.psi.types.PyType; +import com.jetbrains.python.psi.types.TypeEvalContext; +import org.jetbrains.annotations.NotNull; + +public class PyResolveResultRaterBase implements PyResolveResultRater { + + public int getImportElementRate(@NotNull final PsiElement target) { + return 0; + } + + public int getMemberRate(PsiElement member, PyType type, TypeEvalContext context) { + return 0; + } +} diff --git a/python/src/META-INF/python-core.xml b/python/src/META-INF/python-core.xml index e70b65002e2b..e67f7ebf8582 100644 --- a/python/src/META-INF/python-core.xml +++ b/python/src/META-INF/python-core.xml @@ -627,6 +627,7 @@ + diff --git a/python/src/com/jetbrains/numpy/codeInsight/NumpyDocStringTypeProvider.java b/python/src/com/jetbrains/numpy/codeInsight/NumpyDocStringTypeProvider.java index e2cf925bcd1f..0406f4694ba2 100644 --- a/python/src/com/jetbrains/numpy/codeInsight/NumpyDocStringTypeProvider.java +++ b/python/src/com/jetbrains/numpy/codeInsight/NumpyDocStringTypeProvider.java @@ -46,13 +46,18 @@ import java.util.*; */ public class NumpyDocStringTypeProvider extends PyTypeProviderBase { private static final Map NUMPY_ALIAS_TO_REAL_TYPE = new HashMap(); + public static String NDARRAY = "numpy.core.multiarray.ndarray"; + + private static String NDARRAY_OR_ITERABLE = NDARRAY + " or collections.Iterable"; static { - NUMPY_ALIAS_TO_REAL_TYPE.put("ndarray", "numpy.core.multiarray.ndarray"); - NUMPY_ALIAS_TO_REAL_TYPE.put("numpy.ndarray", "numpy.core.multiarray.ndarray"); + NUMPY_ALIAS_TO_REAL_TYPE.put("ndarray", NDARRAY); + NUMPY_ALIAS_TO_REAL_TYPE.put("numpy.ndarray", NDARRAY); // 184 occurrences - NUMPY_ALIAS_TO_REAL_TYPE.put("array_like", "numpy.core.multiarray.ndarray or collections.Iterable"); - NUMPY_ALIAS_TO_REAL_TYPE.put("array-like", "numpy.core.multiarray.ndarray or collections.Iterable"); + + NUMPY_ALIAS_TO_REAL_TYPE.put("array_like", NDARRAY_OR_ITERABLE); + + NUMPY_ALIAS_TO_REAL_TYPE.put("array-like", NDARRAY_OR_ITERABLE); // Parameters marked as 'data-type' actually get any Python type identifier such as 'bool' or // an instance of 'numpy.core.multiarray.dtype', however the type checker isn't able to check it. // 30 occurrences @@ -61,8 +66,8 @@ public class NumpyDocStringTypeProvider extends PyTypeProviderBase { // 16 occurrences NUMPY_ALIAS_TO_REAL_TYPE.put("scalar", "int or long or float or complex"); // 10 occurrences - NUMPY_ALIAS_TO_REAL_TYPE.put("array", "numpy.core.multiarray.ndarray or collections.Iterable"); - NUMPY_ALIAS_TO_REAL_TYPE.put("numpy.array", "numpy.core.multiarray.ndarray or collections.Iterable"); + NUMPY_ALIAS_TO_REAL_TYPE.put("array", NDARRAY_OR_ITERABLE); + NUMPY_ALIAS_TO_REAL_TYPE.put("numpy.array", NDARRAY_OR_ITERABLE); // 9 occurrences NUMPY_ALIAS_TO_REAL_TYPE.put("any", "object"); // 5 occurrences diff --git a/python/src/com/jetbrains/numpy/codeInsight/NumpyModuleMembersProvider.java b/python/src/com/jetbrains/numpy/codeInsight/NumpyModuleMembersProvider.java index 0d407ad56a64..bd96bd653b7f 100644 --- a/python/src/com/jetbrains/numpy/codeInsight/NumpyModuleMembersProvider.java +++ b/python/src/com/jetbrains/numpy/codeInsight/NumpyModuleMembersProvider.java @@ -42,13 +42,24 @@ public class NumpyModuleMembersProvider extends PyModuleMembersProvider { "float16", "float32", "float64", "float80", "float96", "float128", "float256", "complex32", "complex64", "complex128", "complex160", "complex192", "complex256", "complex512", "double" }; + private static final String[] PYTHON_TYPES = { + "int_", "bool_", "float_", "cfloat", "string_", "str_", + "unicode_", "object_", "complex_", "bytes_", "byte", "ubyte", "void", + "short", "ushort", "intc", "uintc", "intp", "uintp", "uint", + "longlong", "ulonglong", "single", "csingle", + "longfloat", "clongfloat"}; + + private static String DTYPE = "numpy.core.multiarray.dtype"; @Override protected Collection getMembersByQName(PyFile module, String qName) { if ("numpy".equals(qName)) { final List members = new ArrayList(); for (String type : NUMERIC_TYPES) { - members.add(new PyCustomMember(type, "numpy.core.multiarray.dtype", false)); + members.add(new PyCustomMember(type, DTYPE, false)); + } + for (String type : PYTHON_TYPES) { + members.add(new PyCustomMember(type, DTYPE, false)); } addTestingModule(module, members); return members; diff --git a/python/src/com/jetbrains/numpy/codeInsight/NumpyResolveRater.java b/python/src/com/jetbrains/numpy/codeInsight/NumpyResolveRater.java new file mode 100644 index 000000000000..304e9e77c9c1 --- /dev/null +++ b/python/src/com/jetbrains/numpy/codeInsight/NumpyResolveRater.java @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jetbrains.numpy.codeInsight; + +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiNamedElement; +import com.jetbrains.python.PyNames; +import com.jetbrains.python.psi.impl.PyResolveResultRaterBase; +import com.jetbrains.python.psi.types.PyType; +import com.jetbrains.python.psi.types.PyTypeChecker; +import com.jetbrains.python.psi.types.PyTypeParser; +import com.jetbrains.python.psi.types.TypeEvalContext; + +public class NumpyResolveRater extends PyResolveResultRaterBase { + + @Override + public int getMemberRate(PsiElement member, PyType type, TypeEvalContext context) { + if (member instanceof PsiNamedElement) { + final PyType ndArray = PyTypeParser.getTypeByName(member, NumpyDocStringTypeProvider.NDARRAY); + if (PyTypeChecker.match(ndArray, type, context) && + PyNames.isRightOperatorName(((PsiNamedElement)member).getName())) { + return 100; + } + } + return 0; + } +} diff --git a/python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java b/python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java index d4d5a0fa679c..7f2596e9c0c6 100644 --- a/python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java +++ b/python/src/com/jetbrains/python/psi/resolve/ResolveImportUtil.java @@ -384,7 +384,7 @@ public class ResolveImportUtil { rate += 100; } for (PyResolveResultRater rater : Extensions.getExtensions(PyResolveResultRater.EP_NAME)) { - rate += rater.getRate(target); + rate += rater.getImportElementRate(target); } } ret.poke(target, rate); @@ -396,7 +396,7 @@ public class ResolveImportUtil { /** * @param element what we test (identifier, reference, import element, etc) * @return the how the element relates to an enclosing import statement, if any - * @see com.jetbrains.python.psi.resolve.PointInImport + * @see PointInImport */ @NotNull public static PointInImport getPointInImport(@NotNull PsiElement element) { diff --git a/python/src/com/jetbrains/python/psi/types/PyClassTypeImpl.java b/python/src/com/jetbrains/python/psi/types/PyClassTypeImpl.java index 922aaaf2155a..6d26167fe947 100644 --- a/python/src/com/jetbrains/python/psi/types/PyClassTypeImpl.java +++ b/python/src/com/jetbrains/python/psi/types/PyClassTypeImpl.java @@ -37,6 +37,7 @@ import com.jetbrains.python.codeInsight.PyCustomMember; import com.jetbrains.python.codeInsight.PyCustomMemberUtils; import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.impl.PyBuiltinCache; +import com.jetbrains.python.psi.impl.PyResolveResultRater; import com.jetbrains.python.psi.impl.ResolveResultList; import com.jetbrains.python.psi.resolve.*; import com.jetbrains.python.psi.stubs.PyClassNameIndex; @@ -190,9 +191,16 @@ public class PyClassTypeImpl extends UserDataHolderBase implements PyClassType { classMember = resolveByOverridingAncestorsMembersProviders(this, name, location); if (classMember != null) { - return ResolveResultList.to(classMember); + final ResolveResultList list = new ResolveResultList(); + int rate = RatedResolveResult.RATE_NORMAL; + for (PyResolveResultRater rater : Extensions.getExtensions(PyResolveResultRater.EP_NAME)) { + rate += rater.getMemberRate(classMember, this, context); + } + list.poke(classMember, rate); + return list; } + if (inherited) { for (PyClassLikeType type : myClass.getAncestorTypes(context)) { if (type instanceof PyClassType) { diff --git a/spellchecker/src/com/intellij/spellchecker/tokenizer/EscapeSequenceTokenizer.java b/spellchecker/src/com/intellij/spellchecker/tokenizer/EscapeSequenceTokenizer.java index b9ab65389aed..5f6c9c285cc6 100644 --- a/spellchecker/src/com/intellij/spellchecker/tokenizer/EscapeSequenceTokenizer.java +++ b/spellchecker/src/com/intellij/spellchecker/tokenizer/EscapeSequenceTokenizer.java @@ -28,7 +28,7 @@ public class EscapeSequenceTokenizer { StringBuilder currentToken = new StringBuilder(); int currentTokenStart = startOffset; for (int i = 0; i < unescapedText.length(); i++) { - if (offsets[i+1]-offsets[i] == 1) { + if (offsets[i+1]-offsets[i] == 1 || !Character.isWhitespace(unescapedText.charAt(i))) { if (currentToken.length() == 0) { currentTokenStart = offsets[i] + startOffset; }