Commit Graph

911 Commits

Author SHA1 Message Date
Mikhail Golubev
5b0ab3eb33 PY-29435 Treat the "__debug__" name as having unknown boolean value
GitOrigin-RevId: 4fdb08f28e21f9a08cf99491219d6cca0480d027
2022-07-22 16:33:36 +00:00
andrey.matveev
e3d08d174d PY-29435 Define __debug__ as true to avoid inspection code unreachable
GitOrigin-RevId: 2cf319b7e0e4668c74f1ac05acc4161fbe3154fe
2022-07-22 13:30:34 +00:00
Mikhail Golubev
7d0f963d99 PY-54712 Make AddParameterQuickFix work with preview
GitOrigin-RevId: 17c74a35c346ad179d423a61f1bb7f7d74fa74e4
2022-07-21 21:19:18 +00:00
Mikhail Golubev
b717611b1e PY-54712 Make UnresolvedRefCreateFunctionQuickFix work with preview
GitOrigin-RevId: 0039ae56b46f44eab34eb644b6d0b4d08068c976
2022-07-21 21:19:15 +00:00
Mikhail Golubev
d3ab277998 PY-54712 Make UnresolvedReferenceAddSelfQuickFix work with preview
GitOrigin-RevId: ac7a66b29695384e82afea67e05484cd1177dcc5
2022-07-21 21:19:12 +00:00
Mikhail Golubev
55e7b63a37 PY-54712 Make UnresolvedRefTrueFalseQuickFix work with preview
GitOrigin-RevId: ea3399e0bf080d1f3d2d36f28b3cd52cb0b9be4a
2022-07-21 21:19:09 +00:00
Mikhail Golubev
29ebc4d54d Add nullability annotations and fix possible NPE in ChangeTypeQuickFix
GitOrigin-RevId: 71c7cf075cab612a9377958df1fb82335e69c8f7
2022-07-21 21:19:07 +00:00
Mikhail Golubev
527bf14a02 PY-54712 Make ChangeTypeQuickFix work with preview
GitOrigin-RevId: 26c988c75355f79bb237230098820ad597d8bb34
2022-07-21 21:19:04 +00:00
Mikhail Golubev
1f0eb4c8e2 PY-54712 Make RemoveArgumentEqualDefaultQuickFix work with preview
GitOrigin-RevId: 64f3ea76f0413cd492edb9177c92d1db9e8043eb
2022-07-21 21:19:01 +00:00
Mikhail Golubev
5925045fe1 PY-54712 Disable preview for IgnoreBaseClassQuickFix
GitOrigin-RevId: 3d533c52c826729724b08661f8b8758d89fa8305
2022-07-21 21:18:56 +00:00
Mikhail Golubev
7df7e51230 PY-54712 Make DocstringQuickFix work with preview
I had to update PyUtil.updateDocumentUnblockedAndCommitted to work properly
with non-physical files. In turn, it suddenly made an old formatting test
properly apply PyTrailingBlankLinesPostFormatProcessor to its target file.

GitOrigin-RevId: 0c90a3f6000b5f451697b5743930ef1f84a58b63
2022-07-21 21:18:53 +00:00
Mikhail Golubev
9bcdf08a3e PY-54712 Make AutoImportQuickFix work with preview
I had to extract AutoImportLocallyQuickFix because, otherwise, an implicit
reference to "this" of an enclosing class in an inner class prevents the default
preview machinery from working (there is no way to annotate such a field).

