Commit Graph

4353 Commits

Author SHA1 Message Date
Irina Fediaeva
058257cb23 PY-56609: Review remarks
Proper html table row tags

GitOrigin-RevId: 8413ddf84bc1d5d65080447e3f425923cca21c10
2023-01-23 13:39:15 +00:00
Irina Fediaeva
252e4c1684 PY-56609: Refactoring in quick documentation
Replace usages of appendRaw by append

GitOrigin-RevId: 3ee71857898c3303a5c2e96939ab1f9fb91670e0
2023-01-23 13:39:05 +00:00
Irina Fediaeva
c44fb89c28 PY-56609: Refactoring in quick documentation
Migrate to DocumentationMarkup elements

GitOrigin-RevId: ea4d71638b1dd3a160521e655fd2a1670ea27701
2023-01-23 13:39:02 +00:00
Irina Fediaeva
65ca3c266f PY-56609: Refactoring in quick documentation
Put back forgotten tests

GitOrigin-RevId: 06e000edb6b8327e95d066804d68ad959ba7ba0e
2023-01-23 13:38:58 +00:00
Irina Fediaeva
bd1c830040 PY-56609: Refactoring in quick documentation
Remove ChainIterable usages from quick documentation and replace with HtmlChunk/HtmlBuilder.
I18ize some fragments.

GitOrigin-RevId: c9b1197efcb17de92361426759a7840ee1be8e4b
2023-01-23 13:38:53 +00:00
Irina Fediaeva
a143468daa PY-56609: Refactoring in quick documentation
Migrating PyQuickDocTest.py to Python 3

GitOrigin-RevId: 2ad69939a695066d92f7c8c937828f8097110a62
2023-01-23 13:38:46 +00:00
lada.gagina
f3da5e58ae PY-58374 Fix dict keys completion when editing an existing key
GitOrigin-RevId: 41434300f6ea0f776a115a869fb9578a84015471
2023-01-17 19:01:56 +00:00
Olga.Lavrichenko
6df5bfd10d DS-1584 DS-2583 Reformat breaks IPython magic commands and shell commands
GitOrigin-RevId: 949528c951d6c9174b1bad21452a90fbdb07b418
2023-01-16 15:13:23 +00:00
lada.gagina
ef2f607f5f PY-42637 Fix quotes for TypedDict keys completion in dict literals
- when there are other keys present in the literal, use quotes from there
- when the literal is empty, use double quotes by default
- when there already are quotes, suggest just the key names

GitOrigin-RevId: 5f37cd25c0e47521e78a01ab84053571369b24a8
2023-01-10 17:39:26 +00:00
Mikhail Golubev
5e868d4eba PY-54336 In case of unresolved return type annotation assume that method returns Any
_T_co in itertools.product declaration in Typeshed used to be imported from
_typeshed/__init__.pyi stub and was not resolved as a name starting with
an underscore. Nonetheless, its method __next__ was still recognized as generic
because _T_co used in typing.Iterable.__next__ was used instead thanks to
PyAncestorsTypeProvider. In other words, we inferred a TypeVar as a return
type of a method of a non-generic class. It led to retaining this TypeVar as-is
(not replaced) after substitution and SOE further down the road.

Ideally, the same should be done for other places where type hints can be used,
e.g. if a local variable has an explicit annotation, even an unresolved one,
no other type sources should be examined. Unfortunately, it's not as
straightforward for variables and parameters since their annotations sometimes
don't contain a type, e.g. x: Literal = 5, or x: Final = 5. It means
that we need to distinguish somehow between the cases "incorrect annotation, use Any"
and "this annotation requires further inference for the assigned value", and
our API doesn't allow to express that at the moment.

GitOrigin-RevId: 1bba57bb38718bcab7778049a91d5cbffb5e87c2
2022-12-07 19:04:56 +00:00
Mikhail Golubev
9bb81ec3b0 PY-53047 Exclude known reST and Epydoc tags from Grazie grammar checks
Namely, ignore everything starting with a known tag and until the closing
colon. It should match constructs like ":return:", as well as
":param list[int] x:". Excluding just the tags is not enough,
as the following identifier and colon are still recognized as part of
a grammatically-incorrect sentence.

In other languages, where markup elements in documentation comments have
their own PSI elements, this exclusion is easier. Maybe we should do the
same for reStructuredText directives at some point.

GitOrigin-RevId: 9c50148097d3e27fe79cdc0a9aa90a7946b215ca
2022-11-18 20:00:14 +00:00
andrey.matveev
12283c685e PY-4418 Use property instead of method call
GitOrigin-RevId: f0432a1b1ff44a7c93d8e331a4e8921ecf7d7d1f
2022-11-17 18:09:13 +00:00
andrey.matveev
531c8dbdef PY-36158 Add all star import sources if imported element qname not locally resolved
GitOrigin-RevId: 0f65429042ebde43cbf04ec66abf6f392e71ae67
2022-11-17 16:56:01 +00:00
Irina.Fediaeva
22327f9518 PY-46164: Rename PSI bundle for a link to copied documentation
GitOrigin-RevId: e209e34c875fcf9603c0e967b3429ed41e792770
2022-11-15 21:16:01 +00:00
Irina.Fediaeva
9754124962 PY-34667: Markup support in documentation sections
GitOrigin-RevId: 4dadd51fcbb89111e7df27e7babd158c6f64da75
2022-11-15 16:38:32 +00:00
Daniil Kalinin
290595da24 PY-24540 Fix extra space mistakenly added by Fill paragraph action
Fix tests according to the changes

Merge-request: IJ-MR-98042
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: fb28eb2b435eb71430beaa4c243644daf04e37a6
2022-11-15 10:20:25 +00:00
Egor Eliseev
66297780d3 PY-56120 Add tests
GitOrigin-RevId: 12b363fa88b6722f6056cb82f7f8a91cacd3336a
2022-11-14 06:32:11 +00:00
KotlinIsland
45dd0bf0e8 Add language level for Python 3.12
GitOrigin-RevId: 10d24da89149754de63c87ec9edc0a1b7f131f17
2022-11-13 01:47:35 +00:00
andrey.matveev
d0e0488fe6 PY-40797 Fix problem with inline string to f-string
GitOrigin-RevId: dbc2206fa2338e2b6a2552a0ca76cb4064425505
2022-11-03 17:30:23 +00:00
Daniil Kalinin
c245993809 PY-7758, PY-23859 improvements in Control Flow analysis
Control flow now abrupts on `exit()` and `pytest.fail()` calls

Control flow now abrupts only if class which contains `self.fail()` call contains case-insensitive "test" word in the name 

Merge-request: IJ-MR-96165
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: ea173fdb72a10a373cd95f266ea7589e36545f30
2022-11-01 09:54:20 +00:00
andrey.matveev
cad1138e59 PY-53104 Support PEP 673 typing.Self type
GitOrigin-RevId: 8efc65725580510dc3e9a93e1242e1a69032c8f1
2022-10-19 09:45:15 +00:00
Elizaveta Shashkova
a3af1d900c PY-46053 Huge Parameter Info popup
GitOrigin-RevId: 039b51b225ec6eb20b77305b47cc71d180398c79
2022-10-15 00:15:54 +00:00
Daniil Kalinin
93e169eea2 PY-26060 New version-dependent super method signature macro
Tests for PY-26060

