Commit Graph

1204 Commits

Author SHA1 Message Date
Mikhail Golubev
417ae25578 PY-58658 Drop an inspection setting for metaclass "self" name, recognize more aliases
GitOrigin-RevId: 73f53f7e3318eafb87373387ea65426cc1c28662
2023-02-10 13:15:23 +00:00
Daniil Kalinin
9b471fb6f0 PY-38680 Don't treat class with method which rises NotImplementedError as abstract but keep ability to implement them
Merge-request: IJ-MR-102462
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: c94b0d90288fd9ff10ef745273110eaaf628dd2e
2023-02-09 16:52:41 +00:00
lada.gagina
89b50dedf4 PY-53612 Add support for typing.LiteralString
For now the type checker infers str for LiteralString types

GitOrigin-RevId: 26b97b18d23780f59af77fb13d0cc310375f2ff1
2023-02-07 16:57:37 +00:00
Tagir Valeev
f456ed0604 Pattern variable can be used mass cleanup
GitOrigin-RevId: 55839bf0deca5f81d0f7eb5b1c190145a5ea0037
2023-02-07 13:58:20 +00:00
Nikolay Chashnikov
c2540cd10a API: mark for removal APIs which were deprecated and have no external and internal usages (IDEA-305637)
GitOrigin-RevId: 8f4ee08f99f30456e0c0105ae4f28dc7cd8ad9b0
2023-02-06 19:59:10 +00:00
Nikolay Chashnikov
175e3373f9 [python] get rid of usage of DirectoryIndex class (IDEA-276394)
This class is going to be deprecated.

GitOrigin-RevId: 22c6e53b26ff795bf4834116afcbc7a049fb90ef
2023-02-02 23:37:21 +00:00
Tagir Valeev
17c2671635 Zero tolerance warnings fixed
GitOrigin-RevId: f6081f2ced74fd540ddef2fdcc5ef92b222a1969
2023-02-02 09:57:55 +00:00
Mikhail Golubev
566a98e5ea Make use of getGreenStub() in PyFileImpl to avoid excess PSI traversals
GitOrigin-RevId: b6271d3c3562e9b028c55900431843150dd8c68d
2023-02-01 10:41:05 +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
Mikhail Golubev
c750ba7884 PY-55502 Cache already read Python skeleton headers in VFS user data
I decided in favor of naive caching via getUserData/putUserData, because
to access CachedValueManager we need a project, and there are external usages
of PythonSdkUtil.isStdLib that will need to be migrated. The benefits of
CachedValueManager are not clear for this use case, however. For skeleton files,
it should be fine not to invalidate cached data because skeletons are completely
overridden by an external process on refresh, and skeletons for different SDK
are stored separately, so recorded paths should stay the same even then.
Parsing a header twice due to concurrent access is also not a problem in this
case and UserDataHolder implementation itself is thread-safe.

GitOrigin-RevId: 31f353a489861cc1cbda3a49e277f7fd6e462e13
2023-02-01 10:40:59 +00:00
Mikhail Golubev
d322a54f1a Fix a default encoding problem in PySkeletonHeader
GitOrigin-RevId: 99427b735bdcfcd4970899cb5cfc97f1a6a30bd4
2023-02-01 10:40:55 +00:00
Mikhail Golubev
ff843a1dcf PY-55502 When canonizing stdlib names, perform IO-heavy PythonSdkUtil.isStdLib last
PyStdlibCanonicalPathProvider is called as part of PyiTypeProvider.getReferenceType
during inspection passes. It reads skeleton headers under the read action
to figure out which skeletons belong to the stdlib, blocking the EDT.
However, this path provider is actually applicable only to a handful of
private modules from the standard library, and it makes no sense to perform
this costly check for all other qualified names. Reversing the order of checks
should greatly reduce the number of such IO operations until we get rid of them.

