Commit Graph

200 Commits

Author SHA1 Message Date
Daniil Kalinin
eb58a3805e PY-61883 PEP 695 Type Parameter Syntax: Make PyTypingTypeProvider aware of the new-style type parameters and aliases
Inherit PyTypeAliasStatement from PyQualifiedNameOwner to re-use type aliases stack in PyTypingTypeProvider

Various tests for the changes above

Co-authored-by: Mikhail Golubev <mikhail.golubev@jetbrains.com>

GitOrigin-RevId: 242427c6f84c05ec48c94085f20675b8e30f8625
2023-11-06 19:59:18 +00:00
Daniil Kalinin
0ca9ba4a99 PY-62608 Store info about type parameter kind (TypeVar/ParamSpec/TypeVarTuple) inside PSI stubs
GitOrigin-RevId: 80aa6d67e32a0e7e2a7e8ed53f72288831e9dccf
2023-11-06 19:59:18 +00:00
Nikita Ashihmin
d44ce30231 [bdt] BDIDE-5203 Spark(feat): Add context to PythonDocumentationQuickInfoProvider
GitOrigin-RevId: 32d5ecfccfccc88e00addddd0d813bf28277672a
2023-11-01 17:52:23 +00:00
Nikita Ashihmin
65f8b3a286 [bdt] BDIDE-5203 PySpark(feat): Add columns info to Hint Documentation
GitOrigin-RevId: 41a5912a85254c6ea53c8be1805884b0a2491718
2023-10-31 22:31:30 +00:00
Mikhail Golubev
94c2a4859e [python] Add javadoc for PyTypeVarTupleType, PyUnpackedTupleType and PyVariadicType
GitOrigin-RevId: 29670649bf511958d1d6a935a4c90429c378b928
2023-10-20 16:57:57 +00:00
Mikhail Golubev
15c37a5bad PY-53105 PEP 646: Split PyGenericVariadicType into PyUnpackedTupleType and PyTypeVarTupleType
TypeVarTuples, i.e. type parameters, such as *Ts, and unpacked tuples types, i.e.
concrete types, such as *tuple[int, ...], are two independent entities in the type
system. Keeping them both represented as a single type is confusing and introduces
a lot of bookkeeping for accessing their state and filtering out unpacked tuples in
every place where a type parameter is expected.

For cases where both types are applicable, and we need to distinguish them from regular
"non-unpackable" types, PyVariadicType marker interface was introduced.

Also, make the API names more consistent with the PEPs terminology: "unbound" unpacked
tuple types instead of "homogeneous" unpacked tuple types.

GitOrigin-RevId: be77eae46fd78512eaf74d5a9709faacc762e45f
2023-10-20 13:38:11 +00:00
andrey.matveev
a75c569022 PY-53105 Support TypeVarTuple
GitOrigin-RevId: f8160e9d802b09991daa710ed9a20f3e30d455da
2023-10-20 13:38:04 +00:00
Konstantin Nisht
87722de8ea Revert "[python] Allow modification of python SDK in headless mode through environment keys"
This reverts commit 3a202c64

GitOrigin-RevId: f6d6b26c10ba253c1a180a63d4939f4bd5e8f7a0
2023-10-19 16:23:08 +00:00
Vladimir Koshelev
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
Mikhail Golubev
e55fc0031d [python] Simplify a stream in LanguageLevel.SUPPORTED_LEVELS
GitOrigin-RevId: af5156e67989bb88235c89b751f66ea0cdbc4174
2023-10-02 21:38:06 +00:00
Mikhail Golubev
927eca19f5 [python] Compare versions of module SDKs in PythonLanguageLevelPusher using a stream
Even though LanguageLevel enum items are already sorted by the corresponding
version, I decided to introduce a dedicated comparator to make sure that the
logic of isOlderThan/isAtLeast is used for compareTo, not the default order of
enums.

