flutter-intellij: Autoformat causes an exception

Steps to Reproduce

Pressed Ctrl + L to reformat the code in a freshly open project

Version information

Android Studio 3.4 • Flutter plugin io.flutter 35.2.1 • Dart plugin 183.6270

Error getting Flutter sdk information.

Exception

null

java.lang.IndexOutOfBoundsException: Index out of range: 5373
	at com.intellij.util.text.ImmutableText.findLeaf(ImmutableText.java:234)
	at com.intellij.util.text.ImmutableText.charAt(ImmutableText.java:226)
	at com.intellij.openapi.editor.impl.DocumentImpl$1.charAt(DocumentImpl.java:101)
	at io.flutter.editor.WidgetIndentsHighlightingPass.computeLocation(WidgetIndentsHighlightingPass.java:682)
	at io.flutter.editor.WidgetIndentsHighlightingPass.buildWidgetDescriptors(WidgetIndentsHighlightingPass.java:709)
	at io.flutter.editor.WidgetIndentsHighlightingPass.buildWidgetDescriptors(WidgetIndentsHighlightingPass.java:742)
	at io.flutter.editor.WidgetIndentsHighlightingPass.buildWidgetDescriptors(WidgetIndentsHighlightingPass.java:742)
	at io.flutter.editor.WidgetIndentsHighlightingPass.buildWidgetDescriptors(WidgetIndentsHighlightingPass.java:742)
	at io.flutter.editor.WidgetIndentsHighlightingPass.buildWidgetDescriptors(WidgetIndentsHighlightingPass.java:742)
	at io.flutter.editor.WidgetIndentsHighlightingPass.setOutline(WidgetIndentsHighlightingPass.java:547)
	at io.flutter.editor.WidgetIndentsHighlightingPass.run(WidgetIndentsHighlightingPass.java:523)
	at io.flutter.editor.WidgetIndentsHighlightingPassFactory.runWidgetIndentsPass(WidgetIndentsHighlightingPassFactory.java:299)
	at io.flutter.editor.WidgetIndentsHighlightingPassFactory.lambda$createHighlightingPass$4(WidgetIndentsHighlightingPassFactory.java:270)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:435)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:419)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:403)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
	at java.awt.EventQueue.access$500(EventQueue.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:715)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:755)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:704)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:391)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Unfortunately the repro would need to be included on the github bug for me to be able to view it. Let me try creating a custom intellij plugin build with the likely fix and then you can test if the fix works.

изображение Everything looks fine.

Sure, please provide some contact information, I can send it to you.

If you have a source code file that reproduces the issue that would be very helpful.