Commit Graph

367 Commits

Author SHA1 Message Date
Adam Hood
19595af581 LAB-31: extract PyFilterLexer, PyIndexPatternBuilder to python-psi-impl
GitOrigin-RevId: 3e5c1a17e2d506ba874e19231958290d13d958d0
2020-08-07 17:40:51 +00:00
Semyon Proshev
1e9182b7e0 Run PyCollectionTypeByModificationsProvider last since it could affect type inference due to recursion inside (PY-39510)
GitOrigin-RevId: 619db13e01470e9ac5f1a75a46e3cd791042f405
2020-08-04 13:27:41 +00:00
Mikhail Golubev
1d7f686ec7 EA-222888 Don't include code fragments in the exception message
GitOrigin-RevId: 638026b88634b1cc37556984a020e6aff0472749
2020-08-03 16:59:41 +00:00
Vladimir Krivosheev
2a3ea3b088 prefer jdk collections
GitOrigin-RevId: 5634ed51a4458b904c3a1d913c1978b5b3bb84e0
2020-07-29 07:02:03 +00:00
andrey.matveev
4bf398f03c [PY-24482] Fix import toggle alias intention
GitOrigin-RevId: e3a345ef671ad8e8717cdc048bd57cf00a0d6fd2
2020-07-24 02:00:13 +00:00
andrey.matveev
965121e9dc [PY-26418] Fix removing whole with statement if target is unused
GitOrigin-RevId: 217ee91cebf600fa0035c2534d1b00878cf41858
2020-07-21 10:42:32 +00:00
Alexey Kudravtsev
ce28f375ce notnull
GitOrigin-RevId: a62047f61869bc1971b700232adbde58019ad265
2020-07-21 10:38:54 +00:00
Semyon Proshev
1e1bfd58ac Inject separate python dialect into type comments (PY-35370)
No more PyDocstringFile for them since doctest and type comments should be parsed differently (at least `...` should not be skipped)

GitOrigin-RevId: 9b78ad0491859dbf381a049e93ac74bc83db4183
2020-07-20 18:38:43 +00:00
Petr Golubev
1bd356f340 [jupyter notebook] PY-43535: False positive "Statement seems to have no effect"
GitOrigin-RevId: 99614950a778eb8fa12f34353213055dea2aff27
2020-07-20 15:21:00 +00:00
Semyon Proshev
ebf8abb7d9 Use type while resolving name in the similar py-file (PY-28053, PY-41403)
So all the logic inside PyModuleType will be used (e.g. module members providers, PyStdlibOverridingModuleMembersProvider in this case).
Test is removed due to Python 2 EOL and no failure on regression.

GitOrigin-RevId: 4d9f588d9dc5f682f2ae194b17ed774b1f7bb804
2020-07-20 14:20:57 +00:00
Tagir Valeev
4d21ad341f Annotate bundle methods as Nls
GitOrigin-RevId: db851b498d99f538e1f747faa4fb4d954848982f
2020-07-17 07:46:42 +00:00
andrey.matveev
787c24a059 [PY-31388] Support ignoring variables starting with underscore
GitOrigin-RevId: 134a6f37a19192b447b688812208b047ca58c757
2020-07-16 15:03:03 +00:00
Semyon Proshev
c9f08b1960 Get rid of streams since there are no more updates in the inferred types after drop of implicit offset
Make PyCallExpressionHelper#selectCallableTypes unwrapping unions

GitOrigin-RevId: e0fd0038009d14cebf969bd3c13f727feaa58842
2020-07-14 14:44:40 +00:00
Semyon Proshev
887deb0dd7 Get rid of MakoArgumentListInspection and implicit offset in PyCallExpression as a result
GitOrigin-RevId: 2cc1155a0c22752bb47158cf50a58c9948ffd146
2020-07-14 14:44:39 +00:00
Semyon Proshev
20bca8c772 Fix formatting and i18n in type hints inspection
GitOrigin-RevId: 013724b10d61d2c7909350ac8b58b1807f8cbcb8
2020-07-14 14:26:10 +00:00
Semyon Proshev
820e06aa04 Suppress dataclass inspection for args-kwargs __post_init__ (PY-43359)
GitOrigin-RevId: e0859a967ceac6d156e456c3f937d8b18b7a55f3
2020-07-13 19:32:07 +00:00
andrey.matveev
49c99c9577 [PY-20893] Fix removing full block by quick fix unused local variable for exception
GitOrigin-RevId: a518e1edee1c52543e9059e98439573770bc746b
2020-07-13 12:39:38 +00:00
Peter Gromov
6439c9ac37 don't resolve python references when searching for Java methods
GitOrigin-RevId: 59e08ae3d4ce10b119174359943e4176e4a84d11
2020-07-10 09:50:53 +00:00
Semyon Proshev
2ff5b1ea46 Remove api notes in favor of annotations
GitOrigin-RevId: a5a74d65dd2b0e820047ef10d6a74e1d3bf604b6
2020-07-09 12:08:14 +00:00
Semyon Proshev
d2c4349831 Simplify PyCallExpressionHelper#mapArguments functions
GitOrigin-RevId: 4061fc9b9a4b9e0492ba19b83e974a441e60ecb4
2020-07-09 12:08:12 +00:00
Semyon Proshev
53df3275e4 Use map function that takes implicit offset from callable type (PY-42205)
Since inner resolve function provides correct offset.

