VS Code Flutter shortcuts equivalent to Android Studio Flutter - android-studio

I am looking for a few things to improve my productivity, Android Studio has these features and it really sped up my work, if you know any of these please share.
Ctrl+Shift+Space equivalent in VS Code Flutter. What it did in Android Studio was auto complete a statement. For example if I typed in if and then hit Ctrl+Shift+Space, the if condition code block would be completed for me automatically with () and {} after it, with putting the cursor within the condition.
Code snippets for things like for loops. On Android Studio you could type in iter and then Tab, it would create for (var _ in ) {} and automatically jump to both variables to fill their names on two Enter keystrokes.
These were great for me, please share if these exist in VS Code, as I understand it is supposed to be superior.

You should install dart extension for VSCode.
In order to prioritize the extension snippets and have these ones for the first suggestion, go to File/Settings/Text Editor/Suggestions and set Snippet Suggestions to top. Now it looks like

Related

Android Studio -- code completion order screwy?

Can anybody tell me if there's a way to modify Android Studio's presentation order for code completion?
Writing Dart / Flutter code and whenever I want to print() something to the console, the print() function is second in the list (behind Icons.print, of all freaking things) and I am constantly forgetting and having to undo and step down one place in the list.
It's terribly inconvenient and frustrating. There is another example that constantly drives me batty too, but I cannot remember what it is right now. Would be wonderful if there were a way to modify this in some way.
Thank you in advance, for saving my sanity!

visual layout editor does not allow drag&drop