GitOrigin-RevId: 82b4e64f19f9fc47c95726e02d3ee9880f1e7278
2022-07-21 21:18:50 +00:00
Mikhail Golubev
cf0251112f PY-54712 Make PyMakeFunctionReturnTypeQuickFix work with preview
GitOrigin-RevId: f315451be3844c33bc4585a2439010fc9b859e54
2022-07-21 21:18:48 +00:00
Mikhail Golubev
2a7dc84efe PY-54712 Make CreateClassQuickFix work with preview
GitOrigin-RevId: 5adc8af40e108b582f578fce5ef87d88bfa1c995
2022-07-21 21:18:45 +00:00
Mikhail Golubev
a27e97d175 PY-54712 Make ListCreationQuickFix work with preview
GitOrigin-RevId: e8265ef1cad6701dd79f772a7df39c4c60fae64d
2022-07-21 21:18:42 +00:00
Mikhail Golubev
b4f4f5d1cb PY-54712 Make DictCreationQuickFix work with preview
GitOrigin-RevId: 47a11252fb25db68e6e24c354833295907ed788f
2022-07-21 21:18:39 +00:00
Vladimir Krivosheev
57f7e14ea5 don't schedule post-start-up activities under modal progress
GitOrigin-RevId: 2ac572b66cf0ad8bc28a5713bc71967a8700f19d
2022-07-20 14:06:46 +00:00
Vladimir Krivosheev
c542bbd12d prefer to not use ExtensionPointName.extensions() (part 2- java)
In Kotlin streams should be not used, in Java extensions() maybe not performant if you in any case traverse the whole extension point

GitOrigin-RevId: 0b2f9df27d9580c22e78f8017b5d21edeb39e8df
2022-07-20 04:39:56 +00:00
Vladimir Krivosheev
fe9812cfff prefer to not use ExtensionPointName.extensions()
In Kotlin streams should be not used, in Java extensions() maybe not performant if you in any case traverse the whole extension point

GitOrigin-RevId: f9ef0ce23617ffc8c89a4fe6df54142b8f6ca7dc
2022-07-20 04:39:55 +00:00
Mikhail Golubev
4430c9794d Make PyBoundFunction not unstub a wrapped PyFunction upon construction
It was caused by function.getNode() in its constructor. The right way to make
it work with PSI stubs is to delegate completely to the wrapped PyFunction.
Just accepting a PyFunctionStub in its constructor is not enough, as a reference
to the original stub owner is saved inside PSI stub-managing logic, hence it's
restored on a different (original) element.

This synthetic element is not used often in our codebase, but this change will
prevent unstubbing problems if additional usages appear eventually.

I stumbled across it while experimenting with returning a PyBoundFunction from
PyResolveUtil.resolveQualifiedNameInScope for PY-53671.

GitOrigin-RevId: 6b205a7eb5dbe764d1b135ddda975574785b25e2
2022-07-19 15:06:12 +00:00
Mikhail Golubev
342afe673d Don't force resolving attributes over instance types in PyResolveUtil.resolveQualifiedNameInScope
GitOrigin-RevId: ee87975bc55f9bca67eb7eea28a0de2af87ceed3
2022-07-19 15:06:09 +00:00
Mikhail Golubev
63461fb262 PY-53671 Don't treat methods qualified with a module as unbound
While resolving an aliased method exported from a module, we might lose
the context that it was referenced via instance and hence its first "self"
parameter is already bound and doesn't need to be passed explicitly.
The reason is PyResolveUtil#doResolveQualifiedNameInScope (called in
PyTargetExpressionImpl.multiResolveAssignedValue) performs resolve
over qualified names saved in PSI stubs and returns plain PsiElements
(end results) that don't retain such information about their qualifiers.
QualifiedResolveResult can't be used there either because we don't keep
PyExpressions in PSI stubs. What's more, when later such function is referenced
via some module we consider it definitely unbound, even though a module cannot
possibly have a method as its immediate attribute. I changed the logic so that
we no longer consider referencing a method through a module as somehow affecting
its bound/unbound state.