GitOrigin-RevId: 3e882c47537f16968fe6c5ba27475f9e1debc4d4
2020-07-09 12:08:10 +00:00
andrey.matveev
f682252be5 [PY-40177] Fix Replace Dictionary creation quickfix doesn't considered PEP 448 unpacking
GitOrigin-RevId: b498b26ae1218367065de0f65fb25439de1694fe
2020-07-09 11:02:46 +00:00
Stanislav Utikeev
08c87824f3 LAB-31 Check that parameter list of signature help is closed before dropping the results
GitOrigin-RevId: 7266d00843abbcfa6d01d0303a0317f37641f695
2020-07-09 10:27:52 +00:00
Stanislav Utikeev
b16c539dba LAB-31 Check for signature help that offset lies within argument list
GitOrigin-RevId: 73b551b482825677395778fc6289d2dae6d72e5c
2020-07-08 10:52:42 +00:00
Semyon Proshev
f1f46660b0 Improve formatting and fix highlighted places
GitOrigin-RevId: db2143d933f893c386e5fa0f568416c62b8516e0
2020-07-07 22:03:56 +00:00
Semyon Proshev
7831a42f45 Increase usage of already existent type evaluation context
GitOrigin-RevId: 47d68650d1888769f179cd62a4216694fc7e0cea
2020-07-07 22:03:56 +00:00
Lada Gagina
bda695c856 IDEA-CR-64379: PY-43012 Enable Cython decorator parsing tests
GitOrigin-RevId: a5d86813e1a9dd9f357d77d71ade116d3949692c
2020-07-07 11:26:50 +00:00
andrey.matveev
eb701312fd [PY-16194] Fix passing other calls besides append on list in list creation quick fix
GitOrigin-RevId: b699acf7cf42cdd47ff8a7b2f0ab4f404eddb152
2020-07-07 04:37:07 +00:00
Mikhail Golubev
67f19a8bf2 PY-43198 Restore generating docstring with types collected by the debugger
It was temporarily commented out during extraction of python-psi-impl and
forgotten in this state after all the dependencies have been resolved.

GitOrigin-RevId: d6b985229fbfeed0ac0086e84ad586617a6c3d10
2020-07-03 13:49:40 +00:00
Semyon Proshev
c75e25ccc9 Cache provided callees since theirs computation could be heavy and frequently requested
GitOrigin-RevId: 5487a422c3c599551d104b9a99327bc9a0b57dbc
2020-07-02 22:04:03 +00:00
Semyon Proshev
2398af2645 Optimize making union type non-weak
GitOrigin-RevId: e8e41f8f51f0452bc237df5342baa2cd6a41c2f8
2020-07-02 22:04:02 +00:00
Semyon Proshev
2b6e26ce04 Cache result of PyClassImpl.getSuperClassTypes since it could be invoked very frequently
GitOrigin-RevId: abd1602256d39f3985263484d4053bff4ae20832
2020-07-02 19:18:22 +00:00
Mikhail Golubev
f3e81f8d68 Fix stub handling in a few type providers by introducing StubAwareComputation API
It turned out that several existing type providers incorrectly processed PSI
stubs, returning nothing in cases when TypeEvalContext prohibits accessing AST,
but the containing file was already unstubbed, leading to inconsistent "flaky"
analysis results.

Since the pattern for safe accessing AST vs. stubs properly taking into account
both TypeEvalContext constraints and StubBasedPsiElement.getStub() is notoriously
tricky to get right, and it's not the first time to such problem was discovered,
we tried to hide this logic behind a new experimental API -- StubAwareComputation
and migrated those type providers to it. Other code insight parts that need to
operate on stubs, especially custom ones, might follow.

This change is a joint effort with Semyon Proshev who came up with an initial
draft of the new API and updated all the affected type providers.

