Commit Graph

970 Commits

Author SHA1 Message Date
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
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
c6a15fa65b Simplify a check in CompatibilityVisitor
GitOrigin-RevId: 14bc99af4e89c443bba2f8569fdfad0053459fe4
2022-05-02 15:26:54 +00:00
Lada Gagina
cc86fa5983 Fix NPE in PyDictLiteralCompletionContributor (EA-468833)
GitOrigin-RevId: 4b3c9f0e126ab0f8724cfd7e8b1ad0758540732e
2022-04-22 13:02:23 +00:00
andrey.matveev
1d609e360c EA-485045 Add check for empty argument list in PyMultipleArgumentsCompletionContributor
GitOrigin-RevId: 8a127dc0cb1cb032b5630658a75c0549d5300ad6
2022-04-07 06:02:10 +00:00
Alexey Kudravtsev
9d58c2ab19 fix non-latin symbols inadvertently mixed up with latin
GitOrigin-RevId: 13beb89a6bd42b5fa69aab57862236867d3eaf61
2022-04-06 11:05:48 +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
Aleksei Kniazev
effa066a2d [python] switched PyPathEvaluator to nio
(cherry picked from commit f6971ee81c260b18df28c815dd2fb82551a11de2)

IJ-MR-17579

GitOrigin-RevId: b02a05a918edc1332d3550db5f118fc62ae8d86e
2022-04-05 11:10:38 +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
aa26dc5e80 PY-52748 "Force new line after colon" -> "Single-clause statements" should not affect pyi-stubs
GitOrigin-RevId: 9692ddefbfa0f315bd462862c3c6ec35f7dc30fe
2022-04-04 16:25:41 +00:00
Alexey Kudravtsev
f9373981a9 deprecate createWeakMap() in favor of java.util.WeakHashMap as more standard; retain only the custom hashing strategy variant of the former
GitOrigin-RevId: 64880ac5662a95e17df6915603ef52cf111e92c9
2022-04-01 15:07:14 +00:00
Vladimir Krivosheev
8a38317c23 cleanup
GitOrigin-RevId: 8cc592b4a987143ede26092986d3678393f1abd2
2022-03-27 18:52:50 +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
Yan Zhulanow
7a9d3ed1d7 Deprecate 'com.intellij.util.containers.isNullOrEmpty()'
The duplication is redundant as the platform implementation is identical to one in the Kotlin standard library. Moreover, it lacks a contract definition, preventing smart casts.

GitOrigin-RevId: ff97be37b183707e5d074ce2e56a90e3e9325d87
2022-03-23 07:43:40 +00:00
Lada Gagina
b8c68586bc Sync with typeshed @ 4e87b9058f0908fa895076c0d9643e18be785be6 (PY-41510)
GitOrigin-RevId: 31a3e761d5a4e2508e2eceb33170e8283bedcb36
2022-03-15 14:03:04 +00:00
Alexander Bozhnyuk
55ed7e1337 DS-2598 Fix: IPython magic commands needs to be resolved without '%'
Also fix for resolving display function in new versions of IPython

(cherry picked from commit caff9663d783310b13e55d4387e2b36b58e3ac23)

IJ-MR-19104

GitOrigin-RevId: 3f8d28b9464b62545e342acf2ccd0fbe15b9839d
2022-03-14 11:09:01 +00:00
Evgeniy.Stepanov
a59e2445ef [python] Do not try to store module settings if module does not support it, fix RIDER-65749
(cherry picked from commit 176cdfa247412ada05300429cde63a2c8fbb0c3c)

IJ-CR-21584

GitOrigin-RevId: 4ae79745171c032a76d00f79343220ac2e3118bf
2022-03-03 08:40:24 +00:00
Mikhail Golubev
1837cf5e0c Display more information about target expression stubs in "View PSI Structure"
I had to additionally implement toString() for all custom expression stubs
because otherwise the default Object.toString() breaks the platform test
checks on stub tree consistency (new and updated trees have different text).

GitOrigin-RevId: 35cd97df916836d0443b1177bfa5885864010a68
2022-02-25 19:32:05 +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
Semyon Proshev
de4f709c09 Change looking for helper root when running pycharm from sources
It now supports running after compiling with JpsBootstrap that makes another modules structure.