GitOrigin-RevId: f1d4845154c9b71e920e2b634ea6339643bf9467
2023-10-02 21:38:03 +00:00
Konstantin Nisht
7d9f718f82 [python] Allow modification of python SDK in headless mode through environment keys
GitOrigin-RevId: 3a202c6418557c75c367d3d0457a5977a4ab6b6b
2023-09-30 18:44:34 +00:00
Daniil Kalinin
97185d17c8 PY-62608 PEP 695 Type Parameter Syntax: Resolve and scoping for type parameters in type aliases
GitOrigin-RevId: be532456e7a9c470d5d0a2770a7a2eb9b9b6e8de
2023-09-28 15:05:33 +00:00
Daniil Kalinin
1c5b0c5ac3 PY-62608 PEP 695 Type Parameter Syntax: PSI stubs for type parameter lists and type aliases
GitOrigin-RevId: b8707b4677519bab5bcf922c9747eb8388e3157b
2023-09-28 15:05:30 +00:00
Ilia Zakoulov
fbbf66341b PY-62513: Implement obtaining all properties from class and its superclasses
GitOrigin-RevId: 6b531affdde601bce7660ddb7f2fbb7f85998050
2023-09-19 16:17:54 +00:00
Daniil Kalinin
8b217ed53a PY-61853 PEP 695 Type Parameter Syntax: Parsing
GitOrigin-RevId: 286b53bb4e69cf1deb58dc75f41652e6a12a3af3
2023-09-15 16:04:41 +00:00
Mikhail Golubev
11ed9e653a [python] Remove the deprecated PyPsiFacade.findClass
GitOrigin-RevId: 4d1d0516cc55aef4304c8931109766facac6b306
2023-09-06 22:27:46 +00:00
Mikhail Golubev
a5ca7ff7d3 [python] Use PyPsiFacade.createClassByQName() instead of the deprecated findClass
The latter method requires index access, and thus might throw IndexNotReady exception
in the dumb mode, and also can return incorrect results for multi-module projects with
several SDKs.

GitOrigin-RevId: c86d6725ef0cd53574fd2986db626e84f3c14328
2023-09-06 22:27:44 +00:00
Vladimir Krivosheev
8dd13764a9 IDEA-326151 update hash algo for icons
GitOrigin-RevId: bb8f3acd0314190362619afb86151270b893f082
2023-08-09 14:46:20 +00:00
Natalia.Murycheva
10f22bb2e2 DS-4558 Quick fix to split a cell for statement has no effect inspection
Added a new Extension Point for corresponding quick fixes for "Statement without effect inspection." Added QF for Jupyter notebook case and Python file with cells. This QF splits cell just right after the statement without effect

^DS-4558 Fixed

Merge-request: IJ-MR-104455
Merged-by: Natalia Murycheva <natalia.murycheva@jetbrains.com>

GitOrigin-RevId: 7773895cf1ebd6d4e8d56b41e335ec8b97ca5d78
2023-05-03 15:03:06 +00:00
Vladimir Krivosheev
6dbda83b26 use komihash for icon classes to align rasterized key with a runtime cache key (same algo)
GitOrigin-RevId: fec04acb91d4a69d5c50571d3408c9b0ce3fddd4
2023-03-24 15:49:56 +00:00
Mikhail Golubev
10c83d91e9 [python] Replace @Deprecated with @ApiStatus.Internal for getCustomStub() API
The original idea was just to notify third-party plugin developers that
getCustomStub() and CustomTargetExpressionStubType/PyCustomClassStubType EPs are
not intended for general use. @ApiStatus.Internal is designed exactly for this
purpose.

GitOrigin-RevId: a9a980ddb35a56fd8d84df907c76da498a87a698
2023-03-17 21:45:11 +00:00
Mikhail Golubev
52b283f78f [python] Make PyDecoratable interface extend PyElement
It's always applied to Python-specific PSI elements. There is no need to do
a separate cast just to access methods of PsiElement.

GitOrigin-RevId: 481577fa8d2092df7884d6e611622f0bbd4d1e54
2023-03-17 21:45:06 +00:00
Mikhail Golubev
d070837f27 PY-38075 Select the first matching overload unless some argument types are unknown
This behavior is similar to how mypy and pyright handle overloads relying on
their definition order, where more specific signatures are supposed to precede
more general ones. The subtle difference is that in case of Any arguments,
pyright tries to find a common supertype for return types of all matching
overloads, mypy just returns Any, and we return a union of their return types.
For the time being, it keeps things simple and matches how we treated ambiguous
signatures before.

To make this work, I've had to revise how we handle name redefinitions in files.
Previously, we processed them in the reversed order to give priority to those
later in a file, which is natural for regular .py files. It doesn't make much
sense for .pyi stubs, though, as it's impossible to redefine a name there and
multiple definitions, e.g. overloads, are supposed to have equal precedence.
Now, we don't reverse the order of name definitions in .pyi stubs at all,
and in .py files we do that preserving the original order of overloads.
A side effect of it is that now we always navigate to the first overload
of a name in a .pyi stub, as opposed to the last, but it only seems more
logical and convenient.

