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

Exclude autogenerated files from analyzer #1961

Open
acul009 opened this issue May 20, 2024 · 6 comments
Open

Exclude autogenerated files from analyzer #1961

acul009 opened this issue May 20, 2024 · 6 comments
Labels
awaiting Waiting for responses, PR, further discussions, upstream release, etc bug Something isn't working

Comments

@acul009
Copy link

acul009 commented May 20, 2024

Describe the bug

VSCode was prompting me to run dart fix all the time, but it wanted to fix code from cargokit and the generated code all the time.

I just added the following to my analysis_options.yaml:

analyzer:
  exclude:
  # Exclude autogenerated files
    - 'rust_builder/**'
    - 'lib/src/rust/**'

Is the template project a git repo or is it generated using code?
I'd like to create a pull request to exclude these directories by default if that sounds reasonable to you.

Steps to reproduce

  1. Create Some basic rust code with external structs and enums
  2. generate the dart code
  3. run dart fix -n

Logs

---

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

flutter_rust_bridge_codegen 2.0.0-dev.32

Flutter info

No response

Version of clang++

No response

Additional context

No response

@acul009 acul009 added the bug Something isn't working label May 20, 2024
@fzyzcjy
Copy link
Owner

fzyzcjy commented May 21, 2024

Thanks, but I am not very sure whether that is most perfect. For example, IIRC, if excluding the frb_generated.dart, then things like autocomplete will not work for classes there (e.g. we want to call RustLib.init()); I am not sure whether today's Dart linter still does this?

@fzyzcjy fzyzcjy added the awaiting Waiting for responses, PR, further discussions, upstream release, etc label May 21, 2024
@acul009
Copy link
Author

acul009 commented May 21, 2024

At least in my case, VSCode will still autocomplete function names in these folders.

That might be different for other people though. If you think this change would instead create trouble for others, feel free to close it :)

@fzyzcjy
Copy link
Owner

fzyzcjy commented May 21, 2024

At least in my case, VSCode will still autocomplete function names in these folders.

That looks great! To double check, have you ensured that the dart analyzer is using the new configurations, e.g. by restarting VSCode and analysis server? (I remembered sometimes the analyzer does not pick up new config automatically, but it may be outdated information and only applies to old Dart)

Possibly related: #1949

@acul009
Copy link
Author

acul009 commented May 29, 2024

I've been using this config for about a week now and it seems to work great (at least for me)

@fzyzcjy
Copy link
Owner

fzyzcjy commented May 29, 2024

I will think about it a bit later. Originally I thought about the preamble thing, but fix may be different?

@fzyzcjy
Copy link
Owner

fzyzcjy commented May 30, 2024

I checked it a little bit for the pure_dart example (which contains a ton of code):

dart fix -n 
Computing fixes in pure_dart (dry run)... 22.5s
Nothing to fix!

Could you please share a minimal reproducible sample and the corresponding dart fix? Then it may be easier to see what is happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting Waiting for responses, PR, further discussions, upstream release, etc bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants