Commit Graph

42 Commits

Author SHA1 Message Date
Ilia Zakoulov
ca456d79c2 PY-77360: Create module-level docstring if it is not there
GitOrigin-RevId: 2c7b4acb089ebb6534718fda7b45df60434d2887
2025-05-26 18:01:26 +00:00
Daniil Kalinin
97ba49d547 PY-26877 Support adding trailing commas to multiline collections, argument and parameter lists
Merge-request: IJ-MR-153633
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>

GitOrigin-RevId: b304977e30eb4b378d858fcc5300846dc5965445
2025-02-14 08:46:05 +00:00
Daniil Kalinin
89c82d66c2 PY-31689 Correctly insert space after comma and collection closing brackets
GitOrigin-RevId: ac972f3028f840b6bb073f28521031df5d5a8635
2025-02-13 10:45:38 +00:00
Daniil Kalinin
fddb487bf8 PY-31689 Do not wrap tuples and list literals inside subscription expressions
GitOrigin-RevId: 9878660c10bab6bda36aa5f2bcd4c96f416dddb8
2025-02-13 10:45:38 +00:00
Daniil Kalinin
5b0b94a8dd [python] Formatter: Make sure that comments in collections are not placed on the new line on wrap
* Extract getting wrapping for collections and arg/param lists into a separate method
* Add a test

GitOrigin-RevId: 7ac252e5ab414329951adc61ea0dd29beeb27c04
2025-02-13 10:45:38 +00:00
Daniil Kalinin
2d7ad0e1fb PY-31689 Support wrapping options for parenthesized tuples
GitOrigin-RevId: 2b14686ea8c691627c9a8155f75a7c6727a48bf3
2025-02-13 10:45:38 +00:00
Daniil Kalinin
b1b0a08fbc PY-31689 Support wrapping options for set literals
GitOrigin-RevId: 6f76a929da4bde150339ab924f4e84f91d70d8a3
2025-02-13 10:45:38 +00:00
Daniil Kalinin
f8a57f7367 [Python] Refactor the old DictAlignment enum which prevented dynamic syntax bundle loading
Unfortunately, we need to keep the old int values logic to preserve compatibility with old user settings

GitOrigin-RevId: 59fba8bd53e3d89d31897ed675b54827bbf9b15f
2025-02-13 10:45:38 +00:00
Daniil Kalinin
a4f9be714a PY-31689 replace deprecated wrap options declarations with new ones
GitOrigin-RevId: ab9881ef097c6aac6220ae401ee1fa0d9620446f
2025-02-13 10:45:38 +00:00
Daniil Kalinin
f9a1e44638 PY-31689 Support wrapping options for list literals
GitOrigin-RevId: be976ddc224983174f5566e53985e29fd49051f4
2025-02-13 10:45:38 +00:00
Leonid Shalupov
5db4998301 housekeeping: remove unused imports
GitOrigin-RevId: be93bd341860bfc077fdbff5ce2ae91eebada31e
2025-02-11 23:18:34 +00:00
Vladimir Krivosheev
c3c21baac5 update bazel files
GitOrigin-RevId: 1a10e8174a47f688a95a93af0540f722462acd97
2025-02-03 11:42:18 +00:00
Daniil Ovchinnikov
dea8eddb0c rename intellij.platform.editor -> intellij.platform.editor.ui
GitOrigin-RevId: f4aa008b77368945ce9651fdc47f9463e3445347
2025-02-02 16:22:43 +00:00
Daniil Kalinin
31d7aa1a6c PY-32711 Reformat simple injected code fragments with the corresponding language formatter
* Add `PyFormattableInjectedBlock` entity which allows passing the code inside the injection to the formatter of the injection language (e.g., SQL)
* Add code style options to enable and disable this behavior
* Add tests

GitOrigin-RevId: b63ff37d8aab3e37d101be3d0cc9e7ff0897b5a1
2025-01-21 15:47:46 +00:00
Vladimir Krivosheev
0bc1cf1557 update bazel files
GitOrigin-RevId: 7320d3eff3aba093692ce66839c720ece6d7c4db
2024-12-30 11:28:24 +00:00
Vladimir Krivosheev
7b9ec58009 do not export intellij.database.connectivity.tests
GitOrigin-RevId: a1ef44dfa34cde110c9e6cad19d11b5e3019ab72
2024-12-28 21:45:55 +00:00
Vladimir Krivosheev
25233df1b1 cleanup - isEmpty
GitOrigin-RevId: 100d69abb6a423556574a72e82508fdb8f5d7fa3
2024-12-27 14:41:14 +00:00
Vladimir Krivosheev
68d99c6550 cleanup
GitOrigin-RevId: 9cb238c220249088bfc75a448eb310b93c7fc45c
2024-12-26 14:56:01 +00:00
Vladimir Krivosheev
98799639aa do not use _test as lib - test targets do not support this
GitOrigin-RevId: f2f49db4294b6a64040dbbd5f1d95e972cbd70a3
2024-12-15 18:32:30 +00:00
Tagir Valeev
5dca817b05 Add missing @Override annotations
GitOrigin-RevId: 56b084f82d4f4ec5153645b4d745bc881b803a26
2024-11-29 12:51:16 +00:00
Vladimir Krivosheev
17916c90f8 libraries -> lib, resources, opt-in, test deps
GitOrigin-RevId: db66ee95dcb0f0553b40c9cc56cd6afed8634cdd
2024-11-27 13:53:42 +00:00
Tagir Valeev
1a4a0b51b3 Warnings fixed (mostly redundant assignment)
GitOrigin-RevId: 79b9c2ae99e8afc7b1f49e8cea2b31745458404d
2024-11-26 10:10:48 +00:00
Alexander Kuklev
b076ea2794 [PY-33917] Now '__init_subclass__' is treated as and constructor-like method in appropriate cases
GitOrigin-RevId: c2ac58960f641868006141ae3001c932c6a8eaaf
2024-11-22 20:44:45 +00:00
Irina Fediaeva
3641c5fbef PY-52574: Remove Epytext docstring format & Py2 docstring rendering
Docstring rendering is no longer supported for Python 2, which became obsolete after reaching its end of life in 2020. Without updates or security patches, most tools, including documentation generators like Epydoc, have shifted focus exclusively to Python 3.

GitOrigin-RevId: ace78ac9ad943278449d5b20bb92db9f7571b5b5
2024-10-29 21:03:06 +00:00
Mikhail Golubev
58d00407db PY-77060 Remove spaces after * and ** in new-style PEP 695 type parameters
GitOrigin-RevId: cd38f49d0f28894e4f33dbd2fa331eaf895fd70d
2024-10-29 13:37:39 +00:00
Petr
93b9066edf PY-34617 Support version check
GitOrigin-RevId: 3318ff79cdcc5ba0ce5e4feb65abad5ad0f4acfa
2024-07-28 00:24:15 +00:00
Petr
16a7fb4b3e PY-34617 Move getTopLevelAttributes(), findTopLevelAttribute() from PyAstFile
GitOrigin-RevId: 226a7e968851ab0c8730bb79ca90d0ed5dcec364
2024-07-28 00:24:15 +00:00
Vladimir Koshelev
ec8c3a8aa3 [pycharm] remdev: migrate PyCharm Frontend launcher to v2 modules
GitOrigin-RevId: e2c62c23bd0a22c742a46177c1a1ad4c4b5b95d0
2024-07-24 13:13:53 +00:00
Mikhail Golubev
52850e21d8 PY-62208 Include importable names in basic completion results
Previously, such names were visible only on so-called "extended" completion,
activated when the hotkey for the basic completion was hit twice. The main reason
was that collecting such variants from indexes was a slow process, and we
didn't want to harm the responsiveness of completion for basic names.
Now it becomes possible thanks to a number of performance optimizations:

* Instead of using three separate indexes for classes, functions and variables,
we use one -- PyExportedModuleAttributeIndex. By definition, it includes only top-level
"importable" names, so we additionally save time by not filtering out irrelevant
entries. Also, it doesn't contain private definitions starting with an underscore.
It might bother some users, but given that the previous completion was used
extremely rarely, and the new one is going to be visible everywhere, it seems
that pruning unlikely entries as much as possible is a fare tradeoff. In the future,
we might enable them back on the "extended" completion if there is a demand.
Also, this index binds its keys to the project (`traceKeyHashToVirtualFileMapping`),
further eliminating useless index lookups.

* Thanks to the recent fixes in the platform (IJPL-265), it's now possible to
simultaneously iterate over all keys in an index and request values for a given key
without deadlocks, which is much faster than eagerly fetching all keys first.

* While scanning through all matching entries from indexes, we terminate
the lookup if the number of items exceeds the size of the lookup list.
We can further reduce this number by adjusting the "ide.completion.variant.limit"
registry value.

* Calculating expensive "canonical" import paths (e.g. "pkg.private.Name" is importable as
"pkg.Name") is offloaded to a background thread thanks to the `withExpensiveRenderer` API.
We still calculate these paths synchronously, though, for names whose raw qualified names
contain components starting with an underscore to decide whether these private names are
publicly re-exported and, hence, should be displayed.

The rest of the work has been put into reducing the number of entries on the list, e.g.