On the other hand, when we handle overloads in .py files, we explicitly
assign to them a lower resolve rate to give precedence to implementations.
The only exception is that when there are no implementations we still want
to prefer the latest overload, so we put it into the results second time
with a higher rate. It messed up overloads order important for type inference,
so I've introduced a dedicated RATE_LIFTED_PY_FILE_OVERLOAD rate for such
results to filter them out later in PyCallExpressionHelper. I've also added
a named RATE_PY_FILE_OVERLOAD rate of other overloads in .py files to make
them more easily distinguishable from other resolve results with a low rate.

GitOrigin-RevId: e921654e47fe1fc5da047950b70775e342996757
2023-03-14 10:56:49 +00:00
Mikhail Golubev
fb5a3a200a PY-59241 Extract PyTypeVarType and PyTypeParameter interfaces, deprecate PyGenericType
Existing usages haven't been updated yet not to hinder the upcoming integration
of TypeVarTuple (PY-53105) and LiteralString (PY-58857) support.

GitOrigin-RevId: 16aafd07edfdc98dee0240dce7cd3383b5eb0b00
2023-03-06 23:31:58 +00:00
Mikhail Golubev
0f85b19994 PY-56541 Introduce TypeEvalContext.getProcessingContext()
GitOrigin-RevId: 869b5905d05fb3abfb81233e03ab001b5301a3b6
2023-03-02 18:10:11 +00:00
Irina Fediaeva
bb882b63f5 PY-55118: Syntax highlighting for definition signatures in Quick Documentation
GitOrigin-RevId: b8a27a048772a0af7fcc36a9cba0d308e0ace8cc
2023-02-10 22:44:22 +00:00
Alexey Kudravtsev
6ac37bc1fd replace immutableList() with more standard List.of()
GitOrigin-RevId: fd32b6aece21a1be81fcfaab7b4a71092eaf9939
2023-02-08 19:09:49 +00:00
Tagir Valeev
f456ed0604 Pattern variable can be used mass cleanup
GitOrigin-RevId: 55839bf0deca5f81d0f7eb5b1c190145a5ea0037
2023-02-07 13:58:20 +00:00
Mikhail Golubev
97f36e10de Remove redundant interfaces from the PyFunction declaration
PsiNameIdentifierOwner extends PsiNamedElement, and PyCallable extends
PyTypedElement.

GitOrigin-RevId: ef395e6125077c7853e3b5a9e43f7f2b9ff2542e
2023-02-01 10:41:08 +00:00
Mikhail Golubev
43c5495ef5 PY-58722 Looking for top-level imports, prune traversal on simple statements
The snapshots attached by the user indicate that we spend a ridiculous amount of
time collecting a file's import statements in PyResolveUtil.resolveImportedElementQNameLocally
during PSI stubs construction. The reason is that while we skip functions
and classes in a file, we naively scan through all expressions looking for
statements. Now, in this case, we stop the search at statements that cannot
possibly contain other statements. For that I introduced PyCompoundStatement
interface in our PSI hierarchy that also conveniently unifies "match"
statements with other "older" statements directly owning suite.

GitOrigin-RevId: 4282e5367cae4bb1b739ba51242b9719c68018a0
2023-02-01 10:41:02 +00:00
Alexey Kudravtsev
69278e8142 replace some newArrayList() usages with immutable List/other methods
GitOrigin-RevId: 4f4c82378a960ba5be96e31cd19893f423fb6d33
2023-01-24 17:12:20 +00:00
Irina Fediaeva
058257cb23 PY-56609: Review remarks
Proper html table row tags

GitOrigin-RevId: 8413ddf84bc1d5d65080447e3f425923cca21c10
2023-01-23 13:39:15 +00:00
Irina Fediaeva
252e4c1684 PY-56609: Refactoring in quick documentation
Replace usages of appendRaw by append

GitOrigin-RevId: 3ee71857898c3303a5c2e96939ab1f9fb91670e0
2023-01-23 13:39:05 +00:00
Irina Fediaeva
bd1c830040 PY-56609: Refactoring in quick documentation
Remove ChainIterable usages from quick documentation and replace with HtmlChunk/HtmlBuilder.
I18ize some fragments.

GitOrigin-RevId: c9b1197efcb17de92361426759a7840ee1be8e4b
2023-01-23 13:38:53 +00:00
Nikolay Chashnikov
2999a2c383 cleanup: remove redundant '@author' tags from javadoc comments - 24
Now we have Code Vision hints which determine the author via Git history and show it in the editor automatically, and this information is more accurate than the tags which were automatically added when files were created.

GitOrigin-RevId: f1b80125c2555d89f32aae4e5290d7771a357abf
2023-01-18 17:02:43 +00:00
Nikolay Chashnikov
4a1b1e2eb2 cleanup: remove redundant '@author' tags from javadoc comments - 19
Now we have Code Vision hints which determine the author via Git history and show it in the editor automatically, and this information is more accurate than the tags which were automatically added when files were created.

