Commit Graph

5946 Commits

Author SHA1 Message Date
Mikhail Golubev
97b22aaa13 PY-42200 Support parenthesized context managers in Python 3.9+
In case of syntactic ambiguity with previous versions of the grammar, such as
"with (expr)" or "with (expr1, expr2)", PyWithStatement is still parsed as
having its own parentheses, not a parenthesized expression or a tuple as
a single context expression. The latter case, even though syntactically legal,
is still reported by the compatibility inspection in Python <3.9.

These changes also include proper formatter and editing support (e.g. not
inserting backslashes on line breaks inside parentheses), as well as
Complete Current Statement, which now takes possible parentheses into account
while inserting a missing colon.

The changes in the formatter are somewhat ad-hoc, intended to minimize the effect
on other constructs. "With" statement is somewhat special in the sense that it's
the first compound statement (having a statement list) with its own list-like
part in parentheses.

Existing tests on with statement processing were expanded and uniformly named.

Co-authored-by: Semyon Proshev <semyon.proshev@jetbrains.com>

GitOrigin-RevId: 15c33e97f177e81b5ed23891063555df016feb05
2022-05-04 12:31:37 +00:00
Mikhail Golubev
13d49d63e1 PY-43505 Uncomment a now passing test
The problem was most likely fixed as part of PY-36478 in
f2b45554d16ff87d946950591f0e92fedcfdfaf0

GitOrigin-RevId: a9001840052ca0d23ffeb98c2bee359183c6289f
2022-05-02 15:26:55 +00:00
Aleksei Kniazev
05a99b5e99 [python] support Pathlib-style path declarations in PyPathEvaluator (PY-13911)
(cherry picked from commit 3673aa3bac948bae5c7e8fd6521f251285d70cf9)

IJ-MR-17579

GitOrigin-RevId: 17d336d8f6d5e16bd3dca815c2f9935911e050ee
2022-04-05 11:10:41 +00:00
andrey.matveev
368055ab2d PY-42682 Add test adding keyword vararg to the end
(cherry picked from commit acad2e8c5c5aee3da51bb27c294a381ac7364599)

IJ-MR-22901

GitOrigin-RevId: d15a773341632dac6c4255f81b8b52a014cc3fce
2022-04-05 10:34:10 +00:00
andrey.matveev
157b37920e PY-42682 Fix IncorrectOperationException when adding keyword vararg to signature
(cherry picked from commit 24a4542fc09784ed4359ed558cd5a8e49b29bf1c)

IJ-MR-22901

GitOrigin-RevId: 6cd2544783580312e1194b3d76e47f9db88fbdf3
2022-04-05 10:34:08 +00:00
Lada Gagina
30cd450db3 PY-43689 Don't report forward references and Union types using the | operator in PyTypedDictInspection
GitOrigin-RevId: e57faacb50143381341c9320894106a9df88618e
2022-04-04 18:28:06 +00:00
Daniil Kalinin
85f5bb3763 Tests for PY-52748 "Force new line after colon" -> "Single-clause statements" should not affect pyi-stubs
GitOrigin-RevId: 976fac3f170923a153e06a3435281f0e3436e1cd
2022-04-04 16:25:45 +00:00
Vladimir Krivosheev
a8f6a48409 add jdom to source code to modify and strip to our needs
GitOrigin-RevId: 3e16d0d954aa7bc45c4eadb91164b44e4b2e75d3
2022-03-27 18:52:47 +00:00
Lada Gagina
b8c68586bc Sync with typeshed @ 4e87b9058f0908fa895076c0d9643e18be785be6 (PY-41510)
GitOrigin-RevId: 31a3e761d5a4e2508e2eceb33170e8283bedcb36
2022-03-15 14:03:04 +00:00
Gregory.Shrago
1caf1486bb do not run todo index during project indexing
The todo index employs user-configurable patterns that can significantly slow down indexing process. To solve this problem the todo index is now excluded from the project indexing procedure while still reusing index storage. Later we can switch to gist API for that.

