Commit Graph
91 Commits
Author SHA1 Message Date
Daniil Kalininandintellij-monorepo-bot 646ba00a3d PY-61857 Implement PEP 695 Type Parameter Syntax usage inspection:
Inspection covers such cases:
* Extending typing.Generic in new-style generic classes
* Extending parameterized typing.Protocol in new-style generic classes
* Using generic upper bounds and constraints with type parameters for ParamSpec and TypeVarTuple
* Mixing traditional and new-style type variables
* Using traditional type variables in new-style type aliases

GitOrigin-RevId: 8812959f64d2d87e1b72f713405edb86936220b9
2023-11-06 19:59:18 +00:00
Andrey.Matveevandintellij-monorepo-bot c24752ceb1 PY-58752 Impl inspection for check matching override signature
GitOrigin-RevId: 4520138ac657a514b53f2f939521f0336701be46
2023-10-22 10:27:24 +00:00
Vladimir Koshelevandintellij-monorepo-bot 29f0eb6c77 [python] extract python parser to a separate module
Merge-request: IJ-MR-116296
Merged-by: Vladimir Koshelev <Vladimir.Koshelev@jetbrains.com>

GitOrigin-RevId: e7559fb3215d757e6273543e4aa27d52df755e63
2023-10-09 11:56:10 +00:00
Olga.Lavrichenkoandintellij-monorepo-bot b554080676 DS-5431 Column names are not at the top of the completion suggestions list in Jupyter notebook
Merge-request: IJ-MR-113147
Merged-by: Olga Lavrichenko <Olga.Lavrichenko@jetbrains.com>

GitOrigin-RevId: 777ade236fcbe9e596cc61cc20cce072f2d3ef97
2023-08-17 12:57:00 +00:00
Mikhail Golubevandintellij-monorepo-bot 1a854fceb8 PY-55246 Enable back .pyi stubs bundled with numpy
We turned them off as part of PY-48166. Now these stubs are much more complete
and fix a number of problems with the code insight for the library (PY-35164,
PY-37461, PY-50394, PY-59347, PY-60224), most of which are caused by the lack
of information in skeletons automatically generated for its binary modules or
incorrect type information being extracted from docstrings.

I leave the possibility to disable the stubs for the time being and will remove
the registry option once it become clear that they don't cause serious problems.

GitOrigin-RevId: 0df09ddb8ca40f88b908e19c0f49f5b005abaa58
2023-07-14 14:00:34 +00:00
Lada Gaginaandintellij-monorepo-bot 454b1287ae PY-58857 Infer typing.LiteralString for string literals
GitOrigin-RevId: 27507deabd61faedf7937415016f0f8334e5a418
2023-06-21 16:32:22 +00:00
Daniil Kalininandintellij-monorepo-bot 157b23ce53 PY-33261 Inlay parameter hints for Python method and function calls
Merge-request: IJ-MR-108471
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: 1d9451020a755c0aaf57c12b16829f8b31291e5d
2023-06-20 05:27:45 +00:00
lada.gaginaandintellij-monorepo-bot e768aa3785 PY-40996 Add ability to collapse and expand python type annotations
"Collapse/Expand Python Type Annotations" actions, an intention and a setting

GitOrigin-RevId: e055538b29b07c1836399f52754b786a15351050
2023-06-16 19:08:16 +00:00
Trinh Anh Ngocandintellij-monorepo-bot c9f0c216a0 [PY-56210] Add id for PyModuleNameCompletionContributor
Allow other contributors to take priority over it if needed

closes https://github.com/JetBrains/intellij-community/pull/2197

