42 IntelliJ IDEA Tips and Tricks

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good morning really let me try again good morning I know we're in Norway but you can still say hello are you all awake then right I'll try and wake you up a little bit I got up at 5 just to make sure I'm awake for this so welcome to this intelligent trixx I'm overwhelmed by the amount of people that have shown up thank you very much hopefully you will learn something new today if you've ever seen any of these sessions that I do in the past there's going to be a lot of repeat stuff so if you have seen this go away now but don't give me a red card saying I didn't learn anything new also given that there's so many different people in the audience's with different levels etc it's very hard to make sure that everybody learned something so as I always say I set the bar for myself very low as long as you learn three new things I'm happy okay at that point you're also welcome to leave once you learn those new three things having said that how many of you actually use IntelliJ okay anybody here that is not using IntelliJ a couple of people right so my goal is that you don't walk out of here deciding to switch IDs if I do that then we've kind of failed having said that I also want to I rearranged this I've done this a little bit in the past I've rearranged it a little bit just to be more nervous and to add to that I've also decided to use IntelliJ 15 which isn't released yet it's in the AAP so you know if it crashes if I do something wrong and crashes I can blame the team not myself so having said that if you do see awkward things it's not me I promise you I'm using the latest EAP available I normally don't use the the white background I normally program in the dark background but for presentation reasons I like one I hope that you can more or less see the the font size there although we won't be really looking at much code itself before I start one thing this is the settings I'm I'm using a Mac as you can tell although I'm trying to get this to work on the I new iMac iPad pro they released so the keyboard mapping that I'm using is a 10.5 plus if you're not using that switch right now that's the one you should be using on OSX I'm also using another thing that is called presentation assist right under plugins if you go to browse browse repositories there's a plugin called presentation assist and what that does is that every time I type a key what happens is that it displays at the bottom there okay so that's very good for two reasons one presentation to when you're sitting with a colleague and they say what key did you press you say shut up look at the screen stop interrupting my flow when I type you can configure this to show basically two different keyboard mapping so I'm showing the 10.5 plus and on Windows I'm using default which is win linux so if you lose using wind linux you can see that in the brackets right so you can see ctrl alt s for what i just pressed there also there is if you come from windows when i press command n command o in the default keyboard mapping for windows that will be control in so every time i right oh you think n and that only works for commando but nonetheless think about it okay so let's start i want to show you a bunch of different things i'm going to show you some things around navigation will see refactoring will see code inspection in intellisense not in what yeah analysis working with data a whole bunch of things and hopefully you will pick up something new now anybody been using IntelliJ more than five years more than 10 9 and a half right 10 Wow okay 15 if you have leave seriously you probably know more than me so first we're going to start with a navigating to type right so commando I go to a type you'll know this I can write for example operation operation time interval and it takes me to operation time interval right that's nothing new oti also does the same thing so camel kinks completion takes me exactly to the to the to the type without me having to type all of that things and this works exactly the same way for files so shift command o is the same thing and if I write scheduler it takes me to files I can also do file paths so for example I could do rx and that would show me all of the folders right so you can also not only navigate to files you can also navigate to folders and then all of this of course also takes wild card so I could do something like that and it will show me all that or put this in the front and it will show me everything that is operation in the front and if it doesn't work don't blame me now also what you can do is if you go to a file for example you could do scheduler and then write 40 and what that does as you can imagine is take you to line 40 of that file ok so you can do that directly symbol lookup so that's type lookup and file lookup symbol lookup is is also efficient because it allows you to basically search for a symbol across the entire solution right so I can do for instance some float or I could do index and that will basically show me all of the different indexes that exist anywhere inside my entire project which is a pain a pain in the in the rear because you know there's a lot of indexes here so if I do for instance some float there's also a lot of some floats you can see that this is green I don't know if you can actually yeah you can see that it's green so that shows me the test ones so what happens if I want to go to some float but I know more or less where in what name space it is you can do namespace filtering so you can do for example OSC some float and that will take me to the type Oh s T which is operation some test and then to the met symbol only inside that so you can actually filter by name face okay how many of you knew that brilliant that's one okay cool yeah this is gonna be easy now I'm joking so if you don't want to use any of these symbol lookups to search for things you can do it the old-fashioned way and go to finding path which you would only do this if you're using an editor right so for instance I could say of some float and notice that inside IntelliJ 15 we already have a preview window here right so you don't actually have to navigate to it you can actually see it in the preview right without having to close the dialog box and invoke it now again don't search like that unless your life depends on it what else so double shift gives you search everywhere you know this okay so search everywhere is basically search for anything everywhere absolutely anything so I could do operation time interval again here and it will also show me operation time in there is a operation take time whatever and it will show me a type I can tap and go - well that's file right I can tap go to classes tab go to more tab again go to files and go through all of the different sections but it searches not only for types and files etc it searches anything so for instance if I say presentation assist you can see that it shows me for example plugins down here actions toggle presentation mode everything so things that you don't know where they are you can basically look them up in search everywhere search everywhere also allows you to do history so you can press bad a bad left arrow key and get history if you press right arrow key you just move forward okay so there's no history moving forward now you can use search everywhere basically for looking up types files etc we optimized it drastically in IntelliJ 14 so that basically gives you the same speed as looking up a type some people prefer to narrow it down to type I out of custom normally just use commando to look for types as you can see in 15 there there have been some issues in performance which we got to get back to right also what you can do here is if I do for example person debugger here you can see that or default you can see that I have the default a package wrong configuration right so I could actually hit enter here and run this without having to go to the mouse and hit it there if I press the shift you can see that the debug turns into a run okay so really you can use this for anything if you don't know where something is just look it up in search everywhere one thing that I try and recommend is when you're learning IntelliJ when you're using IntelliJ try and not use the mouse at all unplug it destroy it smash it just use the keyboard right and as you can see I'm not using a mouse here touch pad doesn't count and it's only for demo purposes but really pretty much we've designed IntelliJ so that anything you want you can pretty much do with the actual keyboard and not have to rely on the mouse so much now if you notice something here as I change types go to a bunch of different ones does anybody notice anything in my ID apart from its very small right now I'll give you a hint it's what it's shaking that's the screen of oh yeah well yeah that's synched yes and I'll tell you about that in a second no I don't have tabs you notice I don't have tabs I don't use tabs in fact what I'll show you with tabs I'll go to tabs and show you what I do with tabs I always switch them off right you don't need tabs trust me it's horrible so we have a bug reports in our we have bug reports that say where's my tabs gone yeah there's so there's bug reports that say if I open up 60 tabs they jump you don't open up 60 tabs I'm sorry you just don't do things like that okay so that will not be fixed hopefully really up you don't need tabs in IntelliJ only tabs tabs are probably the most inefficient way of navigation really they are so why do you want tabs open because if you have multiple tabs what you're going to end up doing is having to use the mouse to go back and forth through the tabs you can number them you can put mnemonics you can do whatever you want you can color code them no don't do that you know how to navigate with the types but more importantly if you if I double-click search everywhere you see what it shows up it says recent files by default shows recent files command E is your friend command E is recent files so it shows you the recent files you've been to if you hit command E enter it will swit toggle back and forth between the two files you've been to shift command he shows you recent edited files so you can pinpoint down to the actual files you've been editing command lift square brackets command write square brackets navigate back and forth through where you are on each of these windows you can also search if I go navigate to test I can search through that right just like the project window if I go to the project window which you get to by the way with command one open and close right I can also search here I can do extract delegate here I can search everywhere I don't need tabs just use the power of the navigation that IntelliJ gives you and don't take up all of that messy tabs in your ax in your workflow in your screen it really is horrible really I'm not passionate about tabs so one of the things that you were mentioning is on the project you can see that as I change files here for example operation preferences and there you go it well that's not part of the project but as I change you see that it syncs here now you can make this sync doesn't actually but it can sing so you can select Auto scroll to source or auto scroll from source and basically what this means is that when I change the source file it will scroll for me on the project window when I change from the project window to the source file it will also change I don't have auto scroll to source enabled I don't really like it I do have auto scroll from source so I always know where I am in the project window when I navigate to a different file if you're in the actual project window and you go and go for example to a type where is everything oh yeah you do have to expand this for it to actually work which is a major oh I'm in the wrong one operations oh that there you go so that's actual little bug I'm going to close this so it doesn't confuse me anymore for now right so operation timeout and I come here you can see that it doesn't scroll right I can hit escape and then focus on the actual browser hit command one again get out of the browser or hit f4 and open the window and get the cursor directly in there okay so my recommendation is do auto scroll to source but don't do auto scroll from source it works better and the flow is a little bit better any questions nope good seriously any questions okay are you are you actually learning something yes oh no okay good so right what else right so creating new files you never do this you never go file new no no you don't what you do is you come here and you press command and and from that you create the file right and you can say for example I don't know a package or whatever by the way don't ever do this either watch I don't come here and I say ah or let me do it outside of source so you see it so for example come here and I'm going to say directory ABC directory de F don't do that do you do that yes anybody now stop doing it if you do you do directory g h i j k l m n o p and it does it for you right and you can do the same with files so i can say for example file bla bla bla bla bla bla bla test exe and it will create it for me as well okay that's how you try and create files folder structures directories etc and if you're inside an actual file you can also access that new menu you just invoke it in a different keyboard combination and you can also create the new files directly from there right one thing that we've also added is is is where's my scratch files have you heard of scratch files scratch files are basically files that you get rid of after you've worked with them so they don't form part of the project sometimes you want to just open up a new file to do some HTML testing or something you can create a scratch file and then once you've done with it you just close it off and it goes away okay now you can see that I don't have a lot of real estate here right my window here is at the bottom if I bring up like for example I don't know let's say the the log or let's bring it up here you can see that I'm using the mouse nicely version control so a lot of times especially people that come from editors they come to intelligent they're like how the hell am I going to write code in that you don't write there's no real estate there you have to hide all the windows okay and you can hide all the windows with a quick shortcut shift command f12 and that basically goes back to what you had and what you didn't have and then you can also hide these icons here you see when I do shift command f12 this panels are still available I can hide these and they're gone as well right and then if I want to go back to the previous mode I was easy to get in and out I could do double click on the command key and also get the windows back let go and lose them if you don't like that what you can also do is enter what we call distraction-free mode which basically gets rid of absolutely everything and you just get the editor okay you can still access stuff but otherwise everything else is gone there's also another mode which is similar but it's called presentation mode the difference is that that is very much more for presentations that enlarge everything and make it big and as you can see it's so great that I never use it ah I don't know I just don't use it okay now working with a actual code let's go to outside of tests we don't like tests do we go away well by the way I said that you can do everything with the keyboard shortcuts in fact you can even resize windows without using the mouse okay so I'm here how'd you select code in IntelliJ come on people be interactive control W yes or command W no that closes and that's why we called it 10.5 plus because we pissed off a lot of Mac users so on Mac what you do is you press alt up and that selects the word and that's this is context-aware so now it selects the line and then it will select the method and then the class and then the entire outer class and then the entire package right and you could shrink as well if you're on if you place the cursor on an empty line you just press command up out up oh this is a sorry this is a let's try it on here and that selects the entire line if you want to move code you don't do a cut and paste right you actually use the functionality we have to move code around and place it in places that are awful and won't compile if by accident you do something like this control X and then you come down here and press control V instead of pressing control V you press control X again you've just lost your keyboard and your clipboard what you do is you do shift command V and you get your clipboard back okay you get all the entire clipboard history okay and then select it again and put it where it belongs if you want to delete a line just press control Y well it should come out Y if you want to duplicate around press control D okay so that's how you play move code around and don't don't do those sort of horrible copy/paste stuff things that sometimes people do ok we also introduced another thing in IntelliJ which is a support for multiple cursors so I can place the cursor here and then I can press another cursor here and I can press another cursor here and I can mess things up really badly okay now don't please use this for refactoring don't write there are many built-in refactoring tools but sometimes you need multiple cursors you also have the ability to select a word so I can if I place my cursor on scheduler keep pressing it and I get all of the instances of spread the scheduler and mess those up as well and you also have the ability to basically select all of the words scheduler yes but yeah but you should be able to do the refactoring in scope as well okay we'll see that when we get to refactoring so yeah also a control command it should be control command control command G will select all of the scheduler words okay and get multiple cursor there and of course you can also do a copy and a paste with multiple cursors as well okay now if you want to get the full power of ID IDs are editors like vim you can also install a plug-in which is called idea of M how many of you use it so idea of M gives you the the ability to basically Oh plugins and then go to install jetbrains plug-in idea of in right and now you get kind of the best of both worlds you get all of the navigation that is semantically aware of the project and then you also get all of the features that then provide you with the ability to work with actual text once you install it don't call us if you don't know how to exit because that tends to happen with vim also often people install it and they're like I can't type anywhere anymore in Maya in my ID I don't personally use it people do more or less they say it's it's okay if you want to clean up code so for instance let's go to let's go and find something that I could element at I think I messed this up recently anyway okay so look at this this is horrible code right that really looks horrible and if I just want to get the indentation right what I can do is basically just select that and then hit ctrl alt I to get the initation done if I want to reformat the entire code so I could just do you know be anywhere and then just to out command l and reformat the entire so again don't spend too much time reformatting code manually write the code clean up all of these do all of these do it so clean up code code clean up basically allows you to clean up the entire project without you having to do it one thing that we introduced and when you're doing code cleanup of course you need to define your code style so I can come for instance to Java here and define my code style which I can manage I can import export share between projects and if you know if you've really got nothing better to do in your life you can go through all of these options and define your different code styles the only thing that I do recommend and having come from dotnet and c-sharp I find it horrendous that I have to import every symbol manually in Java or that there's an import automatically and in fact Kevin was here last year giving a talk and he asked this question like you know why on Stack Overflow if you go and you say why in Java do you import each symbol manually explicitly and the top answers were any good IDE will take care of it for you which isn't the actual answer to the question right nobody knows well somebody knew it was called swing but apart from that let's forget it so what you can actually do here is say you know convert imports as soon as I have two or more imports convert them to import star and it will also do that for you while doing auto import or while doing code cleanup right now this is one way of defining all of this the other way that you could do it is you could basically this is something new that we've introduced in 15 you can select some code and I'll show you how to select it faster just go to the method name select it and the alt enter allows me to do adjust code styles right so I can hit enter and then I get this code style window and as I actually select things it shows me what it's going to look like and then I can apply that or I can save it so you know say setting code Styles in place based on a section of code do you like that yes but just continue to not show any emotion whatsoever we're all good we're all good it's it's really really really motivating me um so let's go back up here and you see what I can show you what do we have here okay um what do I have here right new Java class but I mean okay string string now you've got to forgive me I don't normally write too much Java I'm mostly caught in nowadays but anyway here's let's let's write some JSON we all love to write JSON right so here we go name sorry oh no did I get that oh okay that's cool now how many of you do that brilliant well then I'm not going to show you how to do it properly I mean if none of you do for that fine um the other way to do this is how many of you use language injections in IntelliJ so what you can do here is you can say alt enter and inject language and say JSON and now that string IntelliJ interprets it as JSON and I can come back here and JSON and I should be able to come back and get the JSON editor edit JSON and now here I can write JSON right and you can see that that's automatically being put out for me right how many of you knew that good you like good continue of course you can do this for other things as well so I can do HTML so I can come here and say in jag language reference HTML and there is also the ability to do it with you can also do regular expressions so let me go and say check visa so here for example I have regular expressions but for IntelliJ this is just a string I can just say inject language reference regular expression and now it will interpret that as regular expression and then I can also do check regular expression right so if I do that for instance or I can say it so this is a typical visa card that has to start with four so if I put a four there it validates it if I add another digit it doesn't okay so I'm that normally what you do is regular expressions you you search on Google and you paste because I made a promise to myself to go to my grave not learning regular expressions and I'm still hoping to stick by that so okay right so that's a little bit working with the editor etc let me show you some things around completion um so buffered oh let's say big mighty class okay so oh I love my little politically incorrect references here to countries and stuff I'm from Spain so I can criticize as much as I want Spain okay so here's a buffer new reader and let me show you how you could basically do this if you say bufferedreader reader equals new and now get completion and that gives you basically everything there is right you don't use completion as much you should use smart completion smart completion is going to limit it down to what actually makes sense yeah if I have a bufferedreader only certain things I can create instances off right and also I'll this is already done but I'll remove this for you so that you can see make sure that when you do for example file new reader often also people lose this and they're like ooh how do I get access to that information you don't delete this and do that again you can press command P to get parameter info right and in fact here also what you could do is well now I'll show that insect Farida so I say abc.txt that gives you alt to enter to adminsection handler to it so to kind of let IntelliJ work the completion for you okay so that's smart completion or smart typing then you also have the ability to for example if I do single turn you can import single turn strangle tune of singleton single turn so you can do import imports also you can do doubles or double or second completion so for instance let's say I have a string lines I could do reader and if I invoke it again it will say reader dot read line which you wouldn't do like that but anyway it allows you to basically chain methods and smartly allow you to do second completion so that's invoking the same completion you just invoke invoke it a second time also here let me see if we for example going back to this buffer reader a new buffered reader and does this take but it doesn't it takes a so if I press every one I'll show you in a second okay what else hippie completion so how many of you have heard of hippie completion right so let's go to uh where was that that was in person I think so hippie completion if I type T and then press hippie completion it will loop through all of the things that match that T right so if I write teller it basically is going to do the same thing right it's going to go through the each of the different ones and and that's with alt / okay of course there's also templates so if you you're familiar with templates you go to live edits live templates and here you can basically create your own set of templates so for cart Liam for Java for anything you want others so PSM vm t PS vm is the one that spits out the public static void method these are placeholders and has a special meaning but you can add as many placeholders here as you want so you can see that basically each of these are placeholders and variables you can edit these variables you can instantiate them you can give them values that are already being instantiated you can apply macros to it all of these things and then you can spit all this out with templates so command J and that gives you templates right now in addition to templates you also have surround templates so for instance if I have this bufferedreader or let's go down to here over here so I don't know I want to wrap this inside a a try-catch for whatever reason right so what I could do is invoke the surround with and then say try-catch and that would wrap that inside this try/catch okay so it's the basic same concept of live templates but with surround templates and now there's also another thing that we introduced which is called postfix completion so for instance let's go ahead and create a person a person person which you could do with introduce variable I know oh here's another completion shift command enter right did you see what happened shift command enter so I inserted a semicolon using 3 keyboard Q keys instead of 1 which is also a note that actually does more things so for example if person equal parent if person equals null it will complete the statement as well right the semicolon thing you can also fix if you don't want to you can use language such as JavaScript which semicolons are optional then you can go to hacker news and argue about when they're optional so let's say I just did if person equals new whatever but I forgot to do the if person is not do this so post fake completion allows me to call it in reverse so I can just say not null and then call it in reverse did you see that so I said person instead of saying oh I forgot to write if it's not null I can just invoke postfix completion and it will do it for me okay are you still picking things up yes good okay right now a lot of these things are also available for different languages so for instance I can go to Emmet here and this is HTML I could say for example I have a paragraph here we also have already now it automatically changes so you don't have to do that but if I say for instance I'm going to wrap this Dib inside a div I can select this div and then also invoke surround template and say surround it with another div so and a lot of these functionalities working in different places in in HTML of course we also have Emmet how many of you use M it right so if I want to do for example ul and then Li what I can do is just press ctrl D a bunch of times or I can use what's called like the CSS completion so let's say I want a div and I call it my dear and then inside this I have ul and then I have Li times 5 hit tab and I get that same thing out put it right and it works with 50 as well and it works with 500 as well and it works with 5000 as well no it doesn't okay yeah so most of the things that I show are available for different types of languages and in terms of the completion if you're doing JavaScript so we provide support for JavaScript with the node.js plugin IntelliJ so you get all of the completion for angularjs you get it for all these different things now there are times sometimes that you don't want the you don't want us to provide completion for libraries or files that are included in the path for example the node modules subfolders sometimes doesn't need it and what you can do is go to JavaScript libraries don't I have the thing you installed or I can show it differently javascript libraries and then add these as external and then that way it tells IntelliJ not to worry about this in terms of analysis and things like that so that's what the external ones are the ones that you add here are the ones that it will invoke for completion etc okay so again I'm focusing a little bit on intelligent given what conference we are and sorry Java what conference we are but a lot of the functionality is pretty much available for for other things now let me switch over and show you a little bit of like navigation analysis so for example if I go to operation a time interval from here I can for instance go to command B or command view and that will take me to the super method etc then let's say for instance I'm I don't know let's go up here and what do we have here observable right so alt command B that will give me all of the different implementations observable again here on all the windows basically you can search in IntelliJ you don't have to do any manual scrolling and you know there's a lot of different ways to navigate back and forth so you can go to superclass you can go to the type class etc so in observable for instance there's also something that people really I find that they use which is the type hierarchy so that gives you a hierarchy of the actual type if you go to a method for instance let's go to lift on the method you can also get type hierarchy which is a shift command H so that gives you the same thing but for method hierarchies okay sometimes when you're in the actual a file you can press command f12 to give you a a pop-up of the structure right which is a which is a floating thing so I can say for instance long count and go directly to that without having to do the symbol lookup of course you can always have that presence as well by pressing command 7 so that's also just basically docked or I normally use it pop-up I never really have a dog there okay now as you can see here in IntelliJ one of the things we have oh by the way this thing here is very annoying you see this navigation bar it's great because I can select it and I can actually create new files and everything but again it takes up valuable state space so what you do is to switch it off and if you ever want it just invoke it and then you can just invoke it from here and from there you can continue to create files and everything okay I just saw that and I forgot to tell you about it so inspections you can see that you know one of the things that IntelliJ does is tell you a warning about all of these different types of inspections that you have and if you go to inspections here and if you know how to type you see that we have a whole bunch of different inspections and you can switch these on and off a lot of times when people come to IntelliJ they like stop babysitting me stop telling me dis shouldn't be done oh that shouldn't be done I like my coat to throw annul exceptions right so you can switch these off and you can customize them and you can adapt them to different projects and you can add to these obviously as well you can add to these in in you know creating plugins and I'll show you in a different way now as well but basically all of these you can switch on and off you can set the severity level you can define the scope where it's applicable etc and these now show up individually here if you right-click and select go to next problem it will show you all the hints tips suggestions etc if you just say high-priority problems it will only navigate to the next actual error what IntelliJ considers an error so when you use the the next highlighted arrow next previous highlighted error that will only go through errors it won't go through suggestion hints etc so you don't you can also run inspection so you can just say run run inspections and you know basically run the entire where is it run the entire inspection inspect code and what that will do is basically run the inspect code for you across the entire project apart from seeing it and individual level but often you might want to have one of these inspections off but you might want to invoke it and you can do that by saying run inspection by name and then there you type the name of the inspection and then you can say for example question but no question but a questionable name and what that will do is analyze what it thinks are weird names that you probably shouldn't be naming your variables like a b c okay so even though you have those inspections off you can actually run them manually if you want okay now as i said you can also extend this you can extend this via plugins but there's also another feature that rarely is used which is called structural search and replace how many you've heard of that so what structural search and replace does is basically allow you to search for code based on a template so it's kind of like a powerful regular expression combined with placeholders for live templates etc and what I'm basically doing here is I'm defining a template where I say try and find all places in my code that have empty catch exception blocks which we all know isn't the greatest thing and each of these you can then edit the variables and define different values and say you know what type does it inherit from etc so if I hit find on this you can see that it'll go throughout my code and says look here you have that issue but also notice that this is underlined right and if I click on it it says to me bad exception handling and also I get the little light bulb if I hit alt enter it says replaced with do something because effectively what I'm doing is just eating exceptions and that's not the best thing so how have I incorporated that custom analysis if you go back to the inspections and you do structural search you can see that you can actually add these patterns and set the severity levels right so if I set this pattern I also can provide a replace template and that replace template effectively IntelliJ interprets as an alt enter quick as an intention so what this means is that you can create your own structural search that looks through your codebase that looks for potential issues that your code has and find common problems okay so you get new people joining the team then that may be juniors they don't know about certain patterns they don't want it you don't want them to do that a lot of this can be caught using automated systems without having to do manual code reviews okay and of course it's always good to teach people so in addition to saying you know replace with this say replace with this come and ask me why I'm telling you this joke not working actually in resharper we have a when you hit alt enter we have a very cool feature which says why is resharper suggesting this and then when you hit that it goes to a wiki page and it tells us why like because of this and this and this we don't have that in IntelliJ yet okay now beyond kind of like the inspections what you can also do is let me show you J unit so here there's a couple of other kind of like interesting things that you can do if I go for example to comparison failure and I select expected there's an analyze menu which I found in a lot of people don't use and there is analyze data flow to here and from here and basically what that is saying to you is analyzing where the variables are being read where the variable that you're on is being set whether it's for method whether it's for property whether it's for a variable it analyzes that for you and shows you all of the different places where this is being read and being set and that's very good to kind of understand the flow that's going on the analyze menu of course has other things like the dependency matrix that basically gives you a nice beautiful dependency matrix and analyzes the entire project for you and then you can select see all of the different dependencies any potential cycles will users are etc and there's also a plug-in written by bars one of our colleagues which is called the a metrics reloaded right and you can download this as a plugin and then if you do calculate metrics it basically provides you with a whole bunch of metrics that you can calculate so it's got a it's got a set of predefined ones and you can click the box and select your own metrics define your own kind of values and then hit run so let's say for example J unit testing metrics hit OK and then that will run some metrics on the on the project and show me like package metrics module metrics project metrics etc and there's a whole bunch of different metrics that that supports you can install that as I said it's called browse repositories and it's called Matrix Reloaded there you go okay how many of you use that right go so uh how many of you work with databases right how many of those are MongoDB when I said databases some people don't consider database but I'm not right so we also have support for basically sequel stuff right uh in in databases so if I click over here to let me open this up intelligent code samples so query completion for instance here right I'm not judging anyone for putting sequel statements in strings right so let's just put that aside and pretend we're not talking about that but if you do these kind of things there is completion you can get all of that hooked up then you can basically come here and hit Alta enter and say run query in console and that will run the query in console for you and say to you that the library is used incorrectly and blow up for me if the first time fails just do it again so you get all of this information here so you know we provide good support and if I click here and say controls f6 renamed to not a resource you can get basically factoring across your entire code base and across the database okay so use the built in tools that we provide for that kind of support with databases there's that this is we actually created a new product out of this which has a very weird name which is o XD B II which won't be the final name hopefully and that basically gives you all of the database functionality in a simpler IDE okay working with version control some quick tips and tricks there how many of you use git the majority of people use git right so we support all of the different version controls but let me switch back a second some I'm not going to go through all of the things that we support in in version control but just some things you might not be aware of if you come here and select the version control you can see that you have a log and it represents all of the different check-ins etc I'm using git here you can select two different things press control D and see differences on those two commits you can actually also for instance if you switch on annotate you get annotations of who made changes etc here so I can bring this down and let's say for instance I come here and that's a annotation here I can right click here and say copy revision number and then select that revision number put it here and it will show me that exact revision number in the in the actual log right eye and you can say I'm biased or what I came from visual studio I was really reluctant to using integration inside tools for many years I refuse to do it with IntelliJ I kept dropping back to the command line but at some point get up and I have to say that in general I'm pleased with it you have all of the commits messagebox so for example I can come here and say random nonsense and then hit commit here you can do like a you know the commit you can run reformat code rearrange code optimizing ports do all of the code analysis check to do etc do uploads all of these things and then you can do a commit and push create patch etc so all of this is possible you can we've even added the feature that during the commit you can do a diff and during the diff diff you can even edit the files without having to switch out of the context of that dialog directly in that dialog to do editing then of course with the with the log here you can we also have support for cherry-picking and a whole bunch of things but this is kind of specific to get so I don't want to delve too much into that okay well let me just show you some things with the debugging code that you might not very much be aware of so here I have a person debugger right so here we go okay so here I have Java 8 lots of lambdas looks beautiful in five years we'll be maintaining that stuff and I've got a list of people etc so if I set for instance a breakpoint here and if I hit debug well you know what's going to happen but before I do that right click here how many of you have ever right clicked on that okay and clicked on more substantially whew um so if you click on more you get a whole bunch of options so you can like set up breakpoint conditionally you can log messages to console.log evaluated expressions you know all of these different things you can create groups of breakpoints enable those breakpoints at a group level disable them in a group level a whole bunch of different things that you can do there then what you can also do is if I come here and see if I set a breakpoint we've got a new feature it says what do you want to break on do you want to break on the entire line or do you want to break on individual lambda expressions there right Wow first sign of the motion six minutes left to the end of the talk thank you at least I feel a little bit better about myself and you can actually come here as well and do run and debug right we've got the little gutter thing so if you hit gutter here and I start to debug you can see that it D bugs everything if I do a step into so let's do this again if I step into you can see that I'm stepping into the different lambdas right and also notice I don't know if you have noticed that you get the inline variable very inline values right so you don't actually have to do hover over or anything like that it already prints it out there for you okay so those are some of the things and then of course you can also do things like I don't know let's come here and let's force until they're well okay let me run this again don't know if you're aware of this one for Ron so right click here and we can come to person list and we can see all of these different person lists and we can right click on this and say show referring objects and it shows all of the objects that are referring to that so a bunch of things that often I find that people don't really use in in the debugger that are also available ok there is also the ability to right-click and say drop frame so sometimes you've step one step too far you can say drop frame and drop that immediate frame that you've been executing we also have I'm not going to show but you also can now fully do evaluation of lambda expressions with code completion when you do evaluate expression you know you get all of the code completion anything you can anything you want there and list of people you get all of that you can even evaluate lambda expressions there so use some of those features that that we provide ok I I'm in terms of refactoring you notice that I didn't really mention much because basically my only comment there is you know first see what intelligent provides you right first take a look at what it provides you and then if it really doesn't and then you looked up the help and everything it says no there is no way to do it then what you do is try and do refactoring manually but otherwise most of the things are available and what we also have is to basically press ctrl T look at the refactor menu see what's there if it's not there ask us if we say no then do manual refactoring there's support for like um you know we've even got the the lambda stuff now for Java 8 so for example if I come here sample and one so you can collect convert for loops to collections we just alt enter now about that kind of lambda refactoring but what I wanted to show is that things are context aware so if I write context here a B C D F 10 right and if I hit refactor this or if I do extract variable you can see that it extracts the entire screen the string but if I select the 10 and I do extract variable it does a different thing it extracts the integer so be aware that some of the things are context aware when you're doing refactoring unfortunately within resharper it is but in IntelliJ it isn't ctrl T doesn't limit your it offers you everything and then if you try it in that context and it's not possible it says it's not possible in resharper we actually limit it to what exactly can be done in that context okay and last before we finish off let me just mention some things go Gradle and maven we have support the only issue I sometimes find is with the refreshing of the dependencies that's a that's a often an issue but what you can do is normal normally if you just go to Gradle window that this is an issue that oh the bits native in maven project do refresh or hit download and that normally takes care of things we do have some tools if your die hard terminal person you can get terminal alt F 12 you can have multiple tabs in the terminal so all of that is there there's also the rest test restful web service which allows you to basically do any calls to any endpoint HTTP endpoints do get post put delete cookies response all of these different things are available from there when when you're doing working with version control you could normally press control V to get a quick list of menu options which are things that you normally work with when you're doing version control these quick lists are actually customizable sorry you can actually create your own quick lists if you go to preferences and go to quick list I can create my own quick lists and inside those add elements and then I can go to key map and then look up my actual quick list and also assign a menu shortcut to it right so you can create your own little menus with all of the little things that you want yourself and then use those one thing that you do if you're especially if you're doing like pair programming or you're working with other people sometimes you switch machines and if the keyboard bindings that you have don't coincide with the other ones you don't go through preferences we've got a quick switch menu which always remains the same independently of the keyboard binding control tilde and that allows you to quickly switch things so I can say keymap and then say for example Emacs right and quickly without any more dialogues it switches the the keyboard binding and it does that for a bunch of other things like color scheme dark color default etc and a lot of times you've noticed that I've used this keyboard combination shift command a remember that one right that is when you don't know the keyboard binding for something you can look it up by name so rename and it will invoke it it's basically a action lookup and it also sometimes says the the quick shortcut key for it so for example refactor you can see that it shows you the keyboard shortcut for it so it's a good way to look things up and also if you don't remember it just do it so I say for example structurally search and I invoke structure e search okay so structurally right so remember that keyboard shortcut there's also think here called the help menu I know nobody ever goes to it and there's the default key map reference which gives you one of these and we've got a whole bunch printed at the booth so if you want one come and pick it up and there's this other thing here which I promise you that probably no one has ever gone to which is called I don't even know what it's called yet productivity guide how many of you have seen that right you probably imagine it's going to go to a website no it opens up a dialog box that shows you a lot of the things that I've been showing you and it all tells you how many times you've used it and when you last used it right so for instance I can come here and say 79 smart type completion it explains to you what that is it shows you how to use it it tells you when you used it and when you last use it right I could have just started with that and then you can have all left so but not everything is there okay and one thing that I promise not to show because they said don't show it it's still experimental but I'm going to show it anyway is how many of you know about the registry in IntelliJ mmm so if you do shift command a type registry this secret dialog box opens up and this is like low-level settings that support don't want you to mess with right because if you start to touch these things things might go wrong one thing I think we blogged about this already is the zero latency typing which is a new feature that we've been working on IntelliJ 15 hopefully it will make it which basically reduces the typing latency that you've had or experience sometimes even more by using certain different mechanisms for locking the canvas etc there's a blog post about it recently my colleague did you can go read it so this is how you can switch it on and off but it's experimental okay and that was very very hidden okay so with that we're more or less done time is up as it says here in red so if you do have any questions I'll be happy to answer them and I'll also be at the booth the rest of the day thank you
Info
Channel: IntelliJ IDEA by JetBrains
Views: 312,418
Rating: 4.9392056 out of 5
Keywords: IntelliJ IDEA (Software)
Id: eq3KiAH4IBI
Channel Id: undefined
Length: 60min 11sec (3611 seconds)
Published: Fri Oct 23 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.