Skip to content

Commit ac3404f

Browse files
committed
Revert "add boundary check for userModificationTracker"
This reverts commit 0968121.
1 parent 0968121 commit ac3404f

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/telemetry/CodeWhispererUserModificationTracker.kt

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import org.assertj.core.util.VisibleForTesting
1919
import software.amazon.awssdk.services.codewhispererruntime.model.CodeWhispererRuntimeException
2020
import software.aws.toolkits.core.utils.debug
2121
import software.aws.toolkits.core.utils.getLogger
22-
import software.aws.toolkits.core.utils.warn
2322
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnection
2423
import software.aws.toolkits.jetbrains.services.codewhisperer.credentials.CodeWhispererClientAdaptor
2524
import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
@@ -155,28 +154,14 @@ class CodeWhispererUserModificationTracker(private val project: Project) : Dispo
155154
private fun emitTelemetryOnSuggestion(acceptedSuggestion: AcceptedSuggestionEntry) {
156155
val file = acceptedSuggestion.vFile
157156

158-
if (file == null || (!file.isValid) || !acceptedSuggestion.range.isValid) {
157+
if (file == null || (!file.isValid)) {
159158
sendModificationTelemetry(acceptedSuggestion, null)
160159
sendUserModificationTelemetryToServiceAPI(acceptedSuggestion)
161160
} else {
162161
// Will remove this later when we truly don't need toolkit user modification telemetry anymore
163162
val document = runReadAction {
164163
FileDocumentManager.getInstance().getDocument(file)
165164
}
166-
val start = acceptedSuggestion.range.startOffset
167-
val end = acceptedSuggestion.range.endOffset
168-
if (document != null) {
169-
if (start < 0 || end < start || end > document.textLength) {
170-
LOG.warn {
171-
"Invalid range for suggestion ${acceptedSuggestion.requestId}: " +
172-
"start=$start, end=$end, docLength=${document.textLength}"
173-
}
174-
sendModificationTelemetry(acceptedSuggestion, null)
175-
sendUserModificationTelemetryToServiceAPI(acceptedSuggestion)
176-
return
177-
}
178-
}
179-
180165
val currentString = document?.getText(
181166
TextRange(acceptedSuggestion.range.startOffset, acceptedSuggestion.range.endOffset)
182167
)

0 commit comments

Comments
 (0)