Skip to content
This repository was archived by the owner on Mar 16, 2020. It is now read-only.

rename refactoring corrupts ~/.pub_cache #339

Closed
skybrian opened this issue Sep 20, 2015 · 7 comments
Closed

rename refactoring corrupts ~/.pub_cache #339

skybrian opened this issue Sep 20, 2015 · 7 comments
Milestone

Comments

@skybrian
Copy link

I tried renaming a variable named "type" to "tokenType". This showed a popup indicating that it was changing five files, and at least one of them was in ~/.pub_cache. Unfortunately I had no good way to stop it, and the dialog disappeared so I don't know which file it changed. It's unclear whether Command-Z undid the change in all files or just the one I'm in.

Until symlinks to the .pub_cache go away, I think we need to be more careful not to follow them when doing a refactoring. Also, it seems like touching any file outside the directory that the user has open in Atom (even via a symlink) is rather suspect. It should at least prompt the user for confirmation.

@devoncarew
Copy link
Contributor

Yeah, I think this is two issues. The atom plugin needs to do a better job of saying what'll be changed ahead of time, and the analysis server shouldn't rename things outside of the current project.

@bwilkerson @scheglov

@skybrian
Copy link
Author

Another issue: I don't know why it was modifying those files in the first place. If I use "Find References", it doesn't show any outside my project. So why did it pick these files up when doing a rename refactoring?

(Find references doesn't seem entirely reliable though; it returns different results depending on which files I have open.)

Until #339 is fixed, I don't think we know for certain that the Analyzer is being given the right files.

@skybrian
Copy link
Author

I take that back about confirmation. There is a dialog to confirm renames that effect multiple files. I must have been moving too quickly last time.

Here is another example: I am renaming a method named "skip" to "next". Here's the dialog:

Confirm rename in 4 files?
/Users/skybrian/projects/miniml/dart/lib/src/common/parser.dart
/Users/skybrian/projects/miniml/dart/lib/src/calc/parser.dart
/Users/skybrian/projects/miniml/dart/lib/src/miniml/parser.dart
/Users/skybrian/.pub-cache/hosted/pub.dartlang.org/test-0.12.4+7/lib/src/runner/engine.dart

I don't understand how the file in the "test" package could possibly match the query. I cancelled the rename and did a "Find References" search, and it doesn't show engine.dart.

It seems like rename refactorings are searching for references in a different way than "Find References"?

@skybrian
Copy link
Author

Oops, sorry. Confirmed that it still happens after restarting atom.

@skybrian skybrian reopened this Sep 20, 2015
@scheglov
Copy link

Does Atom plugin display potential references in "Find References"?

Rename refactorings search for and update both, but potential SourceEdit(s) have "id".

@devoncarew
Copy link
Contributor

Looking into this, I get references to the pub-cache for refactorings that do not return any edits with ids.

(It would be nice if there was a boolean flag in SourceEdit called something like potential - inferring that from the presence of the id is less clear.)

@devoncarew
Copy link
Contributor

Closing in favor of dart-lang/sdk#24420.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants