flutter-intellij icon indicating copy to clipboard operation
flutter-intellij copied to clipboard

custom_lint: IDE Quick actions and errors are not shown in GUI

Open rathishnk opened this issue 1 year ago • 10 comments

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

  • create a custom lint rule using custom_lint_builder
  • run dart run custom_lint shows the errors as
Building package executable... 
Built custom_lint:custom_lint.
Analyzing...                           0.0s

  lib/main.dart:15:11 • Use `optDouble` or `getDouble` from utils package for parsing double safely • avoid_double_casting • ERROR
  lib/main.dart:37:54 •  color linter • ERROR
  lib/main.dart:37:54 •  color linter • ERROR

3 issues found.

IDE does not show error in GUI

IntelliJ

Screenshot 2024-08-09 at 12 54 29 PM

VSCode

Screenshot 2024-08-01 at 11 45 08 AM

Version info

flutter --version

Flutter 3.22.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 761747bfc5 (9 weeks ago) • 2024-06-05 22:15:13 +0200
Engine • revision edd8546116
Tools • Dart 3.4.3 • DevTools 2.34.3

flutter doctor -v

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.6.1 23G93 darwin-arm64, locale en-AE)
    • Flutter version 3.22.2 on channel stable at /Users/rathish.kannan/fvm/versions/3.22.2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (9 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/rathish.kannan/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

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

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/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.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.4)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 80.0.2
    • Dart plugin version 241.18808

[✓] VS Code (version 1.91.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (5 available)
    • Ratz  (mobile)        • 00008110-001E48EC0EB9801E            • ios            • iOS
      17.4.1 21E236
    • All expected network resources are available.

• No issues found!

rathishnk avatar Aug 09 '24 08:08 rathishnk

This seems to be related with the following error:

The request analysis.setContextRoots failed with the following error:
RequestErrorCode.PLUGIN_ERROR
ProcessException: No such file or directory
  Command: flutter pub get
at:
#0      _ProcessImpl._start (dart:io-patch/process_patch.dart:402:33)
#1      Process.start (dart:io-patch/process_patch.dart:38:20)
#2      _runNonInteractiveProcess (dart:io-patch/process_patch.dart:579:18)
#3      Process.run (dart:io-patch/process_patch.dart:49:12)
#4      CustomLintWorkspace.runPubGet (package:custom_lint/src/workspace.dart:772:36)
#5      CustomLintWorkspace.resolvePluginHost (package:custom_lint/src/workspace.dart:765:11)
#6      SocketCustomLintServerToClientChannel._startProcess (package:custom_lint/src/v2/server_to_client_channel.dart:151:24)
#7      SocketCustomLintServerToClientChannel.init (package:custom_lint/src/v2/server_to_client_channel.dart:110:22)
#8      CustomLintServer._maybeSpawnCustomLintPlugin (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:394:25)
<asynchronous suspension>
#9      CustomLintServer._handleAnalysisSetContextRoots.<anonymous closure> (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:341:9)
<asynchronous suspension>
#10     PendingOperation.run (package:custom_lint/src/async_operation.dart:22:14)
<asynchronous suspension>
#11     CustomLintServer._handleRequest (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:173:22)
<asynchronous suspension>

It used to work some versions ago. The issue seems related to the environment variables used while running the linter in the IDE, that is not providing the full PATH which contains the flutter pub get.

droidpl avatar Sep 09 '24 21:09 droidpl

I'm facing the same problem.

uniwasa avatar Sep 28 '24 08:09 uniwasa

Seems to work with version 0.6.6.

stefangaller avatar Oct 17 '24 07:10 stefangaller

same here

lunaticcoding avatar Dec 17 '24 17:12 lunaticcoding

same here!

hohlfma avatar Dec 17 '24 23:12 hohlfma

Problem still persists. Also, I cannot downgrade custom_lint. When I do, I get these errors:

Failed to build custom_lint:custom_lint:
../../.pub-cache/hosted/pub.dev/custom_lint_core-0.6.5/lib/src/node_lint_visitor.g.dart:92:41: Error: Type 'AugmentationImportDirective' not found.
  void visitAugmentationImportDirective(AugmentationImportDirective node) {
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dev/custom_lint_core-0.6.5/lib/src/node_lint_visitor.g.dart:686:42: Error: Type 'LibraryAugmentationDirective' not found.
  void visitLibraryAugmentationDirective(LibraryAugmentationDirective node) {
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

LeonP2ER avatar Jan 03 '25 09:01 LeonP2ER

I'm not even using custom_lint, I get this issue. Cannot use build_runner right now.

itsJoKr avatar Jan 20 '25 06:01 itsJoKr

Any updates on the issue?

MartinAKovachev avatar Jan 22 '25 17:01 MartinAKovachev

add this to your pubspec yaml

dependency_overrides: analyzer: ^6.3.0 custom_lint_core: ^0.6.6

olablessing avatar Jan 24 '25 03:01 olablessing

We can't upgrade because of conflicts with other packages but were able to get custom_lint_core: ^0.6.4 to run with flutter 3.24.5

aardrop avatar Feb 19 '25 20:02 aardrop