Commit Graph

636 Commits

Author SHA1 Message Date
Andrey Vokin
64663ae49d DS-1402 No easy way to change interpreter for all Workspace directories
Conda: Handle mock SDK

GitOrigin-RevId: 132a71c9cbd1a0fc7f56229d5e54492d8972f363
2021-03-29 10:53:07 +00:00
Vladimir Krivosheev
809b7ca201 deprecate ServiceManager.getService(project)
GitOrigin-RevId: 3805c3aac4e084c828558bf1b1570339f7f3b4a3
2021-03-26 21:30:32 +00:00
Semyon Proshev
566ab797db Attempt to fix EA-253812
GitOrigin-RevId: 5272ab1da4038bdbded8b9dd945da072be2788b5
2021-03-26 19:58:59 +00:00
Lada Gagina
78048abb15 PY-47247 Suggest subpackages and submodules in module attributes completion
IJ-MR-7312

GitOrigin-RevId: 2333fdc6ef9974b0f80bbe4d829c1211dde722ac
2021-03-26 13:38:45 +00:00
Andrey Vlasovskikh
65dee450b8 PY-45368 Fixed completing 'None' in type annotations
GitOrigin-RevId: fc7e7ff0a03ce41373bac2eedbf3e8b7aaa2ce4d
2021-03-24 14:53:13 +00:00
Mikhail Golubev
d774de8aae PY-47795 Make access to PyExportedModuleAttributeIndex flat, remove nesting
Nested index access is prohibited and can cause deadlocks.

GitOrigin-RevId: d3e4e21491bb17126ad1ac45cec78ba554149e45
2021-03-23 21:14:20 +00:00
Mikhail Golubev
f76600603e PY-46099 PY-47633 Don't remember usages in non-physical copies of methods in Pull Up/Down
PSI element copies exists in special non-physical files (DummyHolders),
and usually references in them cannot be resolved. It led both to exceptions,
when the rest of the code insight didn't expect resolve to happen in files other
than PyFile (PY-46099), and situations when we failed to resolve a usage in
a copy and restore the corresponding import (PY-47633).

Switching to processing original declarations also revealed a problem with
inserting imports -- we might have tried to insert impossible imports for
non-top-level symbols, such as class attributes and methods. Now, these are
ignored.

GitOrigin-RevId: 6816078596a2c0aced7045a80828b7e83ebee8c0
2021-03-23 21:14:17 +00:00
Semyon Proshev
ea9c2c9415 Reuse if-statements approach for while-statements to understand when and where condition is succeeded/failed (PY-39262)
It allows to assume that under `and` condition all sub-conditions are satisfied.

GitOrigin-RevId: f58ed2706d7eb9c1595415cce57cb8020011b57a
2021-03-23 11:45:13 +00:00
Semyon Proshev
882c5348b3 Add separate CFG instructions to if-statements to understand when and where a condition is succeeded/failed (PY-39262)
It allows to assume that under `and` condition all sub-conditions are satisfied.

GitOrigin-RevId: 104bb5a2200791d183cc26e008b974a6b658fa37
2021-03-23 11:45:12 +00:00
andrey.matveev
462574a88f PY-31369 Fix testTypeCommentedParameterNoIntention
GitOrigin-RevId: 2a14f90034a74d10005223e6cb6c35f2efa66a3a
2021-03-17 17:05:34 +00:00
Mikhail Golubev
b3daaed02f PY-46178 Protect against illegal fragment expression in f-string-like completion
It's not enough to just prepend an arbitrary string with "f" to treat it like
a well-formed f-string. If its part following "IntellijIdeaRulezzz " placeholder
contains special characters, such as "&" in URLs, it can break parsing of
a generated fragment to the extent we are no longer able to recover a string
literal from it (it all gets treated as a single embedded expression).
Forcibly closing a started fragment with "} " seems sufficient to guard against
the subsequent string content.

GitOrigin-RevId: fe682511475b800f013ace5e6e52fca9286cd418
2021-03-16 19:37:02 +00:00
Mikhail Golubev
8faf6e47bb PY-47304 Keep showing direct (non-fuzzy) module attributes after dot in completion
Previously, we accidentally offered immediate attributes of a module only right
after a dot in a non-imported qualified name (i.e., with an empty attribute name).
If a qualified name of a fuzzy variant matched that of a direct attribute, it went
unnoticed. However, if a name was non-trivially exported, as in case of
"_pytest.mark.structures.MARK_GEN" exported as "pytest.mark", its expected name,
as an attribute of pytest module, disappeared immediately as one started typing
anything past the dot in "pytest.".