GitOrigin-RevId: fe4020a03bd1fd4a9a109ffc8782ca1c23d42735
2022-02-28 15:54:58 +00:00
Mikhail Golubev
db8e5c2e2e PY-47962 Start-match non-imported module names in completion
This way we further reduce the number of irrelevant completion items suggested
effectively in every expression context, e.g. not suggesting "parser" and
"calendar" modules for the "ar" prefix, only something like "argparse" or
"array". The same applies to the completion of attributes with unresolved
qualifiers.

GitOrigin-RevId: 7a58053c4744c3d0066c379a4f190ffd09bfabd1
2022-02-23 11:55:19 +00:00
Mikhail Golubev
5ca605ccab PY-47962 Put non-imported module names last among completion variants
By giving them an explicit priority lower than the default. Unfortunately,
it doesn't remedy the problem with short module names, such as "re" or "sys",
always being on top when they completely match the entered prefix.
At the moment this behavior is hard-coded in the platform and cannot be
altered by language plugins. It's not caused by the "liftShorter" classifier.

Also, explicitly prioritizing various lookup elements has become quite messy
and scattered across PyCompletionWeigher and specific contributors. It begs
to be refactored, but will be addressed separately.

GitOrigin-RevId: d6f6ad06f5d68f3de7b866b8240a95b785604649
2022-02-23 11:55:15 +00:00
Mikhail Golubev
ff82f4e058 PY-47254 Don't duplicate already imported module names in completion
By running the completion contributor for non-imported modules after everything
else, including the LegacyCompletionContributor offering names present in
the scope, and filtering out duplicate variants.

GitOrigin-RevId: 98982b2c33d1fc11d70b144de556a6825bd3febc
2022-02-23 11:55:12 +00:00
Dmitry Trofimov
f49686ca20 Fix tests after messages rewording
GitOrigin-RevId: 9e4be2d89230b43e383889bf8a9e1369d00c6cb8
2022-02-22 16:39:05 +00:00
Lada Gagina
c7d12e929d PY-40007 PY-41546 Add completion for keys of dict literals marked as TypedDicts
- in call expressions
- in assignment statements
- in return statements

GitOrigin-RevId: aea2063f7cd7ffc68903c79fa16a25fdf4ff0f8f
2022-02-21 21:13:02 +00:00
Ilyas Selimov
4aaad04a9e zero tolerance fixes
GitOrigin-RevId: 616984c9887fd113f8785403d4567b376e58745f
2022-02-18 10:14:59 +00:00
Mikhail Golubev
3b6dea06a3 PY-21398 Wrap batch updates of existing usages in quickfixes with PotemkinProgress
It also fixes EA-425763 about using incorrect parent and anchor elements
to insert a function generated from a method of a nested class.

GitOrigin-RevId: f9b9da303396eb78c2c12b2750065dbdc0ba70ed
2022-02-17 09:28:34 +00:00
Semyon Proshev
38dd9d9e84 Sync with typeshed @ 7682ae957a32686becaf884de26cf79c9de5b221 (PY-41510)
GitOrigin-RevId: b199b44b7611b70ddc52848dfc4f71684f49e711
2022-02-14 16:49:39 +00:00
andrey.matveev
806fa72b80 PY-51329 Fix problem with overloaded bitwise or operator chains
(cherry picked from commit f265b05500ef8a6b35e7fef090a971f4a5449453)

IJ-MR-17506

GitOrigin-RevId: 5cac0b7d071f753023b97c4e4152acbe388b8f08
2022-02-11 14:18:56 +00:00
Lada Gagina
6f6835f317 PY-46661 PY-43387 Add TypedDict type-checking in return statements, fix tests
GitOrigin-RevId: 6ec55896fce0ff0f40eb66975a7562e4383634ef
2022-02-10 23:02:32 +00:00
Lada Gagina
58815862bd PY-46661 PY-43387 Add type-checking for nested TypedDicts, fix tests
GitOrigin-RevId: c96467c83d7d584bb8a80cdbf2b5faf63735064f
2022-02-10 23:02:29 +00:00
Lada Gagina
72772c55da PY-46661 PY-43387 TypedDict type-checking in call expressions: report value type errors, missing and extra keys
GitOrigin-RevId: ad8c2e37cf893e50aeda7a54d113dec571b0d135
2022-02-10 23:02:25 +00:00
Lada Gagina
bc28fa5645 PY-46661 PY-43387 TypedDict type-checking in target expressions: report value type errors, missing and extra keys
GitOrigin-RevId: 9636c8e032f9d084d7a5c3a8036e54422b8dd222
2022-02-10 23:02:21 +00:00
Ilya.Kazakevich
bf33810acb Destroy process when test failed to prevent leaks
GitOrigin-RevId: 8e7361896f13cc70041b249078b6568f661d5c7f
2022-02-08 16:02:06 +00:00
Dmitry Trofimov
f35438983c CodeServer: support Python inline variable and inline method refactorings
Also decouple BaseRefacgoringProcessor from UI and split usageView into api and impl parts