GitOrigin-RevId: 06e7378ddb47a57dc8e934afcadd7f0d1b88bbb7
2023-06-15 20:21:10 +00:00
Olga.Lavrichenkoandintellij-monorepo-bot b221598456 DS-4113 Columns are duplicated in completion suggestions in python console
GitOrigin-RevId: 527cfd230c94b229ccf2f5d5263ba1171614cabb
2023-05-19 17:53:17 +00:00
Petr Golubevandintellij-monorepo-bot 21b7c85809 deduplicate enable.numpy.pyi.stubs registry key registration
GitOrigin-RevId: 982b0b9b177839941a24d581f0587bcd65a5b8d8
2022-11-03 20:26:19 +00:00
Petr Golubevandintellij-monorepo-bot 9862779c8a move PyImportOptimizer registration to PythonPsiImpl.xml
GitOrigin-RevId: c85bf8ddc9dad1fdfcdc03d26aa391b162c97587
2022-11-03 20:26:14 +00:00
Petr Golubevandintellij-monorepo-bot b461792bc2 register PythonCommenter in the module where it's defined (python.psi.impl)
GitOrigin-RevId: b6c84e51058da5a78b9ae8270b682006b98e1950
2022-11-03 20:26:01 +00:00
Petr Golubevandintellij-monorepo-bot 68f080743c move python formatter extensions to python.psi.impl module
GitOrigin-RevId: 452346cbd12e9c21c636dc8dbcab9a29813bc67b
2022-11-03 14:27:33 +00:00
Mikhail Golubevandintellij-monorepo-bot 59e79c3c7c PY-54503 Provide the result type for Enum[...].value and Enum(...).value
Precise types can be inferred only over AST if it's accessible.

I had to move PyStdlibTypeProvider higher in the provider's hierarchy
so that it could override types coming from Typeshed, otherwise we
infer enum.property type for the "value" attribute.

GitOrigin-RevId: 8727e080cfc06d0edda13eccfd601601dc661da9
2022-09-02 20:51:03 +00:00
Daniil Kalininandintellij-monorepo-bot 44d07d2450 PY-20811 Support for typing.ClassVar type annotations (PEP 526)
* Dedicated inspections for `ClassVar` variables in variable declarations, variable reassignments, function parameters, local and return variables
* Types of `ClassVar` variables now resolves correctly
* Tests for `ClassVar` inspections

GitOrigin-RevId: 0fd0ef0126ba2c2801ef82bcbeca4ea9b0c48c73
2022-05-24 20:12:55 +00:00
Mikhail Golubevandintellij-monorepo-bot ff82f4e058 PY-47254 Don't duplicate already imported module names in completion
By running the completion contributor for non-imported modules after everything
else, including the LegacyCompletionContributor offering names present in
the scope, and filtering out duplicate variants.

GitOrigin-RevId: 98982b2c33d1fc11d70b144de556a6825bd3febc
2022-02-23 11:55:12 +00:00
Lada Gaginaandintellij-monorepo-bot c7d12e929d PY-40007 PY-41546 Add completion for keys of dict literals marked as TypedDicts
- in call expressions
- in assignment statements
- in return statements

GitOrigin-RevId: aea2063f7cd7ffc68903c79fa16a25fdf4ff0f8f
2022-02-21 21:13:02 +00:00
Dmitry Trofimovandintellij-monorepo-bot f35438983c CodeServer: support Python inline variable and inline method refactorings
Also decouple BaseRefacgoringProcessor from UI and split usageView into api and impl parts

GitOrigin-RevId: c4c6d9011726d93f0ee6ab4677f7a105c28ec108
2022-02-08 13:31:12 +00:00
Alexander Bozhnyukandintellij-monorepo-bot 82a71bcc5c DS-1131 Moving to intellij.python.psi.impl and writing tests.
(cherry picked from commit 28cbf907a7be647fb7fbb4b7fdf822ce36303283)

IJ-MR-17101

GitOrigin-RevId: 70cbab8656c0c9d81e8cf870b699a49c8b12b74e
2021-12-02 21:13:07 +00:00
Aleksei Kniazevandintellij-monorepo-bot f8c2ad4f8a arguments literals are now stored in python decorator stub (PY-50382)
this makes accessing decorator arguments possible without needing to parse the file again

(cherry picked from commit a9854dbf181f3c7bf488d6ecc18205bb29df2422)

IJ-MR-15304

GitOrigin-RevId: 1031d888a4a08a706c4fa9e2dc48e2f97462c95e
2021-10-18 20:55:54 +00:00
Mikhail Golubevandintellij-monorepo-bot 1421975c96 PY-48012 Resolve and complete attributes in PEP 634 class patterns
Both are implemented other the type of the corresponding class.
References resolve to any readable attribute of a class, however
some obviously wrong variants such as special "dunder" attributes
and methods are intentionally excluded from completion suggestions.

