flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.99k stars 318 forks source link

Having open to Xcode / AS on non root flutter projects #3257

Open jaumard opened 5 years ago

jaumard commented 5 years ago

Basically I'm working on flutter plugins and it's a bit annoying to not be able to right click on the plugin to go to Xcode or AS.

capture d ecran 2019-03-06 a 14 46 19
jaumard commented 5 years ago

if I click on iOS folder I have the flutter menu but disabled ^^

capture d ecran 2019-03-06 a 14 50 58
jaumard commented 5 years ago

As a workaround we can navigate to the example/ios/Runner.xworkspace and the menu is working

capture d ecran 2019-03-06 a 14 52 18
pq commented 5 years ago

@jaumard: can add a screenshot of your project structure?

image

jaumard commented 5 years ago

Which screen on project structure ? this one @pq?

capture d ecran 2019-03-06 a 15 57 28
pq commented 5 years ago

Oh sorry, no. I mean the "Modules" one.

jaumard commented 5 years ago

No problem ^^ here it is

capture d ecran 2019-03-06 a 16 17 14
pq commented 5 years ago

Ok, this confirms what I thought. As a rule, things would work much better if each plugin you are working on was imported as its own module. Ideally we could do this for you (or offer to) when you open the "plugins" directory.

pq commented 5 years ago

@stevemessick : do you think this is the right approach? Alternatively, we could hack the Open actions but that seems a little hacky...

stevemessick commented 5 years ago

@pq Thanks for tracking down the root cause.

Unfortunately, each plugin needs to be opened as a top-level project. We have to do a lot of path traversal to support various functions, such as "Open for editing in Android Studio". Someday we'll revisit that code but I don't think it will be soon enough to help this case. If you want to keep working this way you can; some things won't work (like the suggestion below) but much will.

While this won't help for Xcode, you can enable an option (for each project) to allow editing of Android Java & Kotlin code in the same window as the Flutter code. You'll need to have the plugin open as a top-level project. (You might want to set the System Setting "Open project in new window".) Open the Flutter plugin preferences and set this checkmark, then restart:

Screen Shot 2019-03-13 at 10 39 34 AM

We don't enable it by default because most people don't want to wait for Gradle analysis. If you're wondering why we can't do that for Xcode, it would require us rewriting Xcode in IntelliJ (which isn't going to happen) or getting JetBrains to package their AppCode product as a plugin that we could add to Android Studio (or vice versa), which has only slightly better odds of happening.