Commit Graph

188 Commits

Author SHA1 Message Date
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
Tatiana Tulupenko
0b504ec770 [ExpUI] Update Python file type icon
GitOrigin-RevId: d6bda965a8819a9c329fefd12a22adf8f8aa8ffd
2022-06-28 18:31:58 +00:00
Tagir Valeev
11595f3956 Fix most of JavaDoc <-> code mismatch warnings
GitOrigin-RevId: 9a87a8b90993b56cd045722734c5c5f466601ae3
2022-06-20 12:02:27 +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
Alexey Kudravtsev
2340e499ad replace invalid javadoc tag "@author:"
GitOrigin-RevId: f5835f60a7dc5e3b5c7cf1433350891e61d84b0b
2022-05-10 16:41:06 +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
Nikolay Chashnikov
3de1d05eec [API] mark for removal API which was deprecated in 2021.2 or earlier and has few usages only (IDEA-281036)
GitOrigin-RevId: 6f1cdecf02dae3ab19351a4fa4e895f98265ea0a
2022-02-17 22:44:08 +00:00
Nikolay Chashnikov
abc373560d [API] replace ApiStatus.ScheduledForRemoval annotation by 'forRemoval' attribute (IDEA-288466)
Since we don't want to specify planned removal date anymore, there is no need to use a separate annotation.

GitOrigin-RevId: a047c55475e0f4752a2842577e094fb041c6c05b
2022-02-11 15:12:14 +00:00
Tagir Valeev
3df143dfe6 Use try-with-resources; other warnings fixed
GitOrigin-RevId: 57e9bbb62af11b0629f9d02534b07e7a921c55af
2022-02-08 06:35:41 +00:00
Alexey Kudravtsev
306d067698 remove incorrect @Nullable from getIcon() to avoid multiple "returning not null from nullable method" false positives
GitOrigin-RevId: f6db4092c037f563b2b19e909fed325e46af4ebe
2022-01-31 13:45:48 +00:00
Nikolay Chashnikov
46cc1d78e4 [python] cleanup: get rid of unused deprecated API (IDEA-281036)
GitOrigin-RevId: 3ce01c6689410cc147b8b552a1354e7996a6d0f9
2022-01-13 20:14:22 +00:00
Vladimir Krivosheev
0429b0130d use murmur 3 32 instead of xxhash 64 for icon digests - reduce icon db size (mostly in memory, because on disk compressed using LZ4) and avoid loading extra classes on start-up (murmur is already used in classloader)
no collisions so far

GitOrigin-RevId: 1f41a238729772b4b3c4faa5de5cd1ccb9ec3f65
2021-11-19 09:43:32 +00:00
KotlinIsland
119696be41 Add language level for Python 3.11 (PY-51300)
GitOrigin-RevId: bc2fd30744ca9c2a8023c718ade4689bfc9fef9b
2021-11-17 15:31:59 +00:00