GitOrigin-RevId: 2ea467d85a6d30e37049edacd5eb4a32768f5252
2020-07-02 11:05:57 +00:00
Semyon Proshev
d7249204b6 More usages of PyPsiFacade.createClassByQName
GitOrigin-RevId: 78fcf304f47d8e904639c07846b4e1d78aaad1b4
2020-07-02 11:05:56 +00:00
Mikhail Golubev
fadb131582 EA-232631 Disable f-string-like completion in strings nodes outside of a string literal
String nodes are recognized by the lexer and, thus, can still appear even in
syntactic contexts where an expression is not expected. In these cases the parser
might wrap them in a PsiErrorElement instead of a PyStringLiteralExpression causing
the reported CCE.

GitOrigin-RevId: 161d88d6307e028ede462f707f01320df2169747
2020-06-30 18:29:22 +00:00
Mikhail Golubev
6c7cff7b1e PY-42823 PyGotoDeclarationHandler doesn't return definitions for themselves
The new implementation of "Go to Declaration or Usages" doesn't expect such
results from providers and intentionally just unconditionally leads to whatever
they return instead of showing usages in such cases.

GitOrigin-RevId: b3e63b36254e6ca1aca77030ee6ac56ff03308c9
2020-06-30 13:48:48 +00:00
Semyon Proshev
58b1e55995 Be ready for no arguments passed to list.append (EA-232303)
GitOrigin-RevId: 004e1867b6bb891e6feb8ed1e0d6b9c65768fe85
2020-06-29 17:18:18 +00:00
Semyon Proshev
25cd16cbab Not nullize class name when rendering documentation (EA-232367)
GitOrigin-RevId: 0ada401f3f8e3a72f29e368222f51ae26ef509cd
2020-06-29 13:59:06 +00:00
Semyon Proshev
756740330c Fix passing null to super methods consumer (EA-233191)
GitOrigin-RevId: 67a8627e64a44f768d7f3bbd275b6a5328eb2607
2020-06-29 13:21:27 +00:00
andrey.matveev
abc2894e1d PY-21284 Fix add field quick fix with constructor with type annotation
GitOrigin-RevId: dc57a492cd7d7dff4ef856b488678778fea56d34
2020-06-26 19:36:44 +03:00
Semyon Proshev
fd3adf6b5d New variable for letters economy
GitOrigin-RevId: d41b323a43ec6cc8b84ae3c663dd76d8b8655c26
2020-06-26 13:21:29 +03:00
Semyon Proshev
16e4bb618c Drop self when matching against protocol method (PY-43133)
GitOrigin-RevId: 6dba4fdf20e1d1cf98bd66151b05d1f03bd2158a
2020-06-26 13:21:28 +03:00
Vladimir Krivosheev
d4e9b09e26 cleanup (final)
GitOrigin-RevId: 93607e195763f2acf29ee0d7a280d7e07e8d2f14
2020-06-26 12:21:17 +03:00
Semyon Proshev
3281fe3adb Make PyCallExpressionHelper.getImplicitResolveResults more flat
GitOrigin-RevId: c876e1da4a51063763d5946e44f1e6201cadee6f
2020-06-25 15:56:14 +03:00
Semyon Proshev
405607254d Fix null passed as a key to stub index (EA-228390)
GitOrigin-RevId: 6dd1e209d021539d5860108bdb1e923f76971f0d
2020-06-25 15:56:14 +03:00
Adam Hood
d847d02d57 LAB-31: add module imports in same cell for auto-import action
GitOrigin-RevId: 64858614eef1dd50ae204c886a23195418d56b02
2020-06-24 02:51:29 +03:00
Adam Hood
621ccf8591 LAB-31: add imports in same cell for auto-import action
GitOrigin-RevId: 7603c6a2fd2bd472491a15f23d66034a84aace90
2020-06-23 23:12:52 +03:00
Mikhail Golubev
a717a7c145 PY-41305 Update PyDecorator API and docs for PEP 614
- Added PyDecorator.getExpression() to reflect that in Python 3.9
an arbitrary expression can be used after "@". Reused it where possible
in the implementation.
- Removed hasPlainReferenceCallee() in favor of existing getQualifiedName().
Updated javadoc for the latter to clarify how it handles non-trivial callees.
- Added PSI stub tests to make sure that right values are still persisted
with the new flexible decorator grammar.

GitOrigin-RevId: 8109b834c8d257c72f6f6e3c0ce5005060a2b971
2020-06-20 17:29:44 +03:00
Lada Gagina
04190d484c IDEA-CR-63674: PY-41847 Add PEP-593 support
Allows to use typing.Annotated

GitOrigin-RevId: cb53a229becd1d8d934cc55476174cdfa259d36d
2020-06-18 16:12:29 +03:00
Semyon Proshev
d79f13cf5a Provide generic type for self or cls
As a result, class-wide type variables will not be substituted inside methods.

GitOrigin-RevId: 8f341042f4944f61e212cf226b4736e9eb26ba8d
2020-06-18 00:28:18 +03:00