GitOrigin-RevId: 5edac14f47cba39840b15b0dd7f21e2e46077261
2021-10-15 17:36:56 +00:00
Mikhail Golubevandintellij-monorepo-bot 3abdca30b5 i18n: Extract intention groups "Python" and "Django"
GitOrigin-RevId: e70b02e7c5f051ba254a13a06917083f29f5bfb3
2021-07-07 11:44:14 +00:00
Sergey Stupinandintellij-monorepo-bot 37e61ab8ef LAB-31 move python comment/hint parsers to psi-impl
GitOrigin-RevId: 7291a16267d9acb06c188bd2c5c1391d74f3178d
2021-05-18 11:08:40 +00:00
Semyon Proshevandintellij-monorepo-bot 1f898d43af Remove PyStringExceptionInspection and PyWrapInExceptionQuickFix as no longer relevant for supported python versions
GitOrigin-RevId: 9718219e670d2fe0a8e7c710f9c789c9b8f25dd9
2021-04-30 10:35:10 +00:00
Andrey Vlasovskikhandintellij-monorepo-bot 6d8428ee4e PY-46321 Renamed PyDocstring into Doctest to make more sense as a user-visible name in Markdown code fence blocks
GitOrigin-RevId: 1284ab756e522db0c8109b59d6d78b1d1f503a7f
2021-04-27 17:32:03 +00:00
Andrey Vlasovskikhandintellij-monorepo-bot 44b1a7097f PY-46321 Disabled the code formatter for PyDocstring language
PyDocstring is based on Python, but its custom tokens `>>>` and `...` are registered just as whitespace. These tokens are ignored by the Python code formatter, which results in exceptions from the formatting model, which doesn't cover the whole text range.

We could either fix the formatting model or just disable formatting for PyDocstring. I prefer the latter for now, since the current approach with PyDocstring being a dialect of Python results in many subtle errors. It's better to have a workaround for now and maybe re-write doctest support later.

GitOrigin-RevId: 68b9a57650631f5d7245c85ada294af85c0aad44
2021-04-27 17:32:01 +00:00
Semyon Proshevandintellij-monorepo-bot 35760b1f43 Don't resolve to numpy pyi stubs (PY-48166)
See https://github.com/numpy/numpy/issues/18565

IJ-CR-8182

GitOrigin-RevId: f97c373dc3b388d094552068acb96e3280e56724
2021-04-16 15:34:38 +03:00
Lada Gaginaandintellij-monorepo-bot 6674b17b74 PY-44026 Introduce PyModuleNameCompletionContributor
GitOrigin-RevId: 8f18f0f03f1ddec5da7aa229b8671224f0d231e3
2021-02-17 15:56:30 +00:00
Lada Gaginaandintellij-monorepo-bot 383dc15c13 PY-44026 Add completion for empty attribute prefix to PyUnresolvedModuleAttributeCompletionContributor
GitOrigin-RevId: 3354826398aa85adc54742155da90138cd9a2279
2021-02-17 15:56:27 +00:00
Mikhail Golubevandintellij-monorepo-bot e4565c3515 PY-44026 Try using the new index with another contributor for unresolved module attributes
It includes several impovements over the existing implementation:

* Full qualifier it considered instead of just its last component, e.g. "foo.bar"
for "foo.bar.Baz<caret>", not just "bar".
* These results are not suggested for references that are themselves qualifiers for
other attributes, e.g. in "foo.ba<caret>r.Baz()".
* Completion is automatically restarted as soon as attribute prefix appears, i.e.
as soon as any extra character is typed in "foo.<caret>".
* Completion uses an apropriate scope, excluding stdlib's tests
* New variants are added incrementally and respecting PCE, not in a batch, to improve
responsiveness

GitOrigin-RevId: d6a84bf3a2096e60fca87794da6ed5836c5b9244
2021-02-17 15:56:24 +00:00
Mikhail Golubevandintellij-monorepo-bot e07b409cb8 PY-44026 Add a specialized index for fast qualified name lookup
The new stub-based index maps names of all "public" top-level definitions
to the corresponding PSI elements. Fully qualified names are matched by
both definition's short name and an already typed reference qualifier, i.e.
"foo.bar.MyClass" matches "foo.My" and "bar.My" but not "foo.bar". Qualified
names are initially restored directly from VFS without any normalization or
canonization to improve performance, but then properly canonized before
displaying them among completion suggestions.

GitOrigin-RevId: 768ef6d51e535e8102fca0693c7a51db400fc783
2021-02-17 15:56:22 +00:00
Lada Gaginaandintellij-monorepo-bot 800b75adac PY-44026 Add initial PyUnresolvedModuleAttributeCompletionContributor implementation
GitOrigin-RevId: 2b6b3660bf3f372e86fb479637f76d324b713d0b
2021-02-17 15:56:22 +00:00
andrey.matveevandintellij-monorepo-bot a350ff045f PY-46668 Impl multiple arguments completion contributor
(cherry picked from commit 42efe6a20f52cfb3bd827a2b68d1fb6cc3949626)

IJ-MR-5791

GitOrigin-RevId: e2a40572b0de4919a5049ff06e437b34d78c296c
2021-02-15 13:29:14 +00:00
Mikhail Khorkovandintellij-monorepo-bot 28ff3568f3 PY-37362 PY-27142 Add infer types of decorated methods
Now we can infer decorated method's type based on the type or
type hints of their decorators. It is possible to use several
decorators on the method.

GitOrigin-RevId: 22f934ab5be9cb49a4ae65cbd72e17a7d1505778
2021-02-08 08:21:27 +00:00
Mikhail Khorkovandintellij-monorepo-bot 058c2e5e42 PY-43388 Add basic type checker support in Cython files
Now we can export Cython and Python functions with type
annotations from .pyx files to both .pyx and .py files.
Also we can make type matching in Cython files.
Type checker only support numeric types for now.

GitOrigin-RevId: a7af4264285cc14e09991545998609fbd24432e5
2021-01-12 10:06:47 +00:00
Petr Golubevandintellij-monorepo-bot 1e0a48cb6c mv PySignatureCacheManagerImpl to intellij.python.psi.impl
GitOrigin-RevId: eb8f8dbe0db9396ba9339d605ce726e99062dc15
2020-11-17 16:45:17 +00:00
Semyon Proshevandintellij-monorepo-bot fbbb78bc4e Change receiver for initialization calls and don't resolve callee to constructors
Callee is now a receiver for these cases, previously it was `null`.
Callee is not replaced with constructors to have an ability to map it onto self/cls parameters and process `(cls: Type[T], ...) -> T` annotations.
Stay with the previous behaviour for navigation and looking for target element.

GitOrigin-RevId: c0f9894cf50fd5d7fd325f095976d096fb948e89
2020-11-11 19:30:34 +00:00
Irina Fediaevaandintellij-monorepo-bot 1e8a086708 PY-35698, PY-33565: Delete obsolete PyCallByClassInspection. Type checker inspection covers most of the cases since there is always some type inferred for cls/self.
IDEA-CR-68591

GitOrigin-RevId: fef66f2e1e4d17de50fcca248a3ddc957f3c316d
2020-11-10 13:31:16 +00:00
Vasya Aksyonovandintellij-monorepo-bot 226cf2c350 PY-15046: Invert 'if' statement implementation
GitOrigin-RevId: 86ddfbe04b635d9db288b273540d06d83963cebe
2020-10-19 15:47:25 +00:00
Stanislav Utikeevandintellij-monorepo-bot 73dcad36e8 LAB-31 Move TensorFlow members providers to psi-impl
GitOrigin-RevId: 5283df23d8abdc7795fde7850281b876c73a25a0
2020-09-22 15:06:44 +00:00
Mikhail Golubevandintellij-monorepo-bot 566dd6af21 i18n: Remove more unused messages from PyPsiBundle
Some inspection had duplicated messages for their names. Normalized those
to use "INSP.NAME" keys for that purpose and removed unused copies.

