dkandalov / quick-fix

Plugin for JetBrains IDEs to apply "quick fix" from the most relevant intention or inspection 💡
https://plugins.jetbrains.com/plugin/16366-quick-fix
20 stars 3 forks source link

IndexOutOfBoundsException when invoking 'QuickFix' when cursor is at the last position in the file #7

Open VladRassokhin opened 2 weeks ago

VladRassokhin commented 2 weeks ago

%Subj%

Plugin version 1.8. IDE: Build #IU-243.21631

Steps to reproduce 1: Create an empty scratch file, press F1.

Steps to reproduce 2: Create an empty scratch file, type three chars, press F1.

java.lang.IndexOutOfBoundsException: Index out of range: 3; length: 3
    at com.intellij.util.text.ImmutableText.outOfRange(ImmutableText.java:268)
    at com.intellij.util.text.ImmutableText.findLeaf(ImmutableText.java:247)
    at com.intellij.util.text.ImmutableText.charAt(ImmutableText.java:232)
    at com.intellij.openapi.editor.impl.DocumentImpl$1.charAt(DocumentImpl.java:93)
    at quickfix.QuickFixAction.actionPerformed(quick-fix.kt:47)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.kt:374)
    at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:32)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$actionProcessor$1.performAction(IdeKeyEventDispatcher.kt:499)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$8$lambda$7(IdeKeyEventDispatcher.kt:850)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:109)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:98)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$8(IdeKeyEventDispatcher.kt:850)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.performWithActionCallbacks(ActionManagerImpl.kt:1168)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.kt:396)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner(IdeKeyEventDispatcher.kt:848)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.access$doPerformActionInner(IdeKeyEventDispatcher.kt:1)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.kt:577)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.kt:512)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.kt:451)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.kt:444)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.kt:306)
    at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.kt:606)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$22(IdeEventQueue.kt:565)
    at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:128)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:565)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18$lambda$17$lambda$16$lambda$15(IdeEventQueue.kt:355)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:857)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18$lambda$17$lambda$16(IdeEventQueue.kt:354)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$2$lambda$1(IdeEventQueue.kt:1045)
    at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
    at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:128)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:916)
    at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
    at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$2(IdeEventQueue.kt:1045)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$3(IdeEventQueue.kt:1054)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:117)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1054)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:395)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
dkandalov commented 2 weeks ago

Thank you for reporting this! It should be fixed in version 1.9.