Commit Graph

2168 Commits

Author SHA1 Message Date
Mikhail Golubev
4aff3ed154 PY-83039 Don't trigger PyLiteralTypeCompletionContributor in cases like x = y.foo<caret>
It should be activated only for the simplest cases when the caret is either
inside an immediate string literal or its prefix is an unqualified reference
expression. It makes little sense trying to detect if something like
the literal string `"y.foobar"` is a possible value for `x`.

It's a relatively heavy completion contributor. It starts evaluating the type of
`x` flow-sensitively, analyzing all preceding function calls to take into
account `NoReturn`. It affects common workflows like typing out
`df = pd.` to create a new Pandas dataframe.


(cherry picked from commit f17fe2ce86ee100a3480a574c7f57a1bd67ec2d8)

IJ-CR-172165

GitOrigin-RevId: 4434488b1d2dae3ab7efd72e775b0c730268e51c
2025-08-18 11:48:31 +00:00
Marcus Mews
5aaa8992d3 PY-70265 Extract Method: signature preview also displays 'async' if necessary
(cherry picked from commit 159106ec2a31e5ad5992b1bca7cde1fb55e91a43)

IJ-MR-171062

GitOrigin-RevId: ef86284a03dd202460f681c5e6686132d03a7c1d
2025-08-18 11:16:40 +00:00
Aleksandr.Govenko
31dcf9f6d5 [python] Fix NPE in PyAstAsPattern
(cherry picked from commit d8f319769d8fd25c27e6ab75b05d94d56a9751b9)

IJ-CR-172556

GitOrigin-RevId: c0c921a2ef363c9e3b33a21869cc290896372ab6
2025-08-15 13:27:10 +00:00
Aleksandr.Govenko
adcc559e5c PY-81676 Don't report lines with assert_never as unreachable
(cherry picked from commit afdbf35915823de02a6b8551f57770113d0feb2f)

IJ-CR-172556

GitOrigin-RevId: 0f8526e2877736ac606db9ed4657a530a66d6f23
2025-08-15 13:27:10 +00:00
Mikhail Golubev
d5673dceef [python] Make overlooked PyElementVisitor methods for statements delegate to visitPyStatement
(cherry picked from commit f6853d0dfc5ddcc7b40bfccead0ad779328fc751)

IJ-CR-172556

GitOrigin-RevId: b7d424930b1f4752ea69041a4ab53229b0392f5d
2025-08-15 13:27:10 +00:00
Aleksandr.Govenko
05203527a4 [python] Convert PySequencePattern and PyMappingPattern to kotlin
(cherry picked from commit 074ed9f865556d561237fc894d202d76995ab562)

IJ-MR-168826

GitOrigin-RevId: 6776375e6566521744ccc1f6c54254b887a1574b
2025-08-14 20:56:06 +00:00
Aleksandr.Govenko
21e8b573a7 PY-81861 Pattern matching for dataclasses - allow matching a subset of attributes
(cherry picked from commit 30a865e64cee7be630567b7d23223fc79eac9dbf)

IJ-MR-168826

GitOrigin-RevId: 8383913015485a6b6e477131c47d502bb655dd30
2025-08-14 20:56:06 +00:00
Aleksandr.Govenko
0dfd1f65e4 [python] Refactor PyCapturePatternImpl. Introduce PyCaptureContext
(cherry picked from commit 2e3fbf4c7d79e6031c7c087e5c7e7e49046587fd)

IJ-MR-168826

GitOrigin-RevId: b87eda39543460451311fc875d6ae3722d671db0
2025-08-14 20:56:06 +00:00
Aleksandr.Govenko
8cc52b8cf3 Rename .java to .kt
(cherry picked from commit de4536d7ce72661c150a019631734c7489af6a84)

IJ-MR-168826

GitOrigin-RevId: a42be1d1bde11865cb7076e7a4703a1c8bab1471
2025-08-14 20:56:06 +00:00
Andrey Vokin
b3a70daa05 PY-83118 Forward Reference Causes Import to Be Incorrectly Removed in PyCharm 2025.2
(cherry picked from commit fcf27e5c97e12498bc1c630f43e0a0876faba408)

IJ-CR-172300

GitOrigin-RevId: 7f3fcc83890a4ae0b0e7e6dd4ba363790f318eaa
2025-08-13 13:13:42 +00:00
Aleksandr.Govenko
4c890f2d47 PY-82707 Pycharm July 2025 EAP showing unreachable when using a subtype of Any
(cherry picked from commit c8a61ecc43754144679e5afc9f4623c02f558597)

IJ-MR-170092

GitOrigin-RevId: 612862aa2ce338a8f18e13197f483b936c9d0cdb
2025-08-11 09:57:17 +00:00
Aleksandr.Govenko
c3e7d5a7b7 PY-76896 Conformance test failure: classes_override.py
(cherry picked from commit 6603d072bd324493af12130ebec1ef0004873255)

IJ-MR-167674

GitOrigin-RevId: bd25b117b426bce0c364aaabbc9e961295421fb4
2025-08-08 21:06:50 +00:00
Ilia Zakoulov
a8675a61ac PY-82168: Implement inspection and quick fixes for dataframe and series in the conditions
(cherry picked from commit 658f2d5609852b00b7e1011c3841c7266c202686)

IJ-MR-168659

GitOrigin-RevId: 66806362570ef564b1495ba5a9afcd32a50859fb
2025-08-08 19:31:55 +00:00
Aleksandr.Govenko
6deddd7ee2 PY-81608 False positive "This code is unreachable" after try / finally if try has a while loop
(cherry picked from commit fbdefd71c5c9356c82d3c873426dd565dd95c613)

IJ-MR-169577

GitOrigin-RevId: b428a790336656088c9b3343a2f6772873cafca8
2025-08-08 18:19:44 +00:00
Aleksandr.Govenko
7e0924c394 PY-82712 False positive unreachable code after try / finally block if try has an if
(cherry picked from commit 53c13421523d780995fa83cc0625f6e99d5fe51f)

IJ-MR-169577

GitOrigin-RevId: f5254435a0512ba55db7fca9016a387740ac9b8b
2025-08-08 18:19:44 +00:00
Marcus Mews
2c3ae70ddd PY-83001 Extract method with type hints lacks return type sometimes
- fix missing return type when last statement is a return statement
- add/adjust tests
- add missing null annotations

GitOrigin-RevId: 8fed189d0130c3b41a5f17a3324684a29b39c0ef
2025-08-07 20:11:13 +00:00
Marcus Mews
4e83c0cd74 PY-22720 Extract Method does Not Preserve Existing Line Breaks
- keep empty lines between statements
- add test

(cherry picked from commit 276000bdce7ffee22ecd2e03d2ec4831dd8f6725)

IJ-MR-171066

GitOrigin-RevId: 15660649de5c799be2dee8c5c80e616827ef41db
2025-08-05 12:33:06 +00:00
Vladimir.Koshelev
57b05ad202 [PY-82607] introduce a caching for all computations in PyTypingTypeProvider
GitOrigin-RevId: fb694274af15e64738054c03b0360f5aff4c513a
2025-08-03 21:40:01 +00:00
Andrey Vokin
62f37bb800 PY-81269 Extremely High RAM Usage
(cherry picked from commit bb534d62931c176d2395e2cceb0afabc57464669)

GitOrigin-RevId: 5c542be02083a352890ccd61c4e2792b6b018fb7
2025-08-03 11:42:52 +00:00
Andrey Vokin
385d275011 PY-75831 Split cache(resolve/type) into library and user part
GitOrigin-RevId: 8dfd0120379c9a34051d66e147ffdc2c69f0db66
2025-08-03 10:57:11 +00:00
Marcus Mews
3d25b26d0f PY-35287 Extract method with typehints
- customize extract method refactoring for Python using prefix Py
- option to enable/disable type annotations
- persist value of checkbox.isSelected
- run all extract method tests using types
- add specific typed test
- adjust api-dump.txt since some members of AbstractExtractMethodDialog were raised from private to protected
- small adjustment in test expectation of the inferred type