GitOrigin-RevId: 5fbd7bd77fd1629f4d852b757d350cc182b991d7
2021-03-16 16:28:31 +00:00
Semyon Proshev
aaa2675ea2 Suggest to create function only for unresolved callee instead of any unresolved reference under call expression
GitOrigin-RevId: 88d8c2b8652dca2e1f80c0bc0d52a0f4ca8f038c
2021-03-16 08:55:58 +00:00
Lada Gagina
b3e4cc8ba9 PY-47307 Do not insert dot after module name in completion, drop aliases completion
Aliases were completed only when the prefix was a fully-typed alias, and it became useless without inserting a dot and calling PyUnresolvedModuleAttributeCompletionContributor afterwards
IJ-MR-6806

GitOrigin-RevId: fc5b5e91911bbc85bda4da0753ad8e6da69951cb
2021-03-15 13:52:43 +00:00
andrey.matveev
a109dafa9c PY-31369 Fix replacing current type annotation by intention
(cherry picked from commit 84c75591aecddb195d847c21410adbc565a596ee)

IJ-MR-5145

GitOrigin-RevId: 7dafcbf2f3d4b383c9cb6350f925eaf31886f9e0
2021-03-15 02:54:41 +00:00
Alexey Kudravtsev
ecad62483f provide readable file type name (instead of e.g. PLAINTXT), unify property names for file type description, add test for having getDisplayName() in a FileType
GitOrigin-RevId: eb857f57def6d82a2051fc2610a24de266ee8386
2021-03-09 12:18:29 +00:00
Semyon Proshev
672b4be090 Process stdlib/VERSIONS in typeshed and extract names available only in some supported pythons (PY-41510)
GitOrigin-RevId: 02d0cd334f0806f6466a54f8c3ffe2357950dafe
2021-03-04 17:43:07 +00:00
Semyon Proshev
39700adb5e Sync with typeshed @ 771e872cf605dbe6b489aa228c0a09a1a8ca69f2 (PY-41510)
Support new typeshed structure

GitOrigin-RevId: 4ada15febc11dc9acb8243c791aef722e16dd958
2021-03-03 22:46:04 +00:00
Semyon Proshev
9705a90e2f Don't show a modal dialog with untrusted venv warning, consider click on quick-fix as a permission (PY-41524)
GitOrigin-RevId: 19c05fb733c2a2070219d74290231e83e3b38071
2021-03-03 16:21:12 +00:00
andrey.matveev
135babbf04 EA-256745 Fix IllegalArgumentException in PyMultipleArgumentsCompletionContributor
(cherry picked from commit 4ee05e67c7b76c19627cb5e7018db71c96c41ebe)

IJ-MR-6318

GitOrigin-RevId: a1f4717881c910c84c6458a28a0caab6217bba55
2021-03-02 13:30:27 +00:00
Semyon Proshev
4c3ba38f00 Tune untrusted interpreter warning (PY-41524)
GitOrigin-RevId: d8952d4cbc6658fa6ae4182d89b10dc856f3290a
2021-03-02 10:03:17 +00:00
andrey.matveev
c49b372edd PY-46056 Fix wrong same directory and library elements prioritization in completion
(cherry picked from commit 0189cf588066af3c0f133caa599d1f1bc50caec0)

IJ-MR-4895

GitOrigin-RevId: d8918a1530c612138c80850e41ad140d61300f4b
2021-02-26 11:11:16 +00:00
Semyon Proshev
5798ffd476 Ask for confirmation before configuring inner venv as a project interpreter (PY-41524)
GitOrigin-RevId: d87ccc1432821a34c7b46036e834c41d7ad02a87
2021-02-25 13:34:17 +00:00
andrey.matveev
01f2002956 PY-46054 Fix missing same directory completion variants
(cherry picked from commit fb17e9285a39846b93708fb33c9822bff0a8da35)

IJ-MR-4823

