You press OK, give it a name like “Don’t use Hungarian notation”, press OK, and it’s going to be flagged as a warning. You add a search template, and by default, it’s going to take the last structural search that you wrote. To do that, first, you check the checkbox next to it to make sure it’s activated, and then you press the plus sign on the bottom-right corner. What this does is it’s going to run a structural search all the time and flag it as a warning if something matches. In the Inspections, you’re going to see under “General” a “Structural search inspection”. What you can do is create some sort of an automatic link check from this, and the way it works is that you go into your “Settings” and look in the “Inspections”. It’s really looking only for fields, which is pretty nifty.īut even cooler than that, let’s say that you removed everything, but now you don’t want another engineer to add new ones. There won’t be any false positive because that is not the way clear text searches. If I press Find now, I find every field that starts with the letter m in my app. That’s probably not the best RegExp, but I know that this one does work. In our case, if we want to know if it’s a Hungarian notation, it should start with the letter m and then there should be an uppercase letter after that and pretty much whatever after that: m*. Go to FieldName, so every variable defined here ends up on this string. The field name is what we are looking for. We have variables so $Class$ would be the class name and $FieldType$ would be an int, for example. If I do a Find now, it’s finding every field. Let’s start with structural search and replace. It’s using something else in Android Studio without necessarily leaving your IDE. External tools: a way to have tools that are external to Android Studio.Live templates: a means to generate code faster.Structural search and replace: a way to inspect your code, reason about your code and find interesting patterns. My name is Phil, and today we will look at three different features from Android Studio that you might not know about: We will bend structural search and replace to our will, develop our own Live Templates, force Android Studio to interact with external tools and we will take a look at lesser known refactorings that you should be using.īecause remember, a productive developer is a happy developer! In this 360AnDev talk, we will take a detailed look at powerful but lesser known features. However, it seems like every blog post or video rehashes the same basic tricks. Mastering your IDE is a great way to become more productive.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |