Commit Graph
2341 Commits
Author SHA1 Message Date
Mikhail Golubev 7d4bd2b487 PY-15197 Completion for keyword argument has spaces around '=' if required by code style settings 2015-07-31 17:50:04 +03:00
Mikhail Golubev b78e0ab785 Include "completion" directory in testDataPath of various Python completion tests
Also moved test data for PythonCompletionTest#testPy255 in its own directory
because previously it had awkwardly used whole "completion" directory as a
package.
2015-07-31 17:50:03 +03:00
Mikhail Golubev ddc77ab24c PY-15119 Completion in relative imports ignores whitespaces between dots 2015-07-31 17:50:03 +03:00
Mikhail Golubev de17f7e428 PY-16420 Quick fix "Add super class call" passes some of optional parameters in generated constructor call
Previously all optional parameters of super class constructor was
ignored in generated constructor call, but from now on we pass them
there if they exist in constructors of both superclass and subclass.
2015-07-17 20:27:14 +03:00
Mikhail Golubev 26ee55a525 PY-16421 Quick fix "Add super class call" preserves single star param of original constructor 2015-07-17 20:27:13 +03:00
Mikhail Golubev 5c4b6ceaa4 PY-15791 Force spaces around "=" sign preceding default value of annotated parameter 2015-07-16 19:15:11 +03:00
Mikhail Golubev 12bc49690d PY-16428 Don't suggest creating new parameter for unresolved reference inside annotation
* Slightly cleaned up in related classes
* PyQuickFixTest#doInspectionTest and Py3QuickFixTest#doInspectionTest
correctly handle argument available=false.
2015-07-16 15:48:28 +03:00
Mikhail Golubev fdb8d23960 Proper offsets for type placeholders inside generated docstrings even if additional indentation was added
Formatter can insert additional indentation inside multiline string
literal to align it with surrounding statement list. It happens before
live template to edit type annotations is inserted in document, thus
offsets saved previously in PyDoctstringGenerator become invalid. From
now on PyDocstringGenerator stores line and column after first
non-whitespace character for these annotations instead and converts them
to normal offsets considering any additional indentation inserted.
2015-07-15 19:28:25 +03:00
Mikhail Golubev 150a577535 Fix test data and code style settings in tests after recent changes in formatter core 2015-07-15 19:28:25 +03:00
Mikhail Golubev 9980146d79 PY-16373 Return accidentally removed "locally" suffix from the name of local auto import quickfix 2015-07-13 22:00:21 +03:00
Mikhail Golubev b633713288 PY-16393 Ignore intermediate comments while searching for line feed to recognize hanging indent 2015-07-07 12:40:39 +03:00
Mikhail Golubev 5fee1b116b PY-16335 Preserve formatting of converted collection literals 2015-07-07 12:40:38 +03:00
Andrey Vlasovskikh f9d156ca8a Resolve only explicitly imported submodules of imported packages (follow-up for PY-14454)
Now we try to filter resolve results for members of an imported module
by only explicitly imported results as we used to do for directories
only. The difference is we do it now for both directories and
__init__.py files and only if we're resolving a member in the same file
where the import for the module is located.
2015-07-06 19:48:57 +03:00
Mikhail Golubev aed3a6e47d PY-16351 Ignore not inline comments to detect proper spacing between declarations 2015-07-06 12:48:24 +03:00
Andrey Vlasovskikh ac05b12d26 Resolve members of all imported modules in both __init__.py and submodules (PY-14454, PY-14615)
We used to resolve members __init__.py of imported packages using only
the __init__.py itself, i.e. without considering their submodules. Now
we do that and we also don't filter unimported submodules because we
cannot detect them reliably. They might be imported in other modules
via some import chain.
2015-07-02 17:38:25 +03:00
Andrey Vlasovskikh fcaa6200fa Merge branch 'vlan/python-fixes' 2015-07-01 20:57:19 +03:00
Mikhail Golubev 8c7189be4d PY-16289, PY-16348 Instead of generating whole constructor anew, replace parameter list and insert super call
It also preserves original indentation of updated constructor and
handles comments at the end of the function body better.
2015-07-01 14:31:30 +03:00
Mikhail Golubev 7c0bf23f2d PY-16348 Preserve line comments inside the body of updated constructor 2015-07-01 14:31:30 +03:00
Mikhail Golubev a6a63cd53c PY-16258 Preserve line comment after colon in updated constructor 2015-07-01 14:31:30 +03:00
Mikhail Golubev 8c2d7c1190 PY-15867 Omit single star parameter in updated constructor signature if it's not followed by keyword-only parameters 2015-07-01 14:31:29 +03:00
Andrey Vlasovskikh c80b8263c7 Added a test for PY-14454 2015-07-01 13:10:43 +03:00
Mikhail Golubev c90c97420e PY-10553 Remove accidental headers from test data files 2015-06-29 21:16:40 +03:00
Andrey Vlasovskikh 210c8c8fd5 Revert "PY-16078 Fix test data for PyConvertFormatOperatorToMethodIntentionTest"
This reverts commit 27a1f4c18a.
2015-06-29 20:04:07 +03:00
Andrey Vlasovskikh a1476e9c85 Revert "PY-16078 Default right margin is 99 characters according to updated PEP-8"
This reverts commit 2175deac00.
2015-06-29 20:00:33 +03:00
Ilya.Kazakevich 718793cec9 "testFinished" added after "testError" and "testIngore" to fix PY-16314 and PY-16313 2015-06-26 21:14:28 +03:00
Mikhail Golubev 7e94358f1d Various class refactorings merge several "from imports" from abc module together 2015-06-22 17:33:57 +03:00
Mikhail Golubev 4237819376 PY-14765 Two "from imports" with the same source module are ordered by the first imported name
Additionally star imports always come first
2015-06-22 17:33:57 +03:00
Mikhail Golubev 4b6a497aec PY-14765 Move stubs for "abc" to mock SDK, so its symbols were resolved as built-ins when imports are inserted 2015-06-22 17:33:56 +03:00
Mikhail Golubev 99cb935d2c PY-14765 Quickfix "Add import" handles import groups on its own without PyImportOptimizer 2015-06-22 17:33:56 +03:00
Mikhail Golubev 3f332ff775 PY-12018 First attempt to sort imports alphabetically in ImportOptimizer 2015-06-22 17:33:56 +03:00
Mikhail Golubev f71d87d428 PY-15701 Allow to specify minimum number of blank lines after local imports
Add new option "After local imports" on "Blank lines" tab of Python
code style settings.
2015-06-17 21:00:44 +03:00
Mikhail Golubev 1a35c61156 PY-9923 Add two blank lines between top-level declarations and surrounding statements 2015-06-17 21:00:43 +03:00
Mikhail Golubev 566faf4602 PY-14617 Update references to modules imported via relative imports inside the moved module
Current solution is very crude, because we can't use standard IDE
facilities to find usages of the import element in the a file, once
that file was moved. And exactly that API MoveFileHandler offers to us.
2015-06-17 13:56:48 +03:00
Mikhail Golubev 8166fab58b PY-14617 Ignore relative imports in modules moved together with files these imports refer to 2015-06-17 13:56:48 +03:00
Mikhail Golubev 3849c71663 PY-14617 Update old-style relative imports in moved modules 2015-06-17 13:56:47 +03:00
Mikhail Golubev c628ec5221 PY-10553 Correctly update "from imports" if moved module and imported symbol share name
Check that reference to moved module is contained in PyImportElement
part of a "from import" statement before calling
PyClassRefactoringUtil#updateImportOfElement. Because this method
relies solely on name equality, it can accidentally replace "from
import" of particular symbol from module with the "from import" of that
module itself.
2015-06-17 13:56:47 +03:00
Mikhail Golubev 27a1f4c18a PY-16078 Fix test data for PyConvertFormatOperatorToMethodIntentionTest 2015-06-05 15:42:34 +03:00
Mikhail Golubev 2175deac00 PY-16078 Default right margin is 99 characters according to updated PEP-8 2015-06-03 13:48:22 +03:00
Mikhail Golubev 412c9ff86c PY-16035 Warning about not implemented abstract methods is hidden for abstract subclasses 2015-06-01 15:46:22 +03:00
Mikhail Golubev 6b5ea8f750 PY-16050 Formatter inserts exactly one space after ":" and "->" in annotations 2015-05-27 22:45:01 +03:00
Mikhail Golubev df512e8b7d PY-14962 Allow to enforce braces position for dict literals like it's done e.g. for JavaScript 2015-05-27 22:45:00 +03:00
Mikhail Golubev 6b654df67e PY-16036, PY-11561 Preserve name and annotation of "self" parameter in modified constructor 2015-05-27 17:27:01 +03:00
Ilya.Kazakevich 1111ff39b3 Merge remote-tracking branch 'origin/master' 2015-05-27 00:16:42 +03:00
Ilya.Kazakevich 9aa5b6e84a Relative path supported for PY-16031 2015-05-27 00:15:40 +03:00
Mikhail Golubev e0bb7c5a6d PY-14962 Allow to specify wrapping for key-value pairs of dict literals 2015-05-25 21:37:48 +03:00
Mikhail Golubev f7078d5a88 Cleanup in PyDemorganLawIntention and its tests
* Added missing final modifiers
* Reformat file
* Element generator is aware of language level
* Moved intention name to the bundle and properly capitalized it
* PythonDemorganLawIntentionTest extends convenient PyIntentionTestCase
and follows its conventions for test data location and naming
2015-05-25 21:37:48 +03:00
Mikhail Golubev e187993faa PY-9419 Add new intention action to convert between tuple, list and set literals 2015-05-25 21:37:47 +03:00
Andrey Vlasovskikh 8bddf10ea7 Merge branch 'python-fixes' 2015-05-22 13:24:04 +02:00
Andrey Vlasovskikh f73ae3f9bf Fixed unresolved reference for parameters which methods are invoked inside the function body (PY-11541)
We may get stuck in a recursive resolve loop (that results in unresolved
references) if we match arguments to parameters for a call where the
callee is a reference to the named parameter itself.

The loop used to go like this:

1. Get the type of 'foo.bar' in 'foo.bar(foo)'
2. Get the type of 'foo' in 'def f(foo)'
3. Find the structural type for 'foo'
4. Ask nested calls where 'foo' is a parameter
5. Try to match args to params in 'foo.bar(foo)'
6. Resolve 'foo.bar'
7. Get the type of 'foo.bar' in 'foo.bar(foo')
8. Since the 'foo.bar' is evaluating, it's 'null' for preventing
   recursion
9. So 'foo.bar' resolves to 'null' which is false
2015-05-22 13:07:48 +02:00
Ilya.Kazakevich cb1aa45d9e Real tests added for PY-14560 2015-05-21 22:26:41 +03:00