GitOrigin-RevId: 1e0b31e14ff2c1ee95358b7bf68576f413fed71c
2021-02-25 05:04:46 +00:00
Andrew Kozlov
c07e578e7d InstalledPackage refactoring: explicit nullability; PackageManagementService#getInstalledPackage variance added
GitOrigin-RevId: 1bfb0969da77bde8809855f9c80da3878e7569e5
2021-02-22 18:20:41 +00:00
Louis Vignier
70ea4436e7 IJ-CR-5763 [analysis-impl] Remove miglayout-swing dependency
- codeInspection.ui is moved to platform.lang
- PythonUiService has util functions for InspectionOptionsPanel
- js-analysis-impl has an added dependency on platform.lang

GitOrigin-RevId: ecd757277f9509b9d48507c0c39a109cb0f2ce4b
2021-02-19 16:53:02 +00:00
Mikhail Golubev
6f9013eb6b PY-47281 Exclude names from internal modules of libraries from auto-importing
Namely, names such as "numpy.random._examples.numba.extending.numbacall" or
"numpy.testing._private.noseclasses.NumpyDoctest" should no longer be suggested,
unless they are also exported in a public package higher in the hierarchy.

It doesn't not affect definitions from internal modules that belong to project
sources, these are still offered in the lookup.

GitOrigin-RevId: 2be393f30bd7d9905a31bdbe8db101807c136617
2021-02-19 16:19:51 +00:00
Mikhail Golubev
df979257a6 PY-47281 Re-use QualifiedNameBasedScope in PyQualifiedNameCompletionMatcher
GitOrigin-RevId: f8407f86e083bc36f1be80b6fa43348a350511f2
2021-02-19 16:19:49 +00:00
Vladimir Krivosheev
6338b863e4 do not use module level message bus
GitOrigin-RevId: e6b62994906b120b6c5ca394be39ad593d377f00
2021-02-18 18:49:48 +00:00
Semyon Proshev
0ddea3e80f Increase stub version after PyExportedModuleAttributeIndex introduction
GitOrigin-RevId: dec2daccf93d1b12ab3bf2196d700b7b1fd526a3
2021-02-17 16:45:40 +00:00
Lada Gagina
726f21a3ae PY-44026 Add a flag to PyModuleNameCompletionContributor for some tests to pass
GitOrigin-RevId: 104959faf4784de40500b694556b552fdbb69021
2021-02-17 15:56:37 +00:00
Lada Gagina
bf9af6108f PY-44026 Change conditions for applying PyModuleNameCompletionContributor
GitOrigin-RevId: 5618881fac2c7771da490e9fb8712eb5d44fba26
2021-02-17 15:56:37 +00:00
Lada Gagina
4acb02607a PY-44026 Use import priority when adding import
GitOrigin-RevId: 1e3a64b971a73283863e3aba1f8251d6673f62f9
2021-02-17 15:56:36 +00:00
Lada Gagina
290c8ea4ab PY-44026 Add completion with auto-import for common package aliases
GitOrigin-RevId: 11d6f0df866ba3ae35cfdb1aed231a3e357bb4e7
2021-02-17 15:56:35 +00:00
Mikhail Golubev
aa3041a69f PY-44026 Make PyQualifiedNameCompletionMatcher accept a qualifed name directly
GitOrigin-RevId: 3a3a6915b277e327ece11af25bbd10fb47804cf8
2021-02-17 15:56:32 +00:00
Mikhail Golubev
9ad52f13a4 PY-44026 Always match the first component of a qualified name in suggestions
For instance, "numpy.foo" should not match "pkg.test_numpy.foo".