GitOrigin-RevId: d5c2529ed0c8f34384517adacdc89a43b6960114
2023-02-01 10:40:52 +00:00
Mikhail Golubev
c9557af95f PY-55502 Cleanup in PyStdlibCanonicalPathProvider
GitOrigin-RevId: 340558f26aeb9b739af0e8cb699fd64bdd2d8b61
2023-02-01 10:40:49 +00:00
Mikhail Golubev
b85c6b3ede Inline PyWhitespaceUtil into PyWhiteSpaceFormattingStrategy
GitOrigin-RevId: c6eff5b4adcf97ce8b977c811fec71c2a48e266d
2023-02-01 10:40:44 +00:00
Mikhail Golubev
387800926a Add private constructors to a couple of Python-specific utility classes
GitOrigin-RevId: 5ef383a8786912a4729bdad8268661b59d82e3de
2023-02-01 10:40:41 +00:00
Nikolay Chashnikov
327e8b38e7 [util] refactoring: extract enum describing the result of processing tree node in DFS algorithms in platform.util module
...and use it instead of ContentIteratorEx.Status. We need to use a similar one in VirtualFileUrlManager, so by extracting a common class we can reuse it and avoid conversion between different enums. Also, we have other enums which duplicate this one (com.intellij.ui.tree.TreeVisitor.Action, com.android.tools.idea.testing.DisposerExplorer.VisitResult, com.android.tools.profilers.cpu.systemtrace.SliceStream.EnumerationResult), they can be replaced by this one as well.

GitOrigin-RevId: 14faae1a96d565ab2ab506e42bfffb96eaf64ab0
2023-01-31 13:52:05 +00:00
Tagir Valeev
7a33190f27 [inspections] testOptPaneSanityChecks: more tests for labels
GitOrigin-RevId: 6420065945442503db628555d1f8ea14c6db2b42
2023-01-30 10:42:04 +00:00
Alexey Kudravtsev
32324bcb09 rename to signify it's immutable and different from other newArrayList methods
GitOrigin-RevId: 12b616da48234b3406e75f8312c6e56e70a949df
2023-01-24 18:01:07 +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
Mikhail Golubev
2b536b1099 PY-52656 Respect the order of type parameters in explicit Generic[...] superclass
GitOrigin-RevId: 3f75086e60103fd11ccd51230d1b90f6e8cc9709
2023-01-24 08:56:46 +00:00
Mikhail Golubev
aa9b66c647 PY-53522 Recognize generic classes parameterized with other generics
GitOrigin-RevId: edc1eb42d2dd27a12aaae955e5fad0904702f53f
2023-01-24 08:56:44 +00:00
Mikhail Golubev
d24050a2bb PY-53896 Add scoping for type vars, correct matching for generics hierarchies
This changeset introduces a few important changes to out type inference.

First of all, TypeVar instances, represented as PyGenericType objects
in our type system, finally have associated scope owners
(see https://peps.python.org/pep-0484/#scoping-rules-for-type-variables),
which allows to safely use type parameters with the same name in different
declarations. Absence of this feature, not only caused various subtle bugs
in type checking, but also led to occasional SOEs on type substitution
(e.g. PY-54336).

To make it work consistently across the board, I also added scope owners
to type parameters extracted from docstrings in our legacy python-skeletons
format.

Secondly, now both nominal subtyping and structural subtyping via protocols
properly take into account type parameters "fixed" on inheritance. Previously,
it was done only for receivers in methods calls and attribute reads.

It fixes PY-27707, PY-35026, PY-38897.

GitOrigin-RevId: ff4e61fb9b4aff079e67b2e5263f30552da15c63
2023-01-24 08:56:41 +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
90f54814ca PY-57157: Support markdown in attributes and parameters quick documentation popups
GitOrigin-RevId: c4f1910784494ae9445cdc97dd3528e8cc35714a
2023-01-23 13:39:07 +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
c44fb89c28 PY-56609: Refactoring in quick documentation
Migrate to DocumentationMarkup elements

GitOrigin-RevId: ea4d71638b1dd3a160521e655fd2a1670ea27701
2023-01-23 13:39:02 +00:00
Irina Fediaeva
492065b694 PY-56609: Refactoring in quick documentation
Clarify building docstring logic a little bit

GitOrigin-RevId: 8cc52a65829957917a285a6c77d42baa6b0b6cfd
2023-01-23 13:39:00 +00:00
Irina Fediaeva
dac98c01ed PY-56609: Refactoring in quick documentation
Cleanup DocumentationBuilderKit

GitOrigin-RevId: 85d8f4de5bc7ea6f9bf0ca298a7f29f180cb1e06
2023-01-23 13:38:55 +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
Irina Fediaeva
5e4087e221 PY-56609: Refactoring in quick documentation
Streamline docstring logic in PyDocumentationBuilder

GitOrigin-RevId: 2cc1df0794890cefec37d6e5c4170587a3fa1973
2023-01-23 13:38:50 +00:00
Irina Fediaeva
98f4edc289 PY-56609: Refactoring in quick documentation
Simplify DocStringParameterReference

GitOrigin-RevId: 1cfd861cec23d9f7a41d630212a19e41ddae40b7
2023-01-23 13:38:43 +00:00
Mikhail Shagvaliev
c3e7cbcdbb QD-4918 Extracted some strings to resource bundles, fix localization some errors
GitOrigin-RevId: ec07cff1f826a89c3c86b6a2e79ea4b29b14d78c
2023-01-18 18:36:21 +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
lada.gagina
f3da5e58ae PY-58374 Fix dict keys completion when editing an existing key
GitOrigin-RevId: 41434300f6ea0f776a115a869fb9578a84015471
2023-01-17 19:01:56 +00:00
Tagir Valeev
56013717c5 [inspections] Rename OptSet -> OptStringList; stringSet -> stringList
This reflects that we usually preserve ordering and in fact map to the List<String>

GitOrigin-RevId: f44eb3efae5db372dfb1747d86b728a23ec5745b
2023-01-17 15:37:26 +00:00
Olga.Lavrichenko
6df5bfd10d DS-1584 DS-2583 Reformat breaks IPython magic commands and shell commands
GitOrigin-RevId: 949528c951d6c9174b1bad21452a90fbdb07b418
2023-01-16 15:13:23 +00:00
lada.gagina
f5db62e099 Sync with typeshed @ df905102da05e99e7e7cd6cd0a1e3ddea2eddba2 (excluding the python2 removal)
[PY-57541](https://youtrack.jetbrains.com/issue/PY-57541/Sync-bundled-typeshed-df905102da05e99e7e7cd6cd0a1e3ddea2eddba2)

GitOrigin-RevId: 50eb01e74255002005343caa51bf8eb21c6028a6
2023-01-13 18:45:18 +00:00
Alexandr Suhinin
42746dc58f cleanup: replace all methods identical to super with delegate
batch fix for inspection: method is identical to its super method

GitOrigin-RevId: bb9fbb32ba5fe09613c28e98eb3dad540d6322f1
2023-01-13 09:57:03 +00:00
lada.gagina
01f87f5c77 PY-42637 Fix quotes for TypedDict keys completion in subscription expressions
If there are quotes, suggest just the key names

GitOrigin-RevId: 58caea6ba1ceeeea790580c3d24d255a636764bb
2023-01-10 17:39:28 +00:00
lada.gagina
ef2f607f5f PY-42637 Fix quotes for TypedDict keys completion in dict literals
- when there are other keys present in the literal, use quotes from there
- when the literal is empty, use double quotes by default
- when there already are quotes, suggest just the key names

GitOrigin-RevId: 5f37cd25c0e47521e78a01ab84053571369b24a8
2023-01-10 17:39:26 +00:00
Daniil Ovchinnikov
578eaaf60e rename library kotlin-stdlib-jdk8 -> kotlin-stdlib
GitOrigin-RevId: cddf45ccfd5563d3fe209bea62a1c37c94f44ff9
2023-01-10 12:22:34 +00:00
Vladimir Krivosheev
57764d700b mark classes final
GitOrigin-RevId: 6414b6f2119c82c7567987dd30b35cab5491d9e2
2022-12-30 06:58:01 +00:00
petr.surkov
06ba0ecaa0 [pycharm] Fix PyFormattedStringElementImpl.isTerminated
GitOrigin-RevId: 3b21495ec81091233e6b71a5cf15f02092b9e47d
2022-12-29 15:25:30 +00:00
Alexey Kudravtsev
0bd5ed5449 fix "immutable collection modified" warnings
GitOrigin-RevId: ec49a122b92288db0588ca66f6c535337f65360f
2022-12-28 13:57:23 +00:00
Tagir Valeev
fb6e8d4302 [inspections] OptionController; composing options
GitOrigin-RevId: 1ef89dce3166f99847ed86263d3a58f3efa0fd03
2022-12-22 21:07:34 +00:00
Tagir Valeev
fa3cf18c12 [inspections] OptPane: use stringSet
GitOrigin-RevId: 7f3ba5c990d8aa173d8edf3a38bb21543c26d0fa
2022-12-21 19:22:09 +00:00
Tagir Valeev
9847ad11f0 [python] Migrate inspections to OptPane
GitOrigin-RevId: ee8056bff9fad8b0d9874028a36f79400b3315d8
2022-12-18 13:58:46 +00:00
Alexey Kudravtsev
4517d3cad6 reduce classloading footprint of intention actions
GitOrigin-RevId: 024a247ccfe8c7a0402997f6f76fbf435773fa2b
2022-12-15 15:29:03 +00:00