Also, one of the messages was used only in a test commented ten years ago.
Got rid of that and the corresponding test data.

GitOrigin-RevId: c859370a8b62079e9e345cd03386da850de28586
2020-08-25 08:47:06 +00:00
Semyon Proshevandintellij-monorepo-bot d8873570c5 Update PyCallExpressionHelper.getCallType to ask callee type for result
Get rid of PyNamedTupleType.DefinitionLevel (finally) and PyOverridingTypeProvider.

PyNamedTupleType is updated here since otherwise we would have to provide parameters for PyNamedTupleType with NT_FUNCTION as a definition level via PyNamedTupleType.getParameters.

Update NumpyDocStringTypeProvider and numpy test data, otherwise it will return `numpy.core.ufunc` as a type for every function having special name.
See NumpyDocStringTypeProvider.getReferenceType.

Return accidentally lost behaviour in PyiUtil.findSimilarElement for classes: don't look for similar element in ancestors.

GitOrigin-RevId: e2410eaa0e0cd5f98e4a86515b4358c140b373e6
2020-08-24 18:58:43 +00:00
Mikhail Golubevandintellij-monorepo-bot df56210439 i18n: Remove unused and rename messages in PyPsiBundle containing "$N" in keys
These are not properly supported and often falsely reported as unused.

GitOrigin-RevId: cb9c9ce8096e14ecaff0b4f473cbb4a028eb3b44
2020-08-24 13:16:59 +00:00
Mikhail Golubevandintellij-monorepo-bot bc607f85ed i18n: Extract messages from remaining pure-Python inspection
* PyTypeCheckerInspection
* PyTypedDictInspection
* PyUnnecessaryBackslashInspection
* PyUnresolvedReferencesInspection
* PyUnusedLocalInspectionVisitor
* PyTypeHintsInspection

GitOrigin-RevId: 62d72bf38ef48412baf52960bc9da2b9f6d09070
2020-08-24 13:16:58 +00:00
Mikhail Golubevandintellij-monorepo-bot 0e3afcf3ef i18n: Extract messages from and annotate several Python inspections
* PyFinalInspection
* PyFromFutureImportInspection
* PyInconsistentIndentationInspection
* PyInterpreterInspection
* PyListCreationInspection
* PyMandatoryEncodingInspection
* PyMissingTypeHintsInspection
* PyNonAsciiCharInspection
* PyOverloadsInspection
* PyPackageRequirementsInspection
* PyPep8NamingInspection
* PyPropertyDefinitionInspection
* PyProtectedMemberInspection
* PyProtocolInspection
* PyShadowingBuiltinsInspection
* PyStatementEffectInspection
* PyStringFormatInspection
* PyTupleAssignmentBalanceInspection

I also replaced some existing message keys that used poorly recognized "$1"
notation or otherwise diverged from the convention in use, and updated
annotations in PythonUiService where needed.

GitOrigin-RevId: 75d73d38104c806ad5065e87f76e274b502e889d
2020-08-21 10:03:22 +00:00
Mikhail Golubevandintellij-monorepo-bot 4365fe225c i18n: Extract messages from several Python inspections
GitOrigin-RevId: 2984a5da8f02308dc5c303fdb37ebb1015bc25c1
2020-08-20 11:49:39 +00:00
Mikhail Golubevandintellij-monorepo-bot 91b2855a68 i18n: Extract messages from PyDataclassInspection
GitOrigin-RevId: b8417357579f8e7eae18ddba5fe5231647c55757
2020-08-20 11:49:38 +00:00
Mikhail Golubevandintellij-monorepo-bot 7d9e25a990 i18n: Extract messages and annotate several trivial Python inspections
GitOrigin-RevId: d7ed1efc53ae0c8034e8aa52def685b421c9b4cb
2020-08-19 14:22:05 +00:00
Semyon Proshevandintellij-monorepo-bot 1e9182b7e0 Run PyCollectionTypeByModificationsProvider last since it could affect type inference due to recursion inside (PY-39510)
GitOrigin-RevId: 619db13e01470e9ac5f1a75a46e3cd791042f405
2020-08-04 13:27:41 +00:00