Merge-request: IJ-MR-95531
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: 134f45d43aefc3cf7a3f806e0ea1ea6f768528f4
2022-10-14 14:02:44 +00:00
Daniil Kalinin
3d3da180b8 PY-24792 Fix for incorrect formatting of a multiline return statements
Fix pycodestyle-violating alignment in multiline binary statements in return and yield expressions
Fix pycodestyle-violating alignment in multiline tuple expressions in return, yield and assignment expressions
Tests for it
Merge-request: IJ-MR-35686
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: 989b4f4aeb61b43d3215a0ad74f7a9d9685464b8
2022-10-13 09:44:57 +00:00
Peter Gromov
2e765a10c3 [grazie] ignore more LT's unpaired quote warnings (IDEA-302989, IDEA-303541)
GitOrigin-RevId: 6eb81e2aabd1c8ca74c5083856f94a2344fd0979
2022-10-11 13:11:29 +00:00
Irina.Fediaeva
cb8edc622b PY-33341, PY-56416, PY-28900: Render attributes and init params description in the class documentation
PY-33341: Now we render the “Attributes” section in the class documentation, it also allows to describe inherited attributes. (Previously we didn’t render it at all)
PY-56416: In the attribute documentation popup we are able to render attribute description from class docstring. (Previously we took documentation only explicitly from attribute one-line docstring)
PY-33341: We render the “Parameters” section in the class documentation for init parameters, described in the class docstring. (Previously user couldn't use class docstring to describe init parameters)
PY-28900: For the init parameter documentation we take the description from the class docstring if init doesn't have its own docstring. (Previously we took parameter description only from init docstring)

GitOrigin-RevId: d67bf49c72cf7a3634805a6e310c943f1ea848d1
2022-10-07 14:42:01 +00:00
Irina.Fediaeva
6155f366c3 PY-55521: Show documentation for targets inside type declaration statement
GitOrigin-RevId: 3f3f2a440b4226f5af8848e75fdbc841b8a7d505
2022-10-04 14:47:05 +00:00
Irina.Fediaeva
181edc5caa PY-50788: Correct resolve for inherited docstring attribute names
Now during resolve if there is no class/instance attribute with appropriate name explicitly in the class, we will try to find it in the parent classes and resolve there.

GitOrigin-RevId: 52ab5f0ad63cba187457ba3db6107997ede33dee
2022-10-03 13:21:34 +00:00
Irina.Fediaeva
4b1eca9771 PY-43035: Fix multiline sections in section-based docstrings
Now when parse docstring we take into account the block type. For OPTIONAL_TYPE sections such as Returns and Yields we don't require additional indent for lines following the summary.

GitOrigin-RevId: 5dd7adf5f9042204a29b731a3a7379cc3c743af9
2022-09-19 22:02:59 +00:00
Egor Eliseev
7ec061b418 PY-37311 Patch interpreter command for Python 2
IJ-CR-26283

GitOrigin-RevId: 24575b5177831685d56f66c5546800c66553bd19
2022-09-07 12:39:17 +00:00
Mikhail Golubev
49f40ec3a8 PY-54503 Provide Any as the result type for Enum.value when we cannot access AST
GitOrigin-RevId: 307b05d8b9910bd37b85898fa82086b10c14a7cb
2022-09-02 20:51:05 +00:00
Egor Eliseev
6260c013df PY-28396 Sci Data doesn't show complex numbers
Change `PY_COMPLEX_NUMBER` regexp.
Add quoting for structs fields.
Add check for empty ArrayTable values.
Add test.

GitOrigin-RevId: 80b23a20c7558a1885968d5a61e3dc72cfd9643a
2022-08-31 06:02:57 +00:00
Irina.Fediaeva
cce0ef17d5 PY-16760, PY-28549, PY-35743, PY-55609, PY-46654: Correct resolve of class attributes in docstrings
Previously in docstrings we incorrectly recognized references in 'Attributes' section only as instance attribute references. It led to false positive 'Unresolved reference' on class attributes references in docstrings and wrong resolve when using class and instance attributes with the same names. Now we use ReferenceType.VARIABLE to identify both class and instance attribute references in 'Attributes' section and then resolve them with priority of instance attributes. Also fixed wrong resolve of attributes references to constructor parameters.

GitOrigin-RevId: ea10bfb092472c0ab14b77f06efd93093cfcd684
2022-08-25 21:11:57 +00:00
Irina.Fediaeva
2c35b284f9 PY-21883: PR remarks. Show elements from 'Other Parameters' inside 'Parameters' section in Numpy docstrings
Removed redundant keyword arguments in parameters section, cosmetics.

GitOrigin-RevId: 213132671cc844eb31a168c4e8a17af169d1aac2
2022-08-24 15:20:53 +00:00
davfsa
680913f146 PY-21883: PR. Show elements from 'Other Parameters' inside 'Parameters' section in Numpy docstrings
closes https://github.com/JetBrains/intellij-community/pull/2051

GitOrigin-RevId: 2438d1c9fdf8d90fd2c046c8a9a55c07f6683778
2022-08-24 15:20:52 +00:00
Mikhail Golubev
84c48c48a9 PY-47532 Support new API and namespace of "attrs" package
GitOrigin-RevId: a8a0f909b21cc9f3b95a7b823452599374a943a9
2022-08-18 16:13:12 +00:00
Daniil Kalinin
ac21144456 PY-21354 Call Hierarchy - go to line where function is /used/ (not defined)
`Jump to source` or double-click action now moves cursor to the first usage of the selected function inside other function, not to the definition
If there is more than one usage of the function A inside function B, it is now shown with an additional label like `(3 usages)`

PY-55537 Call Hierarchy: don't show last node as expandable
Last node no longer shown as expandable if it has no children

Merge-request: IJ-MR-25288
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: ea290dc20f03207a8197e7e2ec2d5d17232c3d72
2022-08-11 12:47:35 +00:00
Irina.Fediaeva
1e7d7b339d PY-52281: Fix doc for in, as, from, else keywords when they are inside some statement.
IJ-CR-26384

GitOrigin-RevId: 07f7f8c4ce17c4906e9346715f92a9489d1f6c74
2022-08-08 20:23:28 +00:00
andrey.matveev
04f5b85d4a PY-29898 Impl resolve keyword argument to dataclass attribute
Also fix PY-55231
Add declarationElement field to callable parameter to resolve parameters to class fields in dataclasses

GitOrigin-RevId: ae2703b958061df6f2d74b19920a6e3be2a084f6
2022-08-05 11:19:33 +00:00
andrey.matveev
b7398bb63d PY-10719 Fix add import above import with noinspection comment
GitOrigin-RevId: 6dd79b10e56b9e9e2eee76c83d5974dee43446a1
2022-07-26 13:17:54 +00:00
Mikhail Golubev
bb7e382697 PY-52648 PY-52656 Revert problematic Typeshed changes and add regression tests
This is a workaround until PY-53896 is implemented.

It effectively brings the stubs for builtins in Typeshed to their state at
37ee52ec2d883d8bbf244e4d1a871cde7f678d17, with the exception that I kept new
definitions for __build_class__ and ExceptionGroup (for 3.11).

GitOrigin-RevId: 92fdf169d228c52bcefa7edc3f185cb931ff4d79
2022-07-20 17:19:46 +00:00
Mikhail Golubev
63461fb262 PY-53671 Don't treat methods qualified with a module as unbound
While resolving an aliased method exported from a module, we might lose
the context that it was referenced via instance and hence its first "self"
parameter is already bound and doesn't need to be passed explicitly.
The reason is PyResolveUtil#doResolveQualifiedNameInScope (called in
PyTargetExpressionImpl.multiResolveAssignedValue) performs resolve
over qualified names saved in PSI stubs and returns plain PsiElements
(end results) that don't retain such information about their qualifiers.
QualifiedResolveResult can't be used there either because we don't keep
PyExpressions in PSI stubs. What's more, when later such function is referenced
via some module we consider it definitely unbound, even though a module cannot
possibly have a method as its immediate attribute. I changed the logic so that
we no longer consider referencing a method through a module as somehow affecting
its bound/unbound state.

GitOrigin-RevId: 17a6c3e5d43c088d0663ba54651004c8370d5eca
2022-07-19 15:06:06 +00:00
Egor Eliseev
6d6205dfb0 PY-49991 Load elements for groups on demand
Load Special Variables and Return Values groups only on demand

IJ-CR-20988

GitOrigin-RevId: 7c4fef6c7f3a77e01b8e3f31782440265a08823b
2022-06-28 13:51:06 +00:00
Egor Eliseev
eb833f7e5c PY-31680 Debugger Console throws error if dict contains unicode fields
Add correct handling of call 'quote' function for Python 2 and 3.

GitOrigin-RevId: e5c0840e4f5c1ff7b81ddfc0fcfba73953e8d004
2022-06-22 11:05:30 +00:00
lada.gagina
6bdc3d4237 PY-53611 Add support of Required and NotRequired TypedDict type specifications (PEP-655)
Makes it possible to mark individual TypedDict keys as required or not required, covered in [PEP-655](https://peps.python.org/pep-0655/)

GitOrigin-RevId: 6567fd1009430e37f32924eb29ab8b4a1a17f315
2022-06-21 20:29:34 +00:00
Egor Eliseev
1f3642a700 PY-43591 Debugger stops twice on breakpoint if exception was raised
Add checking: if exception and breakpoint -> don't stop.
Generate binaries.

GitOrigin-RevId: 00205f00752b6ce04e6fa23129eeb2d4f3666a1e
2022-05-30 15:14:33 +00:00
Elizaveta Shashkova
6e383650ca PY-53776 Support the syntax changes of PEP 646 Variadic Generics
GitOrigin-RevId: 6ee5939eff1c0503132b013c6469de00b50b2d86
2022-05-30 09:40:36 +00:00
Daniil Kalinin
44d07d2450 PY-20811 Support for typing.ClassVar type annotations (PEP 526)
* Dedicated inspections for `ClassVar` variables in variable declarations, variable reassignments, function parameters, local and return variables
* Types of `ClassVar` variables now resolves correctly
* Tests for `ClassVar` inspections

GitOrigin-RevId: 0fd0ef0126ba2c2801ef82bcbeca4ea9b0c48c73
2022-05-24 20:12:55 +00:00
Ilya.Kazakevich
2e811b78e9 PY-36334: Support `indirect` argument for pytest.
See ``indirect`` docs for pytest: instead of direct argument it uses fixture, so we must provide fixture return type

GitOrigin-RevId: c144a0e891f61e15f71c9c012fb99a4dd024e76f
2022-05-24 02:00:13 +00:00
Daniil Kalinin
fa259d0727 PY-52162 deprecated implementation of PythonTemplateContextType#isInContext changed to accept TemplateActionContext
Tests for PY-52162

Merge-request: IJ-MR-24510
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: 8cb7674b3840424015eeb06981ec16734fe26af2
2022-05-20 08:37:03 +00:00