GitOrigin-RevId: d3e3a0598d5cabaa436bc7ce7bfec53b3919343a
2022-02-22 15:29:28 +00:00
Dmitry Trofimov
aacc1d4ac5 Fix messages according to https://jetbrains.team/p/ijpf/reviews/4476/timeline
GitOrigin-RevId: cd390d2c7cf61f43a554d198f98f7375d872ffa5
2022-02-22 11:29:30 +00:00
Dmitry Trofimov
8d6f3c7566 Fix messages according to https://jetbrains.team/p/ijpf/reviews/4343
GitOrigin-RevId: cc2a22c7ff04abc7e5d9b763e1f67ba144d47462
2022-02-22 11:29:28 +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
Elizaveta Shashkova
b1e8fc9ecb PY-21984 Type Renderers fixes
GitOrigin-RevId: 5911d95d52d994ac4f3e8c514b28f1008b0047e6
2022-02-21 15:44:09 +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
Anton Bragin
f482e9abff DS-3171 Tests for superclass extraction in Jupyter added
GitOrigin-RevId: 32ebd1aaf156413f8f04f11a7a2f3bc1c2c13c39
2022-02-17 20:43:51 +00:00
Anton Bragin
bf28b59725 DS-3171 Extract Superclass works within a single Jupyter notebook
GitOrigin-RevId: eb2e9eb511da8a41e162ff217e23ff8a9d2bf82f
2022-02-17 20:43:48 +00:00
Dmitry Batkovich
7845515960 replace deprecated api usages IDEA-288973
GitOrigin-RevId: 8710623c8abd6f21b49f3e0f7d10639eea8b6170
2022-02-17 11:13:06 +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
Tagir Valeev
090f452ab0 Remove unnecessary boxing
GitOrigin-RevId: 5b7d8fbfca9d58fcde762c01e564b16be44d9c1f
2022-02-17 05:40:22 +00:00
Tagir Valeev
38bfebaa23 Unnecessary fully-qualified names removed
GitOrigin-RevId: 903dbd15b9f5c307d2e17747a86d5eeecaff144a
2022-02-16 09:35:23 +00:00
Lada Gagina
b8bbabe9b1 Fix code style in PyTypedDictType, PyTypeCheckerInspection
GitOrigin-RevId: fc123ed6304b8e21d3092ed93079b6a450faa237
2022-02-15 16:58:01 +00:00
Semyon Proshev
624dc7823b Reduce code duplication
GitOrigin-RevId: 92d09f2964a28962dd378b2695c5375f1adaa0af
2022-02-14 17:16:11 +00:00
Semyon Proshev
38dd9d9e84 Sync with typeshed @ 7682ae957a32686becaf884de26cf79c9de5b221 (PY-41510)
GitOrigin-RevId: b199b44b7611b70ddc52848dfc4f71684f49e711
2022-02-14 16:49:39 +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
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
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
Nikolay Chashnikov
b0e823c711 [intellij project configuration] fix format of iml files
GitOrigin-RevId: 8d65ce934d66f057e23e1e4f1f384b5799f151d3
2022-02-08 07:42:10 +00:00
Tagir Valeev
3df143dfe6 Use try-with-resources; other warnings fixed
GitOrigin-RevId: 57e9bbb62af11b0629f9d02534b07e7a921c55af
2022-02-08 06:35:41 +00:00
Dmitry Trofimov
6cfea6e0b5 CodeServer: Python extract method refactoring, also decouple platform Rename refactoring from UI and lang modules
GitOrigin-RevId: fbe188a96f7eeaa168d6acf2874b1b759b9d8791
2022-02-01 19:19:46 +00:00
Alexey Kudravtsev
965f6c769c cleanup: method is identical to its super method
GitOrigin-RevId: 350ea63057fc436a3bcebed964228c43db8d5923
2022-01-27 13:29:12 +00:00
Nikolay Chashnikov
faecb93668 [intellij project configuration] fix format of iml files
GitOrigin-RevId: 9673bc73f6254fa677df806f9c34faafaf5f33fd
2022-01-25 10:44:22 +00:00
Dmitry Trofimov
a9a116522a CodeServer: Python introduce variable refactoring
GitOrigin-RevId: 9404442216786c92508c4a8f4bece96013683083
2022-01-24 19:34:17 +00:00
andrey.matveev
3ae3780538 PY-26881 Fix getLocationString messages
GitOrigin-RevId: 42a5a38b321e8611b9eb466a8cec675cb430cbd1
2022-01-24 05:57:47 +00:00