File tree Expand file tree Collapse file tree
src/main/kotlin/space/whitememory/pythoninlayparams Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
22
33## [ Unreleased]
4+ ### Fixed
5+ - Hints not showing when there's one positional parameter with ` **kwargs `
46
57## [ 0.1.3] - 2022-07-19
6- ### Changed
7- - Hide the hints that are 1 character long
8- - Don't show hints in call expressions that take a single parameter (except for ` *args ` )
8+ ### Changed
9+ - Hide the hints that are 1 character long
10+ - Don't show hints in call expressions that take a single parameter (except for ` *args ` )
911
1012
11- ### Fixed
12- - Hints showing when placing a positional argument after keyword ones
13- - Hints for classes that use ` __new__ ` , like ` datetime.datetime `
13+ ### Fixed
14+ - Hints showing when placing a positional argument after keyword ones
15+ - Hints for classes that use ` __new__ ` , like ` datetime.datetime `
1416- Arguments with the same name as the parameter, but in a different case, were still displayed
1517
1618## [ 0.1.2] - 2022-07-18
1719### Fixed
18- - ` **kwargs ` parameter being shown in certain situations
19- - Class hints based on their attributes were shown incorrectly
20+ - ` **kwargs ` parameter being shown in certain situations
21+ - Class hints based on their attributes were shown incorrectly
2022- Fix hints display for calls with unpacking
2123
2224## [ 0.1.1] - 2022-07-17
2325### Fixed
24- - Wrong hints behavior with some classes, related to the ` __init__ ` inheritance logic
25- - Wrong hint ordering when a positional argument is passed after keyword arguments
26+ - Wrong hints behavior with some classes, related to the ` __init__ ` inheritance logic
27+ - Wrong hint ordering when a positional argument is passed after keyword arguments
2628- Messed up parameter ordering when unpacking is in the call expression
2729
2830## [ 0.1.0] - 2022-07-15
Original file line number Diff line number Diff line change @@ -91,11 +91,16 @@ class PythonInlayHintsProvider : InlayParameterHintsProvider {
9191 return inlayInfos
9292 }
9393
94- if (param is PyNamedParameter && param.isPositionalContainer) {
95- // This is an *args parameter that takes more than one argument
96- // So we stop the further processing of this call expression
97- inlayInfos.add(InlayInfo (" ...$paramName " , arg.textOffset))
98- return inlayInfos
94+ if (param is PyNamedParameter ) {
95+ if (param.isPositionalContainer) {
96+ // This is an *args parameter that takes more than one argument
97+ // So we show it and stop the further processing of this call expression
98+ inlayInfos.add(InlayInfo (" ...$paramName " , arg.textOffset))
99+ return inlayInfos
100+ } else if (param.isKeywordContainer) {
101+ // We don't want to show `kwargs` as a hint by accident
102+ return inlayInfos
103+ }
99104 }
100105
101106 if (isHintNameValid(paramName, arg)) {
@@ -122,9 +127,7 @@ class PythonInlayHintsProvider : InlayParameterHintsProvider {
122127 private fun getElementFilteredParameters (element : PsiElement ): List <PyParameter > {
123128 element.children.forEach {
124129 if (it is PyParameterList ) {
125- return it.parameters.filter { param ->
126- ! param.isSelf && (param !is PyNamedParameter || ! param.isKeywordContainer)
127- }
130+ return it.parameters.filter { param -> ! param.isSelf }
128131 }
129132 }
130133 return emptyList()
You can’t perform that action at this time.
0 commit comments