- Added PyPatternInspection class with logic to highlight and fix issues in pattern matching
- Modified PyAstAsPattern.getTarget() to return nullable value
- Added quick fix for PyAsPattern to simplify patterns
- Added quick fix for PyClass to add `__match_args__` attribute based on `__init__` signature
- Added PyRemoveElementFix quick fix to clean invalid list elements
- Added validation in PyPatternInspection to detect excessive positional patterns
- Added conflict detection between positional and named patterns in PyPatternInspection
GitOrigin-RevId: 64a1693aae2d243b83c46883a5d8476e727562a8
This prevents the caches from blowing up in size when analyzing a lot of files in a row
The most obvious example is running `Analyze code` on the whole project. Previously, all PSI elements from all files would pollute the cache, potentially consuming multiple Gb of memory. See PyDjangoSourcesPerformanceTest as an example. It used to require 16 Gb of heap, and it would still sometimes fail with OOM. Now, it runs smoothly with 2Gb of heap
GitOrigin-RevId: f9854f8abdd7086414df8f610b0f2d611ca0d455
By default, when only changing whitespace at the top level, DefaultChangeLocalityDetector would trigger and say that only the changed whitespace should be rehighlighted. However, highlighting for a whole file would still be dropped. After that, PyUnusedLocalInspection would not be triggered for any function in that file, meaning it would not re-highlight them, leading to an inspection warning disappearing.
Now, PyChangeLocalityDetector triggers when changing a whitespace on a top level and triggers re-highlighting of the whole file
Performance consideration: re-highlighting the whole file might be expensive (that's why ChangeLocalityDetector was introduced in the first place). However, no other ChangeLocalityDetector is implemented for Python, so most of the time the whole file is re-highlighted anyways. Re-highlighting the whole file in a new niche case of changing whitespace at the end of the file shouldn't lead to any significant performance impact.
GitOrigin-RevId: 8f26c59da8501f8eac78d1280888dd49ffef28d4
+ add requirePythonSdk() verification for the Sdk extension functions, these methods are not designed to be called for non-python sdks and now will throw IllegalArgumentException.
also corrects dependency tree:
+ move PythonSdkUtil to the python.sdk module, remove dependency on psi.impl
+ create PySkeletonUtil for skeleton utils and leave it in the psi.impl
[python] (IJPL-205889) (BAZEL-2462) don't call getOrCreateAdditionalData for non-python sdks
+ add requirePythonSdk() verification for the Sdk extension functions, these methods are not designed to be called for non-python sdks and now will throw IllegalArgumentException
also corrects dependency tree:
+ move PythonSdkUtil to the python.sdk module, remove dependency on psi.impl
+ create PySkeletonUtil for skeleton utils and leave it in the psi.impl
GitOrigin-RevId: 20d958c5e15cc4e05545b2e61b126b5e015696ed
153 modules which contain classes used from external plugins from the Marketplace are marked as public. This is needed to ensure that it'll be possible to use that API after converting code from these external plugins to content modules.
GitOrigin-RevId: dc48e8970041fddd3bf50d280711e95ce9e9ad9b
- support @dataclass(slots=True)
- add inspection for conflict with explicit __slots__
- add quickfix for new inspection
- add/adjust tests
GitOrigin-RevId: 5ac6efeb6c1e209b641365e2f22bdca74ae6484a
Similar to PyRedeclarationInspection but specifically for type aliases.
The difference is that for type aliases, we should report them as redelclarations even if they were used before
GitOrigin-RevId: 735c7be53bf7625cf0dccb83d8a3157665f65a96
Before, when entering an `annotate` method, a reference to `AnnotationHolder` was stored in the annotator field. And this required synchronization. Now this reference is stored into a temporary PyElementVisitor object actually used to perform highlighting.
Also, register all python annotators using a regular 'annotator' EP. There is no point in using 'Pythonid.pyAnnotator'.
GitOrigin-RevId: ad1df8ce743bc62d3f43e6bf9b1a8ea370ff7de7
Add an index to the names imported from Python. This will allow you to check if the project has AI libraries in its dependencies.
GitOrigin-RevId: d16f3163a602194ef0f3254402dd4061ff8d2f7f
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>
GitOrigin-RevId: 979f894e595d903c55f33c8bd4c5c3d06cb2fe6d
We've long enabled numpy's own pyi stubs by default.
Now, without always available numpy stubs in python-skeletons this extension
causes an SOE when there is a module called numpy
(see `SemanticPyUnresolvedReferencesTest.test unresolved import from well-known installed import are critical`).
GitOrigin-RevId: 3cb4ff5ca3404cb4f20dd584da5928c78b73ea91