Commit Graph

349 Commits

Author SHA1 Message Date
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
Semyon Proshev
28dfeb83f5 Don't narrow type variable to its bound if actual type is Any (PY-43027)
GitOrigin-RevId: 7fca22b43203fdfc9fa2e2fa7452e362e6ec8dfd
2020-06-18 00:28:17 +03:00
Lada Gagina
2e617b803c IDEA-CR-63687: PY-41305 Add PEP 614 support
Allows to use any expression as a decorator

GitOrigin-RevId: e92af1ebd2c4d7024971fd4542bfe52640faaa26
2020-06-17 00:30:49 +03:00
Semyon Proshev
ed160cbeeb Provide type for pathlib._PurePathBase until PY-34617 is fixed (PY-30747)
GitOrigin-RevId: 25a707348036715ebb67280ea650a298cf882f4e
2020-06-16 17:08:14 +03:00
Semyon Proshev
327f9cbffd Support kw_only in attr.ib (PY-33189)
GitOrigin-RevId: 7354162dc40909842f95f9eb5c9e6b507c544ac8
2020-06-16 02:00:57 +03:00
Mikhail Golubev
05d909b4ab PY-42418 Treat Type[...] and type[...] equivalently
GitOrigin-RevId: bf136c8ac698a61fe97acab5547f1d92fdd147a2
2020-06-15 23:18:04 +03:00
Mikhail Golubev
44cfdcb094 PY-42418 Report subscripting builtin types in pre 3.9 in Type Hints inspection
It's no longer detected by unresolved references inspection, because we can't
recognize versions guards in .pyi stubs and falsely assume __class_getitem__
to be available in all Python 3.x versions.

Moving this check to Type Hints inspection allows both to give it a more
descriptive error message and suggest a dedicated quick fix for replacing such
usages with the corresponding aliases from "typing" module.

GitOrigin-RevId: 5ae8bb7037bfd8f30ed1b1eb5b1a8824a8ed6ba9
2020-06-15 23:18:01 +03:00
Mikhail Golubev
0d93948241 PY-42418 Render standard collections types as lowercased in Python 3.9+
It's not that easy for "Type[...]" because it can wrap a TypeVar and, thus,
not have a physical PSI element we can get the language level from.

GitOrigin-RevId: aaa2c4e3819f4368f019c491f11e51d8dbaec701
2020-06-15 23:18:00 +03:00
Vladimir Krivosheev
4e37bbb536 get rid of guava Sets.new* (not required since java 7+)
GitOrigin-RevId: 8eed42300cb24449371aede5076933d1df3fa700
2020-06-12 15:41:46 +03:00
andrey.matveev
edbd512159 PY-42772 Impl filtering positional only arguments
GitOrigin-RevId: 978dd1f4970d5b1aaa94e251cbf81dee51f2f36c
2020-06-08 10:11:19 +00:00
Anna Kozlova
3c7105fcc4 apply remove redundant cast
GitOrigin-RevId: 2bcbd253668f66ca2740074953cb661ebb6f3513
2020-06-05 21:13:15 +03:00
Gregory.Shrago
89d62b4e53 drop deprecated outOfCodeBlockModificationCount usages
GitOrigin-RevId: fb89eebca0f5c9beb58dc6338222cc956891a6e2
2020-06-04 00:11:15 +03:00
Mikhail Golubev
4fc3af2705 PY-42700 Offer f-string-like completion after "{" in non-interpolated strings
The main idea here is that we also automatically convert the containing string
literal into a proper f-string upon selecting one of such variants.

Hopefully, it addresses the common problem of forgetting to add "f" prefix
before an interpolated (in mind) string literal in a more discoverable fashion
than a dedicated intention or a postfix template would.

GitOrigin-RevId: f59065abeb4a3b0cd7a0de42c9c06c9fad318b19
2020-06-03 19:03:09 +03:00
Peter Gromov
ead0f8c3ff convert some more method references to lambdas to speed up class loading
GitOrigin-RevId: 85f057f8f064486078dadc7ecf299fcef6c918a2
2020-06-03 17:31:10 +03:00
andrey.matveev
c4bf5bc2fc PY-42520 Impl filter repeated named args
GitOrigin-RevId: f68f51219b49792f109f94352e83f5671d53f3dd
2020-06-03 15:51:55 +03:00
Peter Gromov
85408c904b convert method references to lambdas in various *ElementType* definitions to avoid loading all these PSI classes at once
GitOrigin-RevId: 046d1bdebadbc04a56e391e63713f2d5f4865469
2020-06-03 11:05:35 +03:00
Petr Golubev
fb6d57c8c9 LAB-31: register python commenter
GitOrigin-RevId: 4f2d4ba2c71fe10b77d903410c1a833578ea8c7c
2020-06-02 21:20:09 +03:00
Semyon Proshev
f95d4aef98 Sync with typeshed @ 43cf0ec87058b247188fd1c7d906265eef07214c (PY-42534, PY-41791)
Possibly PY-32905 and PY-32788 are fixed.
No more need to provide callable type for `typing.TypeVar` because of https://github.com/python/typeshed/pull/4150

GitOrigin-RevId: f45928ad3b6ab18866b543bd2f375faa92d79b41
2020-06-02 19:59:09 +03:00
Sergey Stupin
f5afc6ba2f fix unused imports
GitOrigin-RevId: 7d93320dcf7c1436acbf2521b9256a8f1c615a16
2020-06-02 12:57:29 +03:00