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!
Related
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
Been getting into Android Studio (and Android development in general) lately, mostly a personal challenge to make a modern version of an app my mum loves but hasn't been updated in ages. But my life story isn't the point, and that's not just because it's not that interesting.
The actual question:
Is there a way to make Android Studio do automatic folding for block comments (i.e. /* to */) in Kotlin files? In Settings > Editor > Code Folding there's options for documentation (in general) and multiline comments for C or Java, but no settings specific to Kotlin, and just one for Android in general (which has nothing to do with comments).
The reasoning: Because I'm still pretty new at this, there's a lot of things I've tried but haven't worked, and comment out instead of deleting because I still might be able to learn something from them later. There's also some big blocks of logging code for debugging that are great when I'm trying to debug but in the way (given I usually write them in the middle of classes or methods) when I'm not, so I comment them out. It's just annoying having to fold several sections of comments whenever I open a file.
The "well duh" solution?: I could set them as documentation comments, which would hopefully get automatically folded, but if I start writing documentation (like I really should get around to) they'll get mixed in and that would be annoying.
What I've tried so far: Going through all the settings with a fine tooth comb (and I'll freely admit I could have gone over something obvious) and searched for plugins for code folding, about the only one I could find is https://plugins.jetbrains.com/plugin/12007-foldingplus which doesn't seem to do anything about this particular problem.
Can anyone help me out here, other than maybe "be less of a newbie in general"?
With Android Studio Arctic Fox I found that if you highlight a region that has the comments in question, you can right-click on it and one of the options will be Folding. From the expanded options select Fold Selection / Remove Region and the selected comments will fold.
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.
The current Android Studio version has inbuilt auto save. Which means if you close a file, it will automatically save the changes.
This is inconvenient, it means when experimenting with code, all changes need to be noted as there's no option to have a dialog requesting to save changes on closing a tab or the project, as in many other ides.
According to documentation IntelliJ IDEA 15.0 Help/Saving and Reverting Changes:
When does IntelliJ IDEA auto save changed files?
Autosave is initiated by:
Compiling a project, a module or a class
Starting a run/debug configuration
Performing a version control operation such as pull, commit, push, etc.
Closing a file in the editor
Closing a project
Quitting the IDE
.../...
Note that those are optional autosave triggers, and you cannot turn off autosave completely.
These are the auto save settings that can be changed in Android Studio:
TLDR
Is there any work around to circumvent this autosave?
These questions are related, but do not acknowledge that this intended behaviour of the ide and are rather asking for fixes within the ide.
Related:
How to disable Auto Save save in Android Studio
How turn off autosave in Android Studio?
If you want to experiment, use the revert button at the top right. This works especially well if you are using a VCS (like git...) as it will revert to the last committed version. And since commits are still manual, this will soon replace your traditional save.
If you are not using a VCS the point in time to which it reverts is a little more arbitrary, but in my experience it takes a pretty good guess. If that doesn't suffice, you can use the history button next to the revert button, which keeps track of every version IntelliJ saved, and you can then go back to any point in time you like. :)
Android Studio as a software is very much based on the JetBrains software solutions such as IntelliJ (used for Java) and PHPStorm (used for PHP, as its name shows).
As a concept in itself, JetBrains have implemented this feature and as a company believe that it's much more efficient and productive than manual save. Hence, there is no way to disable this behavior or enable any confirmations in Android Studio either.
Taken from JetBrains FAQ for IntelliJ:
Because IntelliJ IDEA has the ability to change so many files simultaneously in large refactoring actions, and change them without ever opening them, single file saves don't make very much sense. In recognition of this, IntelliJ IDEA reserves the right to save any of your files literally whenever it wishes. It's actually quite nice to never have to worry about your file's save statuses, once you get used to it.
Having said that, and encountering this issue myself too as a developer, I agree that it would be a good idea if the Manual Save feature were enabled by the Android Engineers (or JetBrains themselves). After all it is up to the developer to choose whether he needs this feature or not.
To Jetbrain's defence, they have a very good Undo function through their Ctrl + Z shortcut keys, letting the developer go back many steps and find where a certain error has occured.
All IntelliJ based products nowadays save any opened or modified files whenever they wish - read this as "immediately".
I would suggest you give up on trying to disable it (trust me, it's not possible to hack it) and either change your work flow or work on copies of the files.
As background I should mention that I am a plugins author for IntelliJ (with 3 publicly released plugins in the JetBrains repository) and thus have a reasonable understanding of the internal IntelliJ architecture.
I have to write a small script to deploy a patch for our Application. The patch
will replace a couple of files in the application.I decided to depploy the patch using Applescript. The files to be copied are quite large and it takes some time for the files to be copied. I wanted to know if there is any way I can get a dialog box which doesn't block the execution of the script so that I can display some message like Updating.. etc while the patch is applied and then close the dialog box after wards.
Thanks
Shivaprasad
There's a scripting addition called Akua Sweets (oldy but goody) that has a display progress command. Get it at osaxen.com. it's in the 'most popular' section at the top of the page.
edit
Oh, bugger, that's only for OS9. It was really useful back in the day, I remember using it a lot (of course everything took a lot longer in those days so progress bars were more in demand).
another edit
You got me inspired, there's a couple of scripts I use that need progress bars, so I went looking and found this scripting addition at http://osaxen.com/files/extrasuites1.1.html
and again
here's a basic tutorial for how to do it in interface builder. I think that's probably the right way to do it.
I myself ran into the same problem. Unfortunately applescript doesn't provide an easy way of implementing a progress bar.
I ended up using the stop loop example found here to build an application. This guy has a bunch of applescript studio xcode projects to download and mess around with. It's some really great sample code if you aren't too familiar with applescript studio.