GitOrigin-RevId: b3f3dfb17b0705eb3f93368eb281ba662ea92e3c
2021-02-17 15:56:31 +00:00
Mikhail Golubev
e40791ec88 PY-44026 Fix IOOBE in the GlobalSearchScope, causing repeated reindexing
GitOrigin-RevId: ed38aec8490d51982f8f326b21714c496a0ed576
2021-02-17 15:56:30 +00:00
Lada Gagina
6674b17b74 PY-44026 Introduce PyModuleNameCompletionContributor
GitOrigin-RevId: 8f18f0f03f1ddec5da7aa229b8671224f0d231e3
2021-02-17 15:56:30 +00:00
Lada Gagina
f90d33b90b PY-44026 Always add results via PyFile#iterateNames, add from index only if they haven't been recommended
GitOrigin-RevId: 1f5031160144c774db662dcdf20f549e8986ce63
2021-02-17 15:56:29 +00:00
Lada Gagina
0599c8bc14 PY-44026 Make PyUnresolvedModuleAttributeCompletionContributor work on unresolved references only
GitOrigin-RevId: d8ec30f8da3a269d7043abc3108878466fcbcc40
2021-02-17 15:56:28 +00:00
Lada Gagina
383dc15c13 PY-44026 Add completion for empty attribute prefix to PyUnresolvedModuleAttributeCompletionContributor
GitOrigin-RevId: 3354826398aa85adc54742155da90138cd9a2279
2021-02-17 15:56:27 +00:00
Mikhail Golubev
8e05b0d7b6 PY-44026 Speedup index lookup by considering only keys accessible from the project
PyExportedModuleAttributeIndex.traceKeyHashToVirtualFileMapping is a little
known API of StubIndexExtensions that allows to use IdFilters for extracting
only keys from virtual files that it permits. In this case, it means those
accessible from the current project.

GitOrigin-RevId: bd0e2b65ee0f9fc256e714053c332ce5a120d6d8
2021-02-17 15:56:25 +00:00
Mikhail Golubev
4a127af04d PY-44026 Added simple statistics about the usage of PyExportedModuleAttributeIndex
GitOrigin-RevId: ab38fd093d931b91f5869ee38a67ef74540afc78
2021-02-17 15:56:25 +00:00
Mikhail Golubev
e4565c3515 PY-44026 Try using the new index with another contributor for unresolved module attributes
It includes several impovements over the existing implementation:

* Full qualifier it considered instead of just its last component, e.g. "foo.bar"
for "foo.bar.Baz<caret>", not just "bar".
* These results are not suggested for references that are themselves qualifiers for
other attributes, e.g. in "foo.ba<caret>r.Baz()".
* Completion is automatically restarted as soon as attribute prefix appears, i.e.
as soon as any extra character is typed in "foo.<caret>".
* Completion uses an apropriate scope, excluding stdlib's tests
* New variants are added incrementally and respecting PCE, not in a batch, to improve
responsiveness

GitOrigin-RevId: d6a84bf3a2096e60fca87794da6ed5836c5b9244
2021-02-17 15:56:24 +00:00
Mikhail Golubev
e07b409cb8 PY-44026 Add a specialized index for fast qualified name lookup
The new stub-based index maps names of all "public" top-level definitions
to the corresponding PSI elements. Fully qualified names are matched by
both definition's short name and an already typed reference qualifier, i.e.
"foo.bar.MyClass" matches "foo.My" and "bar.My" but not "foo.bar". Qualified
names are initially restored directly from VFS without any normalization or
canonization to improve performance, but then properly canonized before
displaying them among completion suggestions.

GitOrigin-RevId: 768ef6d51e535e8102fca0693c7a51db400fc783
2021-02-17 15:56:22 +00:00
Lada Gagina
800b75adac PY-44026 Add initial PyUnresolvedModuleAttributeCompletionContributor implementation
GitOrigin-RevId: 2b6b3660bf3f372e86fb479637f76d324b713d0b
2021-02-17 15:56:22 +00:00
andrey.matveev
3322cedc0d PY-19917 Support type ignore comments
(cherry picked from commit 693b7f2bf037ac9fd464e330390c76ee5268c023)

IJ-MR-5695

GitOrigin-RevId: 354a4ba98e0ff01787ae0718c8643772b118fc9f
2021-02-15 16:45:22 +00:00
andrey.matveev
a350ff045f PY-46668 Impl multiple arguments completion contributor
(cherry picked from commit 42efe6a20f52cfb3bd827a2b68d1fb6cc3949626)

IJ-MR-5791

GitOrigin-RevId: e2a40572b0de4919a5049ff06e437b34d78c296c
2021-02-15 13:29:14 +00:00
Nikolay Chashnikov
ebda80c42c deprecation: add @ScheduledForRemoval annotation to deprecated elements (IDEA-259329)
GitOrigin-RevId: 8ab1f92485b718807bac77682b7038c42c65dba1
2021-02-12 16:33:25 +00:00
ruro
a251e6a423 PY-33060 custom wrapping modes for arguments
close #1490

GitOrigin-RevId: f882df71e9d221f5a1256e0675642ef9d8d963f1
2021-02-11 19:41:59 +00:00