GitOrigin-RevId: be6e70dcb61c451debb98c10c0a001234188cb7d
2025-07-31 14:08:38 +00:00
Andrey Vokin
1f55555bbb PY-82783 Reset type-cache after low memory notification
(cherry picked from commit 2c50752bdc25b75f756a1a8166e72e8e3abd2710)

IJ-MR-169930

GitOrigin-RevId: d9bda4e6dbeb6efdd82b3ec83c542857695fb86f
2025-07-31 06:28:05 +00:00
Vladimir.Koshelev
4dcf05fc6d PY-82905 PyCharm extremely slowing down (almost blocked) with message: 'IDE running on low memory'
GitOrigin-RevId: 5e6e5ba64a12d4c1cc826f0b783877494747433f
2025-07-30 12:26:17 +00:00
Morgan Bartholomew
32ba10c43e [python] PY-82405 enhance django form factory special handling
GitOrigin-RevId: 89d747121f1832b29eaa5f9ea99442cdbc67ed86
2025-07-25 13:27:06 +00:00
Marcus Mews
0e231d8365 PY-79622: @typing.overload does not work correctly with decorator application syntax
- check all overloads of each decorator to retrieve type annotations

(cherry picked from commit 916e4f796e3295c413f93e3adebf64f4692c8c11)

IJ-MR-166976

GitOrigin-RevId: e11c82034e016c0ff21a4a95e71edf1c496b8116
2025-07-24 21:59:44 +00:00
Marcus Mews
d7cc3e584e PY-34368: False warning "This decorator will not receive a callable it may expect" when @classmethod is not the last applied
- improve inspection to respect unaffected decorators wrt. classmethod/staticmethod
- improve inspection message
- add tests

(cherry picked from commit 0eb431ae1aa2c40fa9056f7032936bb05bf8c32b)

IJ-MR-165392

GitOrigin-RevId: 59e4df99bf6000c8775c566cc6cdc9e406496fda
2025-07-24 20:35:47 +00:00
Marcus Mews
1e1dc85113 PY-78413 No warning for awaiting a normal function if target in other module
- special case for awaiting a call to an imported, untyped, non-async function

(cherry picked from commit 8eec47ca4560ae0577e8c6157ef533952436b3b4)

IJ-MR-168288

GitOrigin-RevId: 5ae73b7b663e94996116706a775b9fed683f331e
2025-07-21 11:04:38 +00:00
Mikhail Golubev
c13b42f56c PY-82454 When a generic class is not parameterized in a type hint, parameterize it with defaults right away
Previously, we parameterized it in PyReferenceExpressionImpl#getTypeFromTarget
and PyFunctionImpl#analyzeCallType, but this substitution disregarded default types
and substituted free type parameters only with their bounds if those were present,
additionally diluting them with `Any` through a "weak type".

So if we had something like the following:

```
class Ref[T : str = str]:
    def get_self(self) -> Self: ...
    def get_type_param(self) -> T: ...

x: Ref = ...
x.get_self()  # Ref[str | Any]
x.get_type_param() # str | Any
```

it worked somewhat correctly only if the omitted type parameter had a bound
in addition to the default.

One notable example from the standard library is the `open()` builtin
returning `TextIOWrapper` that has a default type parameter `_WrappedBuffer`.
This type parameter ended up either substituted with a "weak type" `_WrappedBuffer | Any`
or completely erased.

This change allowed removing special-casing for Self in PyFunctionImpl#analyzeCallType.

