Webstorm with Dart - how do I rename a package and still have the debugger work?

If I do the following with Webstorm 2017.1:

 

1. Create a new project named foobar1. Dart Project -> Simple Angular Example

2. run pub get

3. verify dartium / works

4. edit pubspec.yaml and rename package name to foobar2

At this point the debugger no longer works as it's trying to reference files in an old foobar1 directory.

I've tried to edit the .idea/workspace.xml and replace all foobar1 with foobar2 but this seems to exacerbate things.

 

Is there a clean way to do this?

 

 

 

0
3 comments

>edit pubspec.yaml and rename package name to foobar2

>At this point the debugger no longer works as it's trying to reference files in an old foobar1 directory.

Directory/WebStorm project name has no relation to package name. Once you update the package name in pubspec.yaml, make sure to update it accordingly everywhere in your code and then run 'pub get' to fix the links. This should be enough

0
Avatar
Permanently deleted user

Thanks for the explanation. It turns out this is due to my misunderstanding but exacerbated somewhat by the code inspection becoming out of date/stale (showing errors where there aren't any, or failing to show errors where there are some).

Is there a way to force a reload? I have toyed with with hitting build from the pubspec.yaml and also inspecting code from the project context menu, but neither of these reliably seems to update (often it will update, eventually)

So far I have been closing and reloading WebStorm but this is not an ideal workflow.

 

 

0

>Is there a way to force a reload?

 

In Dart Analysis tool window, press 'Restart Dart Analysis Server' button

0

Please sign in to leave a comment.