Commit Graph

212 Commits

Author SHA1 Message Date
Petr
b9167aef8b PY-61639 Move PyPreFormatProcessor to python.syntax.core
GitOrigin-RevId: 30d204206de9e09eae34baf0555fc9be5822ba68
2024-02-16 15:53:21 +00:00
Petr
3b9b10b296 PY-61639 Move extendWordSelectionHandlers to python.syntax
GitOrigin-RevId: d5957878544a0026f249109ca1df0a18e20a8a55
2024-02-16 15:52:51 +00:00
Petr
85c54b3a4c PY-61639 Move PythonFormattingModelBuilder to python.syntax.core
GitOrigin-RevId: bdcbd076cd3c1531204eff35515b44cd0edc9f68
2024-02-16 15:52:22 +00:00
Petr Golubev
25b8ebcf83 PY-61639 Extracted PythonEnterHandler
GitOrigin-RevId: 8fd0c063c917e07c3f1bf98533c3de867f770ee9
2024-02-08 13:58:08 +00:00
Petr Golubev
1a73bd2d21 PY-61639 Extracted PyAstElementGenerator
GitOrigin-RevId: 915c235120b079188d81efaa9ccf9728131fa3df
2024-02-08 13:58:08 +00:00
Petr Golubev
c90db007c0 PY-61639 Lift PyFile.getTopLevelAttributes(), PyFile.findTopLevelAttribute() to PyAstFile
GitOrigin-RevId: 373accde23bb2c55d1d23266da7874e34da96ea3
2024-02-08 13:58:08 +00:00
Petr Golubev
f818966298 PY-61639 Lift PyParameter.isSelf() method to PyAstParameter
GitOrigin-RevId: 919518e5d06f2b968974bfdbd8deea2ced03c822
2024-02-08 13:58:08 +00:00
Vladimir Koshelev
aec2051aa9 [python] get rid of IStubElementType and move logic about working with stubs to impl classes PY-61639
GitOrigin-RevId: 062dead109c25d944d4f61e901dc3c64c00b392e
2024-01-19 23:14:49 +00:00
Petr Golubev
b3c3216f79 PY-61639: Extracted python ast
GitOrigin-RevId: 4fc0ae909811302d8425f1e67d8c648c290afcb3
2024-01-17 17:23:01 +00:00
Ilya.Kazakevich
b533e29ce0 [python] get rid of classes registered in wrong modules
You must register class in the same v2 module class sits

GitOrigin-RevId: c7fcccd27c2fcaa3d9391d1173f61ad43fe2b076
2024-01-17 04:59:01 +00:00
Ilya.Kazakevich
b599287e32 [python] Refactor icons layout in community
Icons removed from SDK package (no need to have a separate class for it), ultimate icons moved out of community module.

There are only 3 icon packages in community:
* `PythonParserIcons`
* `PythonPsiApiIcons`
* `PythonIcons` (aka `intellij.python.community.impl`)

Latter two have `.json` mapper to replace old icons with new one for New UI which is included into corresponding `.xml` file.

GitOrigin-RevId: 0438ad4485b5a82a89c81ec63ae6e575d5bb52de
2024-01-12 15:53:48 +00:00
Ilya.Kazakevich
e4a56dc87f [python] PythonPsiApiIcons moved to com.jetbrains.python package, as whole community.python.impl must be there
GitOrigin-RevId: 0c38ddbdd5b0588ed4ec09c1d447248678974323
2024-01-11 20:29:55 +00:00
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