Minor code corrections after review
This commit is contained in:
@@ -102,9 +102,12 @@ public object ShortenReferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitUserType(userType: JetUserType) {
|
override fun visitUserType(userType: JetUserType) {
|
||||||
|
val filterResult = elementFilter(userType)
|
||||||
|
if (filterResult == FilterResult.SKIP) return
|
||||||
|
|
||||||
userType.getTypeArgumentList()?.accept(this)
|
userType.getTypeArgumentList()?.accept(this)
|
||||||
|
|
||||||
if (elementFilter(userType) == FilterResult.PROCESS && canShortenType(userType)) {
|
if (filterResult == FilterResult.PROCESS && canShortenType(userType)) {
|
||||||
typesToShorten.add(userType)
|
typesToShorten.add(userType)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class LambdaItems(val project: Project) {
|
|||||||
val offset = context.getStartOffset()
|
val offset = context.getStartOffset()
|
||||||
val placeholder = "{}"
|
val placeholder = "{}"
|
||||||
document.replaceString(offset, context.getTailOffset(), placeholder)
|
document.replaceString(offset, context.getTailOffset(), placeholder)
|
||||||
editor.getCaretModel().moveToOffset(offset + 1)
|
|
||||||
val rangeMarker = document.createRangeMarker(offset, offset + placeholder.length)
|
val rangeMarker = document.createRangeMarker(offset, offset + placeholder.length)
|
||||||
|
|
||||||
// we start template later to not interfere with insertion of tail type
|
// we start template later to not interfere with insertion of tail type
|
||||||
@@ -101,9 +100,9 @@ class LambdaItems(val project: Project) {
|
|||||||
template.addTextSegment("(")
|
template.addTextSegment("(")
|
||||||
}
|
}
|
||||||
|
|
||||||
var i = 0
|
for (i in parameterTypes.indices) {
|
||||||
for (parameterType in parameterTypes) {
|
val parameterType = parameterTypes[i]
|
||||||
if (i++ > 0) {
|
if (i > 0) {
|
||||||
template.addTextSegment(", ")
|
template.addTextSegment(", ")
|
||||||
}
|
}
|
||||||
template.addVariable(ParameterNameExpression(JetNameSuggester.suggestNames(parameterType, nameValidator, "p")), true)
|
template.addVariable(ParameterNameExpression(JetNameSuggester.suggestNames(parameterType, nameValidator, "p")), true)
|
||||||
|
|||||||
Reference in New Issue
Block a user