GitOrigin-RevId: 6408d24186bf607a08006f15b380e1eb158e63eb
2025-07-18 17:46:54 +00:00
Daniil Kalinin
63d6f8b760 PY-75679 Do not narrow down the Self type in generic classes
GitOrigin-RevId: 278b0856811da34c431bdf5f438e719428a7aad2
2025-07-18 17:46:54 +00:00
Vladimir Fedorov
0ac4ba9405 [ml-api] JBAI-14600 unify ML API version
* Switched to the project-level dependency everywhere
* Introduced a new module intellij.platform.ml.logs to separate ml-api library usages from intellij.platform.ml and intellij.platform.ml.impl modules
* The following models has been adapted to the latest ML API version: python imports ranking, fuzzy resolve, completion trigger model, jetenry inline prompt detection, jetenry fleet code classification

Merge-request: IJ-MR-166415
Merged-by: Vladimir Fedorov <890readrid@gmail.com>

(cherry picked from commit 9056efba5a5397a700daabb453ee1477cfaabdf3)

GitOrigin-RevId: 7cfc63d35b55ac968d5a3b789d2ed5f29d4f12d6
2025-07-16 20:04:19 +00:00
Aleksandr Sorotskii
d0f8416aef Fix installing packages from custom repositories; #PY-82430 Ready for Merge
(cherry picked from commit d1b0ea9f6bd5852ee57db5804b00fa9cfb158f85)

GitOrigin-RevId: ede3fa8e8615cc907b52ba52f9dd2ee351d338e8
2025-07-16 14:39:35 +00:00
Aleksandr Sorotskii
dbcc824467 support for () in version spec; proper equals op
(cherry picked from commit b6dcc1204e225369df009a59ece08f5797138b0f)

GitOrigin-RevId: 74ca04448d7eac28d4454f70e88dd260a02fb3ec
2025-07-16 14:39:35 +00:00
Marcus Mews
7bfd231a33 marcus.mews/PY-55691
PY-55691: `Expected type 'Type[AttrsInstance]'` warning passing `attrs` class to `attrs.fields()`

- add member __attrs_attrs__ to classes decorated with attrs.define or similar

Merge-request: IJ-MR-165647
Merged-by: Marcus Mews <marcus.mews@jetbrains.com>

(cherry picked from commit 979f894e595d903c55f33c8bd4c5c3d06cb2fe6d)

IJ-MR-165647

GitOrigin-RevId: d668282db59d6a6fcea1d40bb36aa4ee48585dea
2025-07-15 06:09:10 +00:00
Morgan Bartholomew
e812c7d44b [python] PY-82265 edge cases for GTD
(cherry picked from commit 6de5053ef51534f6efe8a1ca4cf428b8d8c44cfa)

IJ-MR-166989

GitOrigin-RevId: 32b61d838cb740f75b4d16842a11bda770ec87fa
2025-07-10 16:22:13 +00:00
Morgan Bartholomew
8578aba478 [python] add some nullability annotations to resolve functions
(cherry picked from commit e2f9fb1a427aed1910a7aacac3de6d39b8ebb953)

IJ-MR-166989

GitOrigin-RevId: 964baf63c0e90bc6d5cceb5eaf664619a8059411
2025-07-10 16:22:13 +00:00
Aleksandr.Govenko
63a9e9092d PY-81482 assert True in try triggers "This code is unreachable" after finally
(cherry picked from commit 9e5ea2546169cda70f2aaf810fa2f27d13cb102a)

IJ-MR-167790

GitOrigin-RevId: 2f6158133cd075f4b7155e8fe922dcfa85155085
2025-07-03 17:58:56 +00:00
Aleksandr.Govenko
9575aedee8 PY-81936 Code unreachable under sys.version_info guards is not highlighted
(cherry picked from commit ea1c276b5648f0ca4237b770179b27d6c5ee1048)

IJ-MR-167790

