Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzer not picking up changes after BuiltValue generation in IntelliJ #42191

Open
rayk opened this issue Jun 5, 2020 · 5 comments
Open

Analyzer not picking up changes after BuiltValue generation in IntelliJ #42191

rayk opened this issue Jun 5, 2020 · 5 comments
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P4 type-enhancement A request for a change that isn't a bug

Comments

@rayk
Copy link

rayk commented Jun 5, 2020

This maybe a regression issue.

There was a previous defect with identical behaviour, which appeared to resolve itself.

The core of the issue is as follows:

The IDE (intelliJ) does not recognise (red squeakily line) newly created BuiltValue abstract classes or existing BuiltValue abstract classes that have been edited, until "Invalidate Cache / Restart..." from the File menu of intellij has restarted the IDE and reindexed the whole project (this is very time consuming).

Reproduction Steps:

  1. create a BuiltValue abstract class.
abstract class PersistEvent
    implements Built<PersistEvent, PersistEventBuilder> {
  PersistEvent._();
  factory PersistEvent([void Function(PersistEventBuilder) updates]) =
      _$PersistEvent;
}
  1. execute the generator.
  • flutter pub run build_runner build or
  • flutter pub run build_runner build --delete-conflicting-outputs
    then:
  • confirm the PersistEventBuilder has been created in the *.g.dart file.
  1. Observe red squeakily lines in IDE.

  2. Select invalidate Cache / Restart... for the file menu.

  3. Wait Wait Wait.

  4. Observe the IDE now recognises the PersistEvent

Environment:

IntelliJ IDEA 2020.1.2 (Ultimate Edition)
Build #IU-201.7846.76, built on June 1, 2020
Runtime version: 11.0.7+10-b765.53 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.5
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: dart.server.additional.arguments=--enable-completion-model, debugger.watches.in.variables=false
Non-Bundled Plugins: BrowseWordAtCaret, BunyanConsole, Dummy Text Generator, Key Promoter X, Shifter, String Manipulation, TabSwitch, awesome.console, com.fwdekker.randomness, com.giancarlocode.built-value-snippets, com.github.leomillon.uuidgenerator, com.github.lppedd.idea-conventional-commit, com.github.novotnyr.jwt-intellij-plugin, Time Convertor Plugin, com.dubreuia, com.godwin.json.parser, com.herbert.george.flutter-snippets, com.marlboro.gitbar, io.github.xusida.idea.plugins.formatyaml, launch-url-from-string, com.ivanovych666.intellij.plugin.jsonsorter, com.intellij.plugins.watcher, com.wix.scss.lint, com.mallowigi, com.paperetto.dash, com.potterhsu.jsonviewer, com.shenyong.flutter.refgenerator, com.sonnk.iterm, com.wakatime.intellij.plugin, mobi.hsz.idea.gitignore, io.github.qeesung.component.HighlightBracketPair, krasa.CpuUsageIndicator, lermitage.intellij.extra.icons, com.dmarcotte.handlebars, Dart, andrasferenczi.dart-data-plugin, com.localizely.flutter-intl, io.flutter, org.bdshadow.json.serialization.generator, cz.daku.intellij.extraActions, org.jetbrains.kotlin, de.endrullis.idea.postfixtemplates, izhangzhihao.rainbow.brackets, zielu.gittoolbox, com.intellij.lang.jsgraphql, com.wix.eslint, intellij.prettierJS, org.sylfra.idea.plugins.linessorter, org.turbanov.commits.message.checker, socrates.tabshifter, zjhmale.rainbow

and

Flutter 1.18.0-11.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 2738a1148b (3 weeks ago) • 2020-05-13 15:24:36 -0700
Engine • revision ef9215ceb2
Tools • Dart 2.9.0 (build 2.9.0-8.2.beta)

References:

@davidmorgan (BuiltValue)
initial issue - over a year old
@aaronlademann-wf (Also impacted by pervious issue)
cross filed in flutter plugin repository

@devoncarew
Copy link
Member

How have you configured source gen? I believe there are two options - one to generate in your project source, and one to generate in the .dart_tool directory. IOW, where are the files being generated?

@devoncarew devoncarew added the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label Jun 5, 2020
@rayk
Copy link
Author

rayk commented Jun 6, 2020

Hey @devoncarew I am generating into my project source, so my *.g.dart is along side that code file that give rise to it.


NOTE:
Initially I forgot to mention that restarting the Dart Analysis Server from with the IDE, the *.g.dart files become recognised, (hence no more red squeakily line).


@no-response no-response bot removed the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label Jun 6, 2020
@devoncarew devoncarew changed the title Analyser not picking up changes after BuiltValue generation in Intellij (Not Duplicate) Analyser not picking up changes after BuiltValue generation in IntelliJ Jun 8, 2020
@devoncarew devoncarew changed the title Analyser not picking up changes after BuiltValue generation in IntelliJ Analyzer not picking up changes after BuiltValue generation in IntelliJ Jun 8, 2020
@devoncarew
Copy link
Member

OK, when code gen is configured to generate into .dart_tool/, I suspect that we don't watch the generation location for file changes, so would not be surprised if that use case didn't work well (if you did need to re-start the analysis server).

It sounds like you're generating into your existing source however (into lib/); that should work just as well as editing files in your project - the analysis server will be notified on file changes, and re-analyze the necessary files.

Can you come up with a minimal repro? That would help us track down where the issue is.

@devoncarew devoncarew added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-server labels Jun 8, 2020
@simolus3
Copy link
Contributor

@rayk Do you exclude generated files in your analysis_options.yaml?

For me the problem goes away when I open the generated file in IntelliJ, type around it and then undo. Not ideal, but faster than invalidating or restarting the DAS.

@rayk
Copy link
Author

rayk commented Jun 18, 2020

@simolus3 Interesting, this is the same for me.

I just try to adding and removing my lib/**/*.g.dart from & to my analysis_options.yaml and that appear to have no impact.

@srawlins srawlins added the P4 label Jan 23, 2021
@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P4 type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants