Skip to content

Commit b6c6774

Browse files
committed
Fix hints appear with keyword args
1 parent efded66 commit b6c6774

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/kotlin/space/whitememory/pythoninlayparams/PythonInlayHintsProvider.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,22 @@ class PythonInlayHintsProvider : InlayParameterHintsProvider {
8080

8181
resolvedParameters.zip(args).forEach { (param, arg) ->
8282
val paramName = param.name ?: return@forEach
83+
if (arg is PyKeywordArgument || arg is PyStarArgument) {
84+
// Keyword arguments and unpacking don't need a hint,
85+
// Keep for proper ordering and to avoid displaying issues
86+
return@forEach
87+
}
88+
8389
if (param is PyNamedParameter && param.isPositionalContainer) {
8490
// This is an *args parameter that takes more than one argument
8591
// So we stop the further processing of this call expression
8692
inlayInfos.add(InlayInfo("...$paramName", arg.textOffset))
8793
return inlayInfos
8894
}
8995

90-
// The argument is unpacking, we don't want to show hints any further
91-
// Because we can't be sure what parameters it covers
92-
if (arg is PyStarArgument) {
93-
return inlayInfos
94-
}
95-
9696
// Skip this parameter if its name starts with __,
9797
// or equals to the argument provided
98-
if (arg !is PyKeywordArgument && paramName != arg.name && !paramName.startsWith("__")) {
98+
if (paramName != arg.name && !paramName.startsWith("__")) {
9999
// TODO: Add more complex filters
100100
inlayInfos.add(InlayInfo(paramName, arg.textOffset))
101101
}

0 commit comments

Comments
 (0)