GitOrigin-RevId: 17a6c3e5d43c088d0663ba54651004c8370d5eca
2022-07-19 15:06:06 +00:00
Elizaveta Shashkova
4caabd9b52 PY-54471 Revert support for events not covered by workspace model
GitOrigin-RevId: 296050cb07c5b41ef8dd2b21d66792d28d664362
2022-07-15 08:56:46 +00:00
Elizaveta Shashkova
9231d23125 PY-54471 Migrate ModuleRootListener to incremental changes: PythonModulePathCache
GitOrigin-RevId: 0b98df6eeb3ee76f221c7d1e4124877deba03c76
2022-07-13 20:38:42 +00:00
Tagir Valeev
59810ee9a3 [util] Predicates class to reduce number of loaded lambdas
GitOrigin-RevId: a89c8375b79468afd0b263fe670b83dcf85b96f6
2022-07-08 16:40:46 +00:00
lada.gagina
6bdc3d4237 PY-53611 Add support of Required and NotRequired TypedDict type specifications (PEP-655)
Makes it possible to mark individual TypedDict keys as required or not required, covered in [PEP-655](https://peps.python.org/pep-0655/)

GitOrigin-RevId: 6567fd1009430e37f32924eb29ab8b4a1a17f315
2022-06-21 20:29:34 +00:00
Alexey Kudravtsev
f82efb1a29 codestyle settings: notnull
GitOrigin-RevId: 23b0698670f6417b909a98b070ee0ad4c0340118
2022-05-31 12:28:41 +00:00
Ilya.Kazakevich
c400e65470 `target://` prefix is redundant.
According to new rules we store real target path (path on the target) as sdk home path

GitOrigin-RevId: 04ad31b24a72b83c19d2d88b3853b986534d8e59
2022-05-30 18:20:34 +00:00
Elizaveta Shashkova
6e383650ca PY-53776 Support the syntax changes of PEP 646 Variadic Generics
GitOrigin-RevId: 6ee5939eff1c0503132b013c6469de00b50b2d86
2022-05-30 09:40:36 +00:00
Alexey Belkov
9b5e8782f3 Run Kotlin inspection "Redundant nullable return type" on whole project
Plus some minor cleanups due to changed nullability.

GitOrigin-RevId: 406cf3bb86a9d1d57aa088bc0ff43cca5a8c2254
2022-05-27 22:07:13 +00:00
andrey.matveev
a50487b100 PY-50403 PY-50404 Analyse param spec container parameters
GitOrigin-RevId: 2b7653d2b52788673fcf61cdb038620162c232da
2022-05-25 13:58:22 +00:00
Daniil Kalinin
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
Alexey Belkov
bc35c5c199 Run Kotlin inspection "Variable declaration could be moved inside 'when'" on whole project
GitOrigin-RevId: a55631180acd3340bded3e0cdfa46bf3afb3cf94
2022-05-23 16:44:11 +00:00
Alexey Kudravtsev
b4fddace21 remove useless "Created by IntelliJ IDEA." comment
GitOrigin-RevId: ca35f9ed009945c2214d2c427ef2999148d8cf43
2022-05-20 16:45:58 +00:00
Daniil Ovchinnikov
2787685412 deprecate PsiModificationTracker$SERVICE
GitOrigin-RevId: ad1f9c262e0bdc68e5bb0969b26f2687c86db6ce
2022-05-18 10:28:44 +00:00
Daniil Ovchinnikov
2ba99ea824 deprecate PsiParserFacade$SERVICE
GitOrigin-RevId: 343d3419ec9f64acdbc1ff2bb8d2218b8c14d818
2022-05-18 07:55:01 +00:00
andrey.matveev
ecd113fc12 PY-52930 Support except star
(cherry picked from commit 4d03313cce07e4c3ff4748328cf2e04ba74b8d91)

IJ-MR-24242

GitOrigin-RevId: fa6c1b9077ef78b35c8f3453debcf06bcbc96364
2022-05-18 00:19:37 +00:00
Daniil Ovchinnikov
78c3e54c63 deprecate ProjectFileIndex$SERVICE
GitOrigin-RevId: 725283401fc7db28fd332d72eaa67e3a8e175259
2022-05-17 20:13:19 +00:00
Daniil Kalinin
ded2dafba4 PY-28496, PY-27660 Remove unnecessary Normal Indent which violates PEP8 codestyle rules in multiline call chains
GitOrigin-RevId: 77e738367c33673c5c5f4b46472c3a49a5f64142
2022-05-12 13:46:52 +00:00
andrey.matveev
a66dea2997 PY-50401 Impl checking name argument in ParamSpec
GitOrigin-RevId: 655026dceea03b1697e5d39ce897f2ef1f25948c
2022-05-06 12:15:27 +00:00
Daniil Kalinin
fb11ee327c PY-53200 do not autocomplete parameter list if method already have one
Test for PY-53200

Better tests for PY-53200

PY-53200 Removed unnecessary test.

`testMethodNamesDoNotDuplicateParameterList` renamed and moved closer to the corresponding ones
Removed test for method names in suggestions restored

GitOrigin-RevId: 51b0721190718c44810c16e198bad583c2af67d0
2022-05-05 11:18:29 +00:00
Mikhail Golubev
ea039cfc94 PY-42200 Annotate PyWithItem.getExpression as @NotNull and update usages
Parser was changed so that it no longer produces empty PyWithItem elements
after trailing commas.

GitOrigin-RevId: f730e68644f3444269d65d157b666267755e0d2d
2022-05-04 12:31:42 +00:00
Mikhail Golubev
97b22aaa13 PY-42200 Support parenthesized context managers in Python 3.9+
In case of syntactic ambiguity with previous versions of the grammar, such as
"with (expr)" or "with (expr1, expr2)", PyWithStatement is still parsed as
having its own parentheses, not a parenthesized expression or a tuple as
a single context expression. The latter case, even though syntactically legal,
is still reported by the compatibility inspection in Python <3.9.

These changes also include proper formatter and editing support (e.g. not
inserting backslashes on line breaks inside parentheses), as well as
Complete Current Statement, which now takes possible parentheses into account
while inserting a missing colon.

The changes in the formatter are somewhat ad-hoc, intended to minimize the effect
on other constructs. "With" statement is somewhat special in the sense that it's
the first compound statement (having a statement list) with its own list-like
part in parentheses.

Existing tests on with statement processing were expanded and uniformly named.

Co-authored-by: Semyon Proshev <semyon.proshev@jetbrains.com>

GitOrigin-RevId: 15c33e97f177e81b5ed23891063555df016feb05
2022-05-04 12:31:37 +00:00
Mikhail Golubev
c6a15fa65b Simplify a check in CompatibilityVisitor
GitOrigin-RevId: 14bc99af4e89c443bba2f8569fdfad0053459fe4
2022-05-02 15:26:54 +00:00
Lada Gagina
cc86fa5983 Fix NPE in PyDictLiteralCompletionContributor (EA-468833)
GitOrigin-RevId: 4b3c9f0e126ab0f8724cfd7e8b1ad0758540732e
2022-04-22 13:02:23 +00:00
andrey.matveev
1d609e360c EA-485045 Add check for empty argument list in PyMultipleArgumentsCompletionContributor
GitOrigin-RevId: 8a127dc0cb1cb032b5630658a75c0549d5300ad6
2022-04-07 06:02:10 +00:00
Alexey Kudravtsev
9d58c2ab19 fix non-latin symbols inadvertently mixed up with latin
GitOrigin-RevId: 13beb89a6bd42b5fa69aab57862236867d3eaf61
2022-04-06 11:05:48 +00:00
Aleksei Kniazev
05a99b5e99 [python] support Pathlib-style path declarations in PyPathEvaluator (PY-13911)
(cherry picked from commit 3673aa3bac948bae5c7e8fd6521f251285d70cf9)

IJ-MR-17579

GitOrigin-RevId: 17d336d8f6d5e16bd3dca815c2f9935911e050ee
2022-04-05 11:10:41 +00:00
Aleksei Kniazev
effa066a2d [python] switched PyPathEvaluator to nio
(cherry picked from commit f6971ee81c260b18df28c815dd2fb82551a11de2)

IJ-MR-17579

GitOrigin-RevId: b02a05a918edc1332d3550db5f118fc62ae8d86e
2022-04-05 11:10:38 +00:00
Lada Gagina
30cd450db3 PY-43689 Don't report forward references and Union types using the | operator in PyTypedDictInspection
GitOrigin-RevId: e57faacb50143381341c9320894106a9df88618e
2022-04-04 18:28:06 +00:00