* The prefix under caret is now matched from the beginning of a name, e.g. `Bar<caret>`
matches `BarBaz`, but not `FooBar`.
* We don't suggest imported names clashing with those already available in scope.
* Some kinds of definitions are not suggested in specific contexts, e.g.
functions and variables are not suggested inside patterns and type hints.
* Nothing is suggested at the top-level of a class body, where dangling
reference expressions or calls are not normally expected.

Additionally, we don't suggest names from .pyi stubs at the moment, because
it pollutes the suggestion list with entries coming from the stubs for
third-party packages in Typeshed. We should probably enable them back once
we are able to properly disable Typeshed entries for not installed packages.

Some legacy forms of completion are left in the extended mode. In particular,
qualified names of classes are offered inside string literals only in this mode.
Also, module and package names are suggested only in the extended mode, because
top-level packages and modules are already suggested for the basic completion
by PyModuleNameCompletionContributor.

A few tests in PyClassNameCompletionTest were updated or removed entirely because
* we no longer suggest private names
* we no longer suggest names from private modules not re-exported in a public module
* we no longer suggest names clashing with those already available in scope
* prefix matching policy was changed to start at the beginning of an identifier

The whole feature can be disabled with the option "Suggest importable classes,
functions and variables in basic completion" in settings.

GitOrigin-RevId: 0787d42ce337b73b01a60f0bb7aa434fee43e659
2024-07-02 14:08:48 +00:00
Daniil Ovchinnikov
07f7cdaf55 IJPL-1044 wrap clinit instance requests in non-cancellable section
GitOrigin-RevId: f63849ca504a01dbae51faac27f29e69f43bff86
2024-06-25 20:12:17 +00:00
Vladimir Koshelev
1483eeb02a [python] move backspaceModeOverride to PythonSyntax.xml
GitOrigin-RevId: a092d5cc86a59c7a7d3f121b43c29971460ae12c
2024-06-25 16:47:25 +00:00
Vladimir Koshelev
2c8d9f7ca1 [python] fix jumps on backspace when lines start with a lot of indents
GitOrigin-RevId: 3ee4005dc0b85f007d4b895367af7efcdf5fbaab
2024-06-25 12:24:22 +00:00
Andrey Vokin
2db8b72fcb PY-71757 Semantic highlighting broken in 2024.1
Use severity SYMBOL_TYPE_SEVERITY by default for Python annotations, so that Python rainbow highlighting is preferred.

GitOrigin-RevId: cdfea51b4e891d952ce763a6e58b5e95a0c2125e
2024-05-13 15:27:32 +00:00
Nikolay Chashnikov
42b2cd3e14 mark members used from other modules as public and add @ApiStatus.Internal annotation to them instead (IJPL-149126)
This is needed to avoid 'IllegalAccessError' if different modules are loaded by different classloaders.

GitOrigin-RevId: 99113e2a8bee471332174bd2710eccf9b47ebb67
2024-05-02 08:45:51 +00:00
Petr
4602d09655 PY-61639 Extracted PyHighlightingAnnotator
GitOrigin-RevId: 432bcb87b77fa55f1ccb26000d91ae021cebcc6b
2024-03-27 15:05:16 +00:00
Petr
b9167aef8b PY-61639 Move PyPreFormatProcessor to python.syntax.core
GitOrigin-RevId: 30d204206de9e09eae34baf0555fc9be5822ba68
2024-02-16 15:53:21 +00:00
Petr
d7630f0ef5 PY-61639 Move PyTrailingBlankLinesPostFormatProcessor to python.syntax.core
GitOrigin-RevId: a33777ac12163807f1395cbb8b03c58df506c3cf
2024-02-16 15:53:16 +00:00
Petr
2c7f5b4b32 PY-61639 Move PyPreFormatProcessor to python.syntax.core
GitOrigin-RevId: 4832fe901219342bb7f1babf41280830e16fec49
2024-02-16 15:53:11 +00:00
Petr
f6cad19f19 PY-61639 Move PyKeywordTypeHandler to python.syntax
GitOrigin-RevId: 3e0e70f5868b0fc09c35e571db0d0e553902eb6d
2024-02-16 15:52:56 +00:00
Petr
85c54b3a4c PY-61639 Move PythonFormattingModelBuilder to python.syntax.core
GitOrigin-RevId: bdcbd076cd3c1531204eff35515b44cd0edc9f68
2024-02-16 15:52:22 +00:00
Petr
da4a4b066b PY-61639 Move PyLanguageCodeStyleSettingsProvider to python.syntax
GitOrigin-RevId: 547f75fe15a4164ee317fe16b693233ca620a558
2024-02-16 15:52:17 +00:00
Petr Golubev
25b8ebcf83 PY-61639 Extracted PythonEnterHandler
GitOrigin-RevId: 8fd0c063c917e07c3f1bf98533c3de867f770ee9
2024-02-08 13:58:08 +00:00