I'am a newby in android studio and learning a lot, but now have a problem where i cannot seem to find the answer to.
In android studio you can visualy drag&drop your screen.
I have seen it can do al lot (although you sometimes need the xml) but for me it is not working at all.
I mean i cannot drag&drop any widgets on the screen at all.
Tried changing the theme: no help (really tried a lot of them)
Tried a complete new project: same story
Tried other APK verion: same story
Tried Invalidatd caches / restart: no help
Even with a new project (EmptyActivity) it add's a android.support.v4.widget.NestedScrollView and then gives error's on that
(Failed to find style 'coordinatorLayoutStyle' in current theme).
It also gives an error on layout_height/layout_with not being there. But they are there for each widget.
Please do not missunderstand: when i execute the project i runs just fine (both on phone and emulator) but the visual builder for the screen.....:-(
Does somebody knows how to solve this.
If more info is needed please ask.
Any help is more than welcome.
There are several things that could be causing this:
Your caches could be messed up. Try going to
File > Invalidate Caches / Restart ... (I know that you already tried this, but posting for future views.)
Also, make sure that you don't have Drag-n-Drop with ALT pressed only checked in your Settings (Appearance & Behavior - Appearance).
Finally, in a default project created in Android Studio, there are two XML files created for each layout. For example, content_main.xml is embedded within activity_main.xml. Make sure that you are using content_main.xml for your design work.
In the end i fixed it by changing the SDK version in de gradle file.
still do not understand why it was wrong as studio genereded it that way but now it works so.... for me: case closed.

How to debug Android Studio Project (using NDK and JNI) line by line to see the workflow?

I was using Visual Studio and it's Debug mechanism is really useful to me. With many header and C files in 1 project, just a simple F10 it could take me a tour around from the beginning of the main() function so that I could see the sequence of the code being executed.
Now I'm jumping into Android Studio and start with a project using NDK, JNI (this project for example: https://github.com/googlesamples/android-ndk/tree/master/gles3jni), it makes me confused because there're many .java files and others C++ (native code) files and I don't know which code from which file is executed first and how it goes on.
My Question is: I'm looking for a way to debug in Android Studio line by line from the beginning to see its workflow likes how Visual Studio did but all I got from searching is how to start from a breakpoint when debugging.
I have tried putting the break point in the onCreate() method of the launcher activity and use F8 to Step Over and F7 to Step Into but it doesn't work as i expect. It keeps taking me to the super class Activity.java and GLSurafaceView.java instead of taking me to the C++ code. Is there any way to do so in Android Studio and how to do it?
I have tried with others project but the problem still remain the same. Hope someone could help.
This won't happen. Your app (the Java boilerplate code) is set to respond to many system events that happen when the user works with the app and the device on which the app is installed. If your c++ code is a piece of monolythic straightforward algorithm, you can set s breakpoint in the beginning and really follow step by step. But with Android Studio, even this process is not as easy as with Vusial Studio. To begin with, it's always remote debugging, dependent on delicate communication protocols.
This said, you can try to set up Microsoft Visual Studio as your IDE for debugging native Android code. It is surprisingly robust, and also may be more familiar to you.
Since you've asked about Android Studio, I will answer about that - I am not familiar with Visual Studio for Android and perhaps it is better for what you are asking.
In Android studio such debugging is very hard - although some people said they managed to get it to work, I wasn't able to. Especially in a complex environment. So, what I'm doing is extensive logging, with as many details as possible, and visual debugging - put some text view on the screen and update it with the info you need. This could be quite powerful in some cases. Or, alternatively, make some changes in your ui or your scene as a result of certain conditions you define - so you could see the visual effect. Again, much less useful than debugging, but can still be quite powerful.

VSCode Code Folding

I am trying to install or update a setting that allows me to minimize and maximize code blocks within VS Code. Similar to below and/or like Visual Studio:
https://www.flickr.com/photos/50988329#N02/25504022561/in/dateposted-public/
Just in case the image link doesn't work, I am speaking about the plus and minus signs/icons that you see next to the line numbers in Visual Studio.
The February Update (0.10.10) for VSCode just added support for code folding.
Try downloading that and giving it a try. You can enable or disable code folding with the editor.folding setting.

Why do Visual Studio 2012 and ReSharper 7 forget to display Intellisense tooltips?

I noticed a strange behaviour in my VS2012 installation. I use VS2012 Pro and ReSharper 7. Intellisense is just not showing code suggestions anymore. I found a few related questions in my research but they always had a slightly different setup going and none could solve my problem:
Intellisense is working but, it's not showing the tooltip about selected member functions/Properties anymore.
If I take a look at the C# Text Editor Settings in
Tools -> Options -> Text Editor -> C# -> General
Most of the times the two necessary boxes Auto List Members and Parameter Information are selected. However, code suggestions in Intellisense don't work. Sometimes, when I look at the described settings, they are unselected.
Selecting them will make code suggestions work as in VS2010 but, only once. When I check the settings afterwards, they are most likely still selected, but code suggestions are not working anymore.
Some people suggested deleting the %AppData%\Roaming\Microsoft\VisualStudio\11.0 Folder, which did not work for me. I also tried to reset all changes, which also didn't help at all.
Tools -> Import and Export Settings -> Reset
What in the world could make Visual Studio to just forget its settings and trigger such an irrational behavior?
-edit-
I display the code suggestions by pressing CTRL+Alt+Space. However, I have to press that shortcut every time I want to see the suggestions. It has to be possible to automatically display them every time, when possible?
I was having a similar problem, but I kept overlooking one small ReSharper Intellisense setting. I would double check that you have Symbol completion on in
ReSharper | Options | Intellisense | Completion Characters
Check out the answer with screenshots.
Thanks for all the tips, I figured out what I had missing:
I had to enable "Completion Appearance" -> "Show Summary".
I also accepted Anthonys answer because he linked to a detailed post with screenshots that shows all steps necessary. (Although the thing I had missing is not mentioned there)
ReSharper uses it's own code suggestions that override Visual Studio ones, that could be the reason why the ones in the Visual Studio settings may be disabled. Please check ReSharper options at ReSharper -> Options -> Environment -> IntelliSense. Maybe they are turned off there. If your ReSharper options are turned on but you still have no intellisense, then please ReSharper's support at http://www.jetbrains.com/support/

Resources