@@ -19,7 +19,6 @@ import org.assertj.core.util.VisibleForTesting
1919import software.amazon.awssdk.services.codewhispererruntime.model.CodeWhispererRuntimeException
2020import software.aws.toolkits.core.utils.debug
2121import software.aws.toolkits.core.utils.getLogger
22- import software.aws.toolkits.core.utils.warn
2322import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnection
2423import software.aws.toolkits.jetbrains.services.codewhisperer.credentials.CodeWhispererClientAdaptor
2524import 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