GitOrigin-RevId: e76f0a1150903d9eb85141c6c4ac898f67584d3d
2025-07-03 17:58:56 +00:00
Aleksandr.Govenko
fefa1ad70a PY-81947 if x is not None check for a value of type Any | None makes the guarded code unreachable
(cherry picked from commit 4f374c34595414f20612062922b9e88c93f9ffc1)

IJ-MR-167790

GitOrigin-RevId: 74d6b3b61c6758beda87adebbe297c4da2cf6d1e
2025-07-03 17:58:56 +00:00
Morgan Bartholomew
ba3ef61694 [python] PY-81789 filter unhelpful declarations for GTD
(cherry picked from commit 0fba00400382b32bbdbb1d6112126b4097895f2f)

IJ-MR-165350

GitOrigin-RevId: dd3ce79429be222443d8d2d17b490670f84800f9
2025-06-23 12:19:07 +00:00
Aleksandr.Govenko
6185c1b0f3 PY-81030 Stuck when editing code, high CPU usage
(cherry picked from commit 0c4f6c91655503524722d59b363f60e1d289898c)

IJ-MR-166267

GitOrigin-RevId: fd7b2e941f3d7fdfdfee6623be056d0fe50f83cb
2025-06-23 00:19:47 +00:00
Nikita Ashihmin
05e32e764d PY-19974 Packages: Add conda envinroment.yml support, refactor sync methods
Signed-off-by: Nikita.Ashihmin <nikita.ashihmin@jetbrains.com>


Merge-request: IJ-MR-164824
Merged-by: Nikita Ashihmin <Nikita.Ashihmin@jetbrains.com>

GitOrigin-RevId: 85cbf7b873742ded72029af1f4ff3e34af9bae22
2025-06-17 00:18:33 +00:00
Vladimir Krivosheev
b935234c91 IJ-MR-162467 don't export intellij.platform.projectModel
GitOrigin-RevId: 11c0bf5ca0f3a6d892658a2b149d85cace9aa2b8
2025-06-14 13:00:48 +00:00
Petr
31c71642fd PY-81471 Move PyLineWrapPositionStrategy to python.syntax.core
GitOrigin-RevId: 998a62f09ee1e2fed512c5ae8c8cfed8808c947f
2025-06-13 20:21:12 +00:00
Petr
e7a8716848 PY-81471 Move PythonCommenter to python.syntax.core
GitOrigin-RevId: a4d6c426f104f67c0bf95b15b321c101590c5142
2025-06-13 20:21:12 +00:00
Petr
e33aae05fc PY-81471 Move PyStatementMover to python.syntax
GitOrigin-RevId: c9cb03c1bb97720c392ea482765790674f27b647
2025-06-13 20:21:11 +00:00
Aleksandr.Govenko
b0ca1ef976 [python] PY-81674 Highlight all unreachable code gray
GitOrigin-RevId: 5a8dba3a51b7e9d415deb5401213ad3b79ddd3c5
2025-06-13 16:56:16 +00:00
Petr
53a7528022 [python] Use Any in place of unresolved object (PyTypeHintsInspection.kt)
GitOrigin-RevId: 701463ca2d95e6483f9ca640dcf39e173e47c0c3
2025-06-11 14:26:43 +00:00
Morgan Bartholomew
04f2c5187a [python] PY-81658 don't suggest deprecated stubs
GitOrigin-RevId: 97e1a447e8ebf2747b771fdb23785755c35144aa
2025-06-10 16:22:37 +00:00
Ilya.Kazakevich
80f248d842 Python: Move helpers locator out of PSI module
GitOrigin-RevId: 55fb4b41c56fdd41b6d9523cd7a148c002ffb8be
2025-06-07 21:59:42 +00:00
Ilya.Kazakevich
7c6aee1172 Python: findPathInHelpers must not be nullable.
GitOrigin-RevId: c7be8fc5d86ccc0de45f60734990124c18b33734
2025-06-06 23:05:47 +00:00