GitOrigin-RevId: c4c6d9011726d93f0ee6ab4677f7a105c28ec108
2022-02-08 13:31:12 +00:00
Ilya.Kazakevich
1e81de703b Fix pytest: add argument to --debug.
We use `--debug` to make sure runner doesn't break.
But since 7.0 it requires additional argument.

GitOrigin-RevId: b5c03f3783a4c09e9866058d50cad807c6953373
2022-02-07 16:50:40 +00:00
Mikhail Golubev
edda5f507f Dump information about "django/__init__.py" skeleton availability on agents
GitOrigin-RevId: 19c11ca8b2e2f2a0397c52c0a3af321778434d59
2022-02-04 14:36:48 +00:00
Mikhail Golubev
0ce17fa169 Dump whether the problematic skeleton is actually present during a test run
GitOrigin-RevId: 496b07abe00738c5c26bda60e391d22683dff2d6
2022-01-31 17:42:20 +00:00
Tagir Valeev
c69d5d7264 [refactoring] IDEA-287118 Suggest change signature refactoring when call site is edited
Core + Java implementation

GitOrigin-RevId: d32a646a3751be7e69c8051f2898a06d73bcdde9
2022-01-28 10:04:47 +00:00
Mikhail Golubev
754acbfebf Indicate whether the dumb mode is in progress in flaky tests
GitOrigin-RevId: 39b218f25236461b5aecee5aa89475f701230afe
2022-01-27 17:47:49 +00:00
Mikhail Golubev
ae5014ed5c Configure the fixture with a file before checking indexes to fix test blinking
Assuming that there might be some synchronization point in fixture methods
that ensures that indexes are ready for code insight actions.

GitOrigin-RevId: 556d052edf76e85d14c35ded4fd582ed6293dbec
2022-01-27 13:01:55 +00:00
Mikhail Golubev
cdf1de40f4 Add diagnostic for flaky tests about python-skeletons stubs
GitOrigin-RevId: 4e7e51321e54bc3d4a591cf83963dc147cb49d86
2022-01-26 22:51:02 +00:00
Dmitry Trofimov
a9a116522a CodeServer: Python introduce variable refactoring
GitOrigin-RevId: 9404442216786c92508c4a8f4bece96013683083
2022-01-24 19:34:17 +00:00
Egor Eliseev
63a54778f6 PY-16583 Incorrect escaping in debugger
GitOrigin-RevId: 1f08062cd5715658ab17aeca3cfe52b275406936
2022-01-24 18:45:09 +00:00
Gregory.Shrago
cc57f68c45 reduce todo index storage size
`SingleEntryFileBasedIndexExtension` with "nulls" reduces the size of the todo index data for IC project from 4+MB to 180+KB.

GitOrigin-RevId: cfe1947600450fec442d3cb4b50c175398f79975
2022-01-21 13:50:36 +00:00
andrey.matveev
0210695327 PY-26881 Use stubs for function in find usages if it exists
(cherry picked from commit 060c164c3f01a857561d5d0341a186464419e845)

IJ-MR-17639

GitOrigin-RevId: 88141ea74ff22fb022056c8d6d7f70222a3f9b74
2022-01-21 03:17:30 +00:00
andrey.matveev
2953318655 PY-38636 Fix go to declaration lead to pyi in some cases
(cherry picked from commit 33b52287f1d5241ee0bc4b8ff1c065e32f26d063)

IJ-MR-18958

GitOrigin-RevId: 5a59d6e6ea3ab001b8237d408340536abe2678e0
2022-01-20 12:03:22 +00:00
Daniil Kalinin
71197da977 PY-27627 Typehints for explicitly parametrized generic class instances
Tests for explicitly parametrized generic class instances

