Skip to content

Commit

Permalink
chore: add count for size
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 26, 2023
1 parent cbc4f3e commit 99f2f23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ data class InsPickerOption(
* The [CompletionBuilderType], which will according you IDE strategy to generate the type.
*/
val completionTypes: List<CompletionBuilderType> = listOf(
// CompletionBuilderType.AFTER_BLOCK_COMPLETION,
// CompletionBuilderType.IN_BLOCK_COMPLETION,
// CompletionBuilderType.INLINE_COMPLETION,
CompletionBuilderType.TEST_CODE_GEN,
CompletionBuilderType.AFTER_BLOCK_COMPLETION,
CompletionBuilderType.IN_BLOCK_COMPLETION,
CompletionBuilderType.INLINE_COMPLETION,
// CompletionBuilderType.TEST_CODE_GEN,
),
/**
* The [CodeQualityType], will be like a tree to hold the item.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,20 @@ class WorkerManager(private val context: WorkerContext) {
val finalList: EnumMap<CompletionBuilderType, List<Instruction>> =
EnumMap(CompletionBuilderType::class.java)

var skipCount = 0
// filter output by threshold
results.mapNotNull {
val ins = it.unique()
if (thresholdChecker.isMetThreshold(ins)) {
finalList[it.type] = finalList[it.type]?.plus(ins) ?: listOf(ins)
} else {
skipCount++
null
}
}

logger.info("skip $skipCount / ${results.size} instructions, ")

// take context.completionTypeSize for each type
return finalList.keys.map {
finalList[it]?.take(context.completionTypeSize) ?: emptyList()
Expand Down

0 comments on commit 99f2f23

Please sign in to comment.