flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.99k stars 318 forks source link

AssertionException during format-on-save #6860

Open rayk opened 1 year ago

rayk commented 1 year ago

Thanks for the feedback! If your issue is related to the Flutter framework itself, please open an issue at github.com/flutter/flutter.

Steps to Reproduce

Please tell us what you were doing and what went wrong

Version info

[✓] Flutter (Channel stable, 3.10.6, on macOS 13.5 22G74 darwin-x64, locale en-AU) • Flutter version 3.10.6 on channel stable at /Users/rayk/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f468f3366c (3 weeks ago), 2023-07-12 15:19:05 -0700 • Engine revision cdbeda788a • Dart version 3.0.6 • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) • Android SDK at /Users/rayk/Library/Android/sdk • Platform android-33, build-tools 33.0.1 • Java binary at: /Users/rayk/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E300c • CocoaPods version 1.12.1

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2) • Android Studio at /Users/rayk/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.10121639/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] Android Studio (version 2022.3) • Android Studio at /Users/rayk/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2) • IntelliJ at /Users/rayk/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app • Flutter plugin version 74.0.5 • Dart plugin version 232.8660.129

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2) • IntelliJ at /Users/rayk/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.8660.185/IntelliJ IDEA 2023.2 EAP.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2) • IntelliJ at /Users/rayk/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-1/232.8660.142/IntelliJ IDEA 2023.2 EAP.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2) • IntelliJ at /Users/rayk/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-1/232.8660.185/IntelliJ IDEA 2023.2 EAP.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.4) • IntelliJ at /Users/rayk/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9225.16/IntelliJ IDEA.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 13.5 22G74 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 115.0.5790.114

[✓] Network resources • All expected network resources are available.

What happened

Version information

IntelliJ IDEA 2023.2 • Flutter plugin io.flutter 74.0.5 • Dart plugin 232.8660.129

Flutter 3.10.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision f468f3366c (3 weeks ago) • 2023-07-12 15:19:05 -0700 Engine • revision cdbeda788a Tools • Dart 3.0.6 • DevTools 2.23.1

Exception

null

java.lang.AssertionError
    at com.intellij.openapi.editor.impl.view.VisualLineFragmentsIterator.setInlaysAndFragmentIterator(VisualLineFragmentsIterator.java:159)
    at com.intellij.openapi.editor.impl.view.VisualLineFragmentsIterator.next(VisualLineFragmentsIterator.java:253)
    at com.intellij.openapi.editor.impl.view.VisualLineFragmentsIterator.next(VisualLineFragmentsIterator.java:25)
    at com.intellij.openapi.editor.impl.view.EditorSizeManager.calculateLineWidth(EditorSizeManager.java:454)
    at com.intellij.openapi.editor.impl.view.EditorSizeManager.getVisualLineWidth(EditorSizeManager.java:427)
    at com.intellij.openapi.editor.impl.view.EditorSizeManager.calculateTextPreferredWidth(EditorSizeManager.java:407)
    at com.intellij.openapi.editor.impl.view.EditorSizeManager.getTextPreferredWidth(EditorSizeManager.java:358)
    at com.intellij.openapi.editor.impl.view.EditorSizeManager.getPreferredSize(EditorSizeManager.java:269)
    at com.intellij.openapi.editor.impl.view.EditorView.getPreferredSize(EditorView.java:292)
    at com.intellij.openapi.editor.impl.EditorImpl.lambda$getPreferredSize$27(EditorImpl.java:2208)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:923)
    at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:76)
    at com.intellij.openapi.editor.impl.EditorImpl.getPreferredSize(EditorImpl.java:2204)
    at com.intellij.openapi.editor.impl.EditorImpl.validateSize(EditorImpl.java:1832)
    at com.intellij.openapi.editor.impl.EditorImpl.changedUpdate(EditorImpl.java:1742)
    at com.intellij.openapi.editor.impl.EditorImpl$EditorDocumentAdapter.documentChanged(EditorImpl.java:5091)
    at com.intellij.openapi.editor.impl.DocumentImpl.lambda$changedUpdate$1(DocumentImpl.java:913)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:222)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:230)
    at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:64)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:230)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:221)
    at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:910)
    at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:814)
    at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:654)
    at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:591)
    at io.flutter.editor.FlutterSaveActionsManager$3.run(FlutterSaveActionsManager.java:192)
    at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:335)
    at com.intellij.openapi.application.RunResult.run(RunResult.java:27)
    at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$1(WriteCommandAction.java:279)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:992)
    at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:278)
    at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$3(WriteCommandAction.java:308)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:184)
    at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:310)
    at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:278)
    at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:259)
    at io.flutter.editor.FlutterSaveActionsManager.lambda$performFormat$1(FlutterSaveActionsManager.java:206)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
    at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:789)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:740)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:734)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:759)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:589)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
    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)
stevemessick commented 1 year ago

@rayk Two questions:

  1. Were you using the new UI or old?
  2. Does this happen often or was this the only time you've seen this error?
rayk commented 1 year ago

Hi Steve

  1. New UI
  2. It happened a couple of times yesterday; I reported the third instance and experienced another one later. (No noticeable pattern as to where or when)
stevemessick commented 1 year ago

@rayk Thanks for the info. I think we're doing the right thing here, so I'm going to check with a collaborator at JetBrains for confirmation.

@alexander-doroshko The Flutter plugin has been doing format-on-save for years but suddenly it isn't working. Do you think this could be related to new UI changes? The plugin is doing a complete replacement of the string in a document. It shouldn't (IMO) fail. The puzzling thing is that it only seems to affect one user, unless everyone else is just ignoring it.

alexander-doroshko commented 1 year ago

This doesn't look like a Flutter plugin issue. I suspect it's project-specific, so probably no one else faces the problem. I'm afraid we need reliable steps to reproduce to proceed.

rayk commented 1 year ago

I can report this this issue in persist across two environments. I am intending to reinstall and reproduce this in come days so please do not close this issue yet.

On Mon, 14 Aug 2023, 7:42 pm Alexander Doroshko, @.***> wrote:

This doesn't look like a Flutter plugin issue. I suspect it's project-specific, so probably no one else faces the problem. I'm afraid we need reliable steps to reproduce to proceed.

— Reply to this email directly, view it on GitHub https://github.com/flutter/flutter-intellij/issues/6860#issuecomment-1677011243, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACVNQXXKK35HQ5KJDBFSLDXVHXIFANCNFSM6AAAAAA27A36LQ . You are receiving this because you were mentioned.Message ID: @.***>