(cherry picked from commit 134748c973843ce8effbf516bbed9be3efbdf8f1)

IJ-CR-18208

GitOrigin-RevId: 0e6c9086964a93cd23385a95d502110c5cc758e4
2022-01-20 07:12:59 +00:00
Ilya.Kazakevich
2f18840e4b Test fix
We now represent strings using quotes (because this is how repr works in Python). We also don't want to hardcode order of "expected" and "actual"

GitOrigin-RevId: 1c70b3839fa7725db21896d09d839884c500deb7
2022-01-19 16:34:24 +00:00
Ilya.Kazakevich
9214f0d529 Remove IronPython tests: nobody uses it
GitOrigin-RevId: 27d1b005d84e43cfc5fa831111aebcf1c65637b1
2022-01-19 14:49:27 +00:00
Alexander Koshevoy
6c81eae0d8 Fix PythonDebuggerSetValueTest failures because of incorrect assumption about dict items' order
Dict items should not be expected to have specific order before Python 3.6 (when order-preserving behavior is added as an implementation detail).

GitOrigin-RevId: 033bfdfa9a27b8a35d76e217075f0b9989af1b2f
2022-01-17 09:26:54 +00:00
Bas Leijdekkers
ce078dac32 RegExp: new "Regular expression can be simplified" inspection (IDEA-286122)
Supersedes the "Asterisk closure can be collapsed to plus closure" inspection which was only available in PhpStorm

GitOrigin-RevId: a63c6fce88b3700cc521e8b113069a4b2b50a3e4
2022-01-13 20:26:25 +00:00
Alexey Kudravtsev
dcd374eb82 refactor HierarchyTester to allow node descriptor comparator to test the children order
GitOrigin-RevId: 0e307b174a68169e37d66e8ef4432fcdaab0f02d
2022-01-13 17:51:52 +00:00
andrey.matveev
07ebb19aee PY-33843 Fix problem with extracting constant from comprehension
(cherry picked from commit 72bb8e523471c9922ae3d8f95f7fa9ce1fe0009d)

IJ-MR-18836

GitOrigin-RevId: dadb7cf489a0501b834cff7e10979fab2c8ae8cd
2022-01-13 07:40:36 +00:00
andrey.matveev
d667021b15 PY-50930 Support ParamSpec from typing_extensions
(cherry picked from commit f2dee2fbe6aa66e14d5130f4910458b6332987d9)

IJ-MR-19113

GitOrigin-RevId: 87cfc35eb79dd11393390046d2401a1fa4d9acba
2022-01-13 07:35:57 +00:00
Semyon Proshev
d09cfa814b Sync with typeshed @ 48f13e451a3ef21002cca3f3b325ff3635f32d66 (PY-41510)
GitOrigin-RevId: b758ee90685ea9ad1e70cd8df2ea92afcb3f0f35
2021-12-24 13:26:30 +00:00
Daniil Kalinin
890f04e881 IJ-CR-16991 Highlight all parameters from the outer functions as parameters, not only self exclusively
Added test for this case

(cherry picked from commit 4019a7deb4b577eb6a42200fa4758a2624e26896)

IJ-CR-16991

GitOrigin-RevId: 86861f573d66abd3d9100de1ebed59513838a24d
2021-12-16 10:36:47 +00:00
Alexey Kudravtsev
8f3306ed1b deprecate runInWriteAction() method in tests as unnecessary, slowing down the tests and very un-production-like
GitOrigin-RevId: 31869e6d8c9ee543481dd06f6343bca6827e4a33
2021-12-10 14:47:39 +00:00
Semyon Proshev
574a315230 Use proper type eval context while looking for callees (PY-52034)
Otherwise PyTargetExpressionImpl.getType can not infer type for a qualifier defined inside function body.

GitOrigin-RevId: 75345218653fc8507cc31498fda7b8f07d4c02c6
2021-12-10 13:47:33 +00:00
Daniil Kalinin
a83b789054 PY-24653 Fix Self highlighting in nested functions
(cherry picked from commit fbfc5683399723ac0d49e5aa337024154dd6d3a9)

IJ-CR-16991

GitOrigin-RevId: 69084562247b0105f268fac9f442e02756240173
2021-12-06 08:50:49 +00:00