GitOrigin-RevId: b442e8499110d543d5ec05b9e07f6c0f88b61ecc
2023-01-18 17:02:27 +00:00
Nikolay Chashnikov
4899a5a210 cleanup: remove redundant '@author' tags from javadoc comments - 6
Now we have Code Vision hints which determine the author via Git history and show it in the editor automatically, and this information is more accurate than the tags which were automatically added when files were created.

GitOrigin-RevId: 30586ed1915e3b35394ff3ee6251607c64bbabdd
2023-01-18 17:01:44 +00:00
Nikolay Chashnikov
325f45ce66 API cleanup: remove unused deprecated API (IDEA-305637)
GitOrigin-RevId: 9cc6eecfa40189d8d08c2861ffe9ffce84d31e87
2023-01-18 13:27:16 +00:00
Vladimir Krivosheev
98ace0a061 use XXH3 instead of MurMur3 to generate an icon image key
The main reason — use XXH3 everywhere

GitOrigin-RevId: 7b158b9b3689d16f09182abb0b58113c7303f874
2022-12-27 08:01:26 +00:00
Tagir Valeev
a8b394e10c Fix constant value and other warnings
GitOrigin-RevId: 5521a732a94fb9c8ee55e6487e306392d53173bd
2022-12-05 16:50:45 +00:00
KotlinIsland
45dd0bf0e8 Add language level for Python 3.12
GitOrigin-RevId: 10d24da89149754de63c87ec9edc0a1b7f131f17
2022-11-13 01:47:35 +00:00
Alexey Sedunov
c443410d79 Django: Extract Django/Jinja2 commons
GitOrigin-RevId: 3f6bb7b7cd80cbf6007e1930d4d018e1b1cff44a
2022-10-16 11:59:01 +00:00
Irina.Fediaeva
cb8edc622b PY-33341, PY-56416, PY-28900: Render attributes and init params description in the class documentation
PY-33341: Now we render the “Attributes” section in the class documentation, it also allows to describe inherited attributes. (Previously we didn’t render it at all)
PY-56416: In the attribute documentation popup we are able to render attribute description from class docstring. (Previously we took documentation only explicitly from attribute one-line docstring)
PY-33341: We render the “Parameters” section in the class documentation for init parameters, described in the class docstring. (Previously user couldn't use class docstring to describe init parameters)
PY-28900: For the init parameter documentation we take the description from the class docstring if init doesn't have its own docstring. (Previously we took parameter description only from init docstring)

GitOrigin-RevId: d67bf49c72cf7a3634805a6e310c943f1ea848d1
2022-10-07 14:42:01 +00:00
Tagir Valeev
bddacd6ba6 Enhanced switch used
GitOrigin-RevId: b9a7d5074c4eb10c87bae5c7703b9671eb0f1aff
2022-09-21 10:52:22 +00:00
Nikolay Chashnikov
65b8769078 [python] API: remove 'for removal' flag from deprecated API which aren't going to be removed soon (IDEA-301912)
GitOrigin-RevId: c8d31098d77a0e153a8a67d50253aaa90c5ee98c
2022-09-16 12:41:18 +00:00
Tagir Valeev
9038e3f77b Remove empty and irrelevant javadoc tags
GitOrigin-RevId: dcbbb8cff7ef267525129c464769f761d92c2120
2022-08-09 09:41:49 +00:00
andrey.matveev
04f5b85d4a PY-29898 Impl resolve keyword argument to dataclass attribute
Also fix PY-55231
Add declarationElement field to callable parameter to resolve parameters to class fields in dataclasses

GitOrigin-RevId: ae2703b958061df6f2d74b19920a6e3be2a084f6
2022-08-05 11:19:33 +00:00
andrey.matveev
b7398bb63d PY-10719 Fix add import above import with noinspection comment
GitOrigin-RevId: 6dd79b10e56b9e9e2eee76c83d5974dee43446a1
2022-07-26 13:17:54 +00:00
Mikhail Golubev
5d16f5e090 [ExpUI] Register an iconMapper to override Python file type icon
Previously, the mapping file was put in a wrong place (not at the root of
a "resources" directory) and was not registered in any plugin descriptor.

However, under debug, the right icon was still displayed because pythonFile.svg
is also remapped in all-platform PlatformIconMappings.json. In actual installers
pythonFile.svg and PlatformIconMappings.json end up in different classloaders,
so this fallback doesn't work.

GitOrigin-RevId: ee361cd7d2d0158b0cc96bd652a5cb53bb7d88c5
2022-07-05 14:40:31 +00:00