Skip to content

Renaming files doesn't update conditional imports #4529

Open

Description

@mosuem

Describe the bug
Conditional imports have some problems:

  1. By default, the source file path is not checked, which can only be enabled through an optional lint. I think it should be the other way around, disabling the check should be a lint. - Discussion in Conditional imports not checked #4525
  2. There is no code completion for source file paths in conditional imports. Filename completion doesn't work for conditional imports #4530
  3. Renaming a file does not trigger renaming of the conditional import path (possibly related to 2., as they are not parsed as file references?).

Activity

  1. changed the title [-]Conditional imports support[/-] [+]Renaming files doesn't update conditional imports[/+] on May 9, 2023
  2. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on May 9, 2023
  3. added this to the v3.66.0 milestone on May 9, 2023
  4. DanTup commented on May 9, 2023

    @DanTup
    Member

    Thanks! I've split (2) into #4530 an will use this to track (3).

    We can continue discussion of (1) in #4525 (comment). It's not something I have a real preference on, but changing default lints is a decision for others to make.

  5. DanTup commented on May 10, 2023

    @DanTup
    Member

    @bwilkerson @scheglov I think this happens because when we rename a file, we search for all references to it using _searchReferences_CompilationUnit in Search. This uses fileState.referencingFiles to find which files reference the one being moved, but that only includes the "selected" uri from the directive.

    Would it be reasonable for FileState.referencingFiles to also be populated with all non-"selected" URIs from a directive? There are a few other places that use this list but it's not clear to me what are the implications of it having the others in there.

  6. bwilkerson commented on May 10, 2023

    @bwilkerson

    It seems reasonable to me.

  7. scheglov commented on May 10, 2023

    @scheglov

    FileState.referencingFiles is currently used to say "these files semantically depend on this file", so if this file changes, we need to reanalyze these files (transitively). I think non-selected URIs probably should not transitively affect files that contain them.

  8. DanTup commented on May 10, 2023

    @DanTup
    Member

    @scheglov would it be better to add another collection? Or have some flag against each to signify if they may affect analysis?

  9. scheglov commented on May 10, 2023

    @scheglov

    It seems that we need to know how the file is referenced, so the kind is better than a separate collection. Maybe somehow else, depends on for what else we need to use it.

  10. modified the milestones: v3.66.0, v3.68.0 on May 26, 2023
  11. modified the milestones: v3.68.0, v3.70.0 on Jun 28, 2023
  12. 1 remaining item

  13. added this to the v3.72.0 milestone on Jul 25, 2023
  14. modified the milestones: v3.72.0, v3.74.0 on Aug 29, 2023
  15. modified the milestones: v3.74.0, v3.76.0 on Sep 26, 2023
  16. modified the milestones: v3.76.0, v3.78.0 on Oct 30, 2023
  17. modified the milestones: v3.78.0, v3.80.0 on Nov 29, 2023
  18. modified the milestones: v3.80.0, v3.82.0 on Dec 21, 2023
  19. modified the milestones: v3.82.0, v3.84.0 on Jan 25, 2024
  20. modified the milestones: v3.84.0, On Deck on Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions