More IntelliJ IDEA Tips and Tricks by Trisha Gee

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Applause] [Music] hello I didn't understand any of that hi I'm Trisha so yes I live in Spain as you can tell by my Spanish accent no I'm actually English and I live in Spain and I thought that I didn't understand any Spanish until I came here and I'm like I do not understand any Russian at all so yes so I'm gonna talk to you in English and and oh I'm gonna get my slides up so you can see what I'm gonna talk about and but it doesn't really matter too much that that I'm about what I'm gonna be saying because what I'm gonna be doing is demonstrating a lot of stuff on the screen so feel free to ignore what I'm actually saying and just look at just look at what I'm showing on the screen in this talk I'm gonna be demonstrating IntelliJ IDEA and this is a really nice opportunity for me because what I usually do is I go to big Java conferences and I talk to Java developers about how to do Java stuff incidentally showing some IntelliJ IDEA features but at a JetBrains event I can actually just focus entirely on the IntelliJ IDEA features and and not just not just have to teach the Java stuff I'm who is a Java developer quite a lot of you most of you good and there are tips in here which apply to all of the IDE s but obviously there's a bit of a focus on the Java side of stuff because that's that's largely what I do should we just get started yeah let's just get started um when you're opening IntelliJ IDEA oh I first want to ask you a question this talk is not terribly structured by the way here's you mind houses who's using java 12 no one good excellent in production no java eleven oh good in production don't be silly ten Java ten okay umm Java nine you shouldn't be using nine or ten you should be using eleven job eight goods Java 7 okay Java 6 are you Android yeah okay fine anything earlier than Java 6 oh thank god oh really okay you poor poor thing all right I'm glad most of you on Java 8 because this is kind of more geared to people like you let's get started um when you start IntelliJ IDEA this is usually the sort of thing that you see and so what we've got is we have our project window on the left hand side we have our navigation bar at the top we have our tabs at the top we have breadcrumbs down here at the bottom and then we have like tool buttons along the side which is how like lots of people get around the IDE especially when they get started we're not going to use any of that because we're pros so the first thing we do is go into professional mode so I'm going to turn off all of those things and I'm going to turn them off using find action so if you pick no other tip out of this talk and the thing you should pick up is find action is your go-to for like everything or search everywhere it's the same thing so as I do stuff you should see at the bottom the the thing I'm doing and the keyboard shortcut that you're going to use to do it let's do it again so that comes up now now I can see all of you lot at the back going I can't see it I'm gonna see if I can actually move that to the top would that be helpful if I move it to the top all right let's see if I can do that so this is a plug-in called presentation assistants and then I should be able to do nothing with it apparently all plugins color scheme no that's not what I want I want it at the top okay all right forget what I just said at the top of the screen you will see the keyboard shortcuts that I'm using you'll see it for Mac slash for the Mac and for Windows slash Linux and so now I'm gonna use find action to turn off all the all the stuff I don't want to see on the screen so I don't want to see two of our buttons and take those off I don't want to see editor tabs oh now I see why I don't have presentation assistant at the top and turn that off turn it off turn it off oh my god like what is wrong with this this is the live demo thing let's try it again tab top I do this all the time why is it not working can someone help me No all right fine we won't do that then let's turn off the navigation bar navigation navigation bar that's better so that's gone away that was at the top and let's maximize the current the screen what is that what is going on does someone like and then Russian hackers trying to control on my laptop that was going on I okay I think it's because oh my god had he buy me a new laptop bread crumbs let's turn off the breadcrumbs editor breadcrumbs don't show the breadcrumbs and the tab none I know why because it needs to be tabbed on there we go fine I still can't do oh my god this is like two tips in and you haven't seen anything right let's just carry on with something that works and fine so given that I've just got rid of all of it all of the navigation bars all of the buttons you're thinking well some of you are thinking I know all this stuff I'm advanced you can go to sleep that's fine but some of you are thinking how do I get around now so what you're going to do is you're going to do things like control E which will give up your recent files so you can navigate really easily to any of the recent files that you've navigated to you can use things like alt and Oh Alton seven no open nine for your version control window you can use Alton seven for structure as you saw and you can use Oh and one to get to the project window and if you don't remember any of these keyboard shortcuts what you use is use ctrl + E and then you type in the window that you want and so you can open up the Gradle window for example so you don't need to remember half of these keyboard shortcuts you just open up this and say which window do I want I want me yes a version control and then you can open that up then you can use the keyboard shortcut that isn't working because I probably forgot what it is and if someone wants to remind me what it is that be really good which is it's not supposed to be control shift page down it's supposed to be I know why it is a surface tada and shift control f12 just maximizes the editor so this is the window we want to be looking at when we're coding we don't want any of the nonsense around the outsides we just want to focus on just the editor itself I'm so the other way to navigate around is we can navigate directly to a class by doing something like extract I can't see anything now I've moved all at the top so extract functional parameter for example I can navigate directly to to a class and you'll notice that I don't have to type the whole thing I don't have to type this I can I can use camel case so I can use the beginnings of all the of all the words and I can also use partial names so if I type switch I can get to generate switch branches from there I can also use a similar thing to do navigate to file so if I'm looking for a like not a class but a file I can use ctrl shift + n to get to a file and so then I can get to for example my maven file and I can use ctrl shift alt + n to navigate to a symbol like let's say get ID and if I want to I can limit the name space of those results by saying ordered or for example don't get ID and then I can navigate directly to a method so that's kind of super useful if you know there's a method in the code base which does the thing that you want and you can just jump directly to that mess it don't go to the project window and scroll down and find the class and navigate to the method just go straight to that method and right what else can we do so we can do things like I've lost the plot now completely right so all of this was like I was doing ctrl n to get to class ctrl shift and to get to files but you can see the search box is the same search box I can actually just tab through all of those things so I can search for all pluses files symbols actions actions is what I was using to turn off things and all will show you everything which includes things like run configurations so I could look for things like where I I ran something recently so if I don't know where something is what I'm gonna do or I don't know what I'm looking for I double tap shift and I get search everywhere I can type something in there and I will be given a whole bunch of options for for what that thing is that I'm looking for okay and also there's things there's commands in here so I could do slash editor for example and it will give me all of the top hits to do with the editor other commands and things like deeper inspections intentions so I even get help and sort of auto completion even when I'm searching for stuff in IntelliJ IDEA I'm and then if the thing that I'm looking for isn't it isn't here or isn't easily accessible so I find myself looking for the Gradle window a lot because I haven't assigned a keyboard shortcut to it if I type Gradle I get loads of options in here so what I could do if I want to make sure Gradle is always the top hit I can go to the key map in settings let's go to the key map I can look for Gradle so this is my Gradle window and I can add an abbreviation so I could say something like G R D and then when I search for g rd grader will be my top hit because that's my shortcut set of characters i signed to to that thing I discovered that last week and I've been using it ever since because it's just so useful all right so let's do a bit more navigation let's find ourselves a class so if I'm in a class one of the things that I quite often do because I do test-driven development or at least I do automated testing of my stuff if I want to navigate between my class and the test for the class quite a lot so I'm going to use shift ctrl + T to navigate to the test for a class and I can use the same key combination to navigate back to the thing that I'm testing and so I'm going to use that a lot for testing another way that I can navigate forwards and backwards is this is where my fingers know what to do and I don't know what the shortcut is so ctrl Alt + left arrow for back and ctrl Alt + right arrow for forwards so if I want to go back through my history that's what I'm going to do there's a new feature which I found super useful which is kind of similar to that which is ctrl shift + E and that will give me all my recent locations so instead of having to think of a class or a method or a file I can actually just go okay I was in this bit of the code you can see these these are all in the same class they're all in Java eight inspections but they're all different locations within that class so I can jump to a specific location that I've been to recently so I think that's really useful especially if you have realistic code bases with very large classes and you just want to go to the bit that you you were recently editing alright let's write some code let us let's create a class where are we so here I'm gonna use alt and insert to create a new Java class I'm gonna call this test to delete otherwise I end up with loads of things in here I can't remember if I'm supposed to delete them or not and then of course we're going to use live templates so if you're going to do a typical hello world class you do public static void main tab and it types all of that stuff for you and then I'm going to say sout to do system two out and then hello and and then it's just a few key key characters to just a few key presses to write a typical hello world application and there's an argument here that you know Java is a little bit heavy on the boilerplate because there to write all of that just to output hello but you know that's what IntelliJ IDEA is there for so that it can make our lives a lot easier for us and I won't complain about Java being heavy on boilerplate and I know the answer is Kotlin but I'm still a Java developer and right so that's live templates so live templates mean that we don't have to write a lot of stuff which is nice and you can also use a combination of live templates refactoring postfix completion to do all of the typing for you so for example let's see we could have let's put something here which is like name can refactor this to name so I don't have to type most of that stuff and then let's say I want to do something like what might I want to do I'd say I might want to test that name is not null and then it will just write me and if not null if statement so that's nice and then I can just print out the name and then if I do cell V I get an option to output the variable and I'm gonna use name so that's really cool of course you shouldn't be using system to out dot print land to do your logging he is supposed to use a logger but you know you sometimes do these things and so that is writing code and so we had a bit postfix completion there we can also use postfix completion for things like let's do another name something and I can just assign that to a variable by doing that and then it will just do that stuff for me so I quite like postfix completion because it allows you to keep typing forwards instead of going back and retyping stuff at the beginning so it's a nice way of always thinking forwards and staying in the flow as you're coding and okay what else can we do oh yes so again this you probably know code completion because you probably use it all the time so we have obviously we have we get code completion without even doing anything we just type the full stop and we get completion if we do if we do ctrl + space we get basic completion if we do ctrl shift in space we get smart type so this is more useful inside an if so let's say we do it an if statement and this is my favorite keyboard shortcut along with the other 25 favorite keyboard shortcuts that I've got and complete statement so I typed if I press shift ctrl + Enter and it filled in all of the rest of the if for me so I don't have to do any of the braces stuff and now I don't remember what I was going to do uh I was doing oh yes so let's say I'm doing something I want to do a check on something so when I do smart completion here it will just give me a list of all the methods which return boolean because I'm inside and if so I'm probably going to be doing some sort of boolean check so that's the difference between basic completion which of course we won't call stupid completion we'll call it basic completion and smart completion and then there's like another type of completion so we've got hippy completion which allows you to do and let me see you can start something like you can start something and if you do alt and /u basically cycle through all of the things which match what you want and then you just basically keep going there it includes and includes things like the actual text itself so that's quite an interesting use case as well now I used my favorite shortcut another favorite shortcut yes I have many favorites ctrl why - just like delete the line because I was in the middle of doing something and I wasn't gonna speak really fast because I was going to take my time while I explained all of this stuff but I get really excited about all of these things so I get I speak a bit faster than I should do I'm sorry right you can do things so you can move code around while you're while you're doing stuff so for example you can move statements around if you do move statement up you see what it did is it moved all over the whole if statement just by me being on the top line of the if statement and that was using your shift control up and down so that would just move a whole statement around if I want to I can move the just a line which makes no sense because it's then incorrect but you can do that if you want to it might make more sense in in a text file for example and then you can also do ctrl W to kind of expand your selection for for what you want to move around so I can jump that whole method up and down and I can do control shift W to reduce the scope of my selection all the way down to where I started you don't have to memorize all of these tips and shortcuts by the way if you come out of here learning one thing I'm happy with that so I'm just gonna bombard you with as many things as possible and if you just sit there and go okay that's the one I want that's fine then you can go to sleep I'm okay with that right and parameter information parameter hints I've got so many things to show I've got like a list of 500 things let's look at parameter hints when I worked at my last organization I worked only I worked in the code base which was let's call it a realistic code base where we had a lot of parameters like we had a lot of methods that took parameters like this where you would pass in like nulls and integers and string values and boolean x' and stuff and you had no idea what those values represented now parameter hints have probably been they've been in the IDE for a while now so you've probably all seen them a bunch of times but I still find them extremely useful for not very readable code like this but sometimes you do find that this is not super useful so for example generate service name with a parameter name hint of and that's not enormous ly helpful so I can say do not show hints for current method and and I can get the rid of hints for the methods that I'm not interested in obviously I can turn hints off across the codebase if I want to but I generally tend to prefer to tweak the methods which I don't need the hints for it just cleans up the makes it more readable and parameter name hints came in for enumerations recently I don't think it was the last this release I think it's the one before that oh yeah and something new I discovered the other day let's have a look for and you can so normally if I've got a string or a value and I type I was gonna do it now let me show you the setting before I show you what it does it is what's it where is it smart keys and smart keys surround selection on typing quote or brace so if you turn that on which I've just turned on then when I've got something selected and I type like a quote it will put the quote around the thing I selected or if I do if I type a brace it'll put parameters around a parenthesis around it as well so I don't have to like go to the beginning of the line open that my parentheses go to the end of the line and close my parentheses I can just select what I want and and then do that like that which is I think that's really cool right language injections talking about strings oh no while we're in strings let's talk about strings so you probably know this already I can obviously break a string and IntelliJ will just automatically figure out where to put where to close the strings and put the pluses and I can reformat that so that my alignment doesn't go mental and I can do control shift now what is it control shift J to rejoin lines as well if I want to which can be useful particularly if you've got big long strings like this what's kind of sometimes more useful for this sort of functionality is language injection so in this case what we've got here our big long string is actually something which means something in this case our big long string is a JSON string so what I can do is I can alt enter inside this and I can inject language or reference and I'm going to inject JSON and then it's going yes and then it works so then I get syntax highlighting for JSON inside my string so now I can see my key value pairs which can be extremely useful in this case because now you can see all right that's really a value not a key that's right yes a key or a value so you can get some syntax highlighting you can do the same thing for example with sequel so I put sequel there and then I'm going to get syntax highlighting on my sequel string instead of just getting simple string highlighting and then I can do things like see I even get code completion inside my string for my sequel if I've actually figured if I've actually tied tied myself I've actually told IntelliJ IDEA where my database is and what the schema is it can use that to give me code completion inside the inside the SQL and I can even I think will it let me do this I can I should be able to run that okay I haven't configured that but I'm then if I've configured my sequel dialect and where it's connected to I can select that and run that sequel command in the sequel console so I IntelliJ doesn't just treat it like just a Java string it knows it has meaning it's a sequel string and it's gate can be run against the database one more thing around strings you could put emojis and stuff if you want to I'm I'm too old for emojis but you know people like emojis that's great you could put them in anywhere apparently like that you can put them into like commit messages and everything I didn't I never even thought about putting things into a commit message but you can put like good job smiley face into a commit message which is cool and one last thing around here is let's say I copy this line obviously I can paste by doing ctrl V that's fine but I can also if I've got anything on the clipboard which I don't and one of the things I really like about IntelliJ especially when you start like copying a bunch of different things and you think oh I wanted that thing that was on my clipboard but I've just copied over the thing by copied something else I just shift ctrl + V and it gives me when it goes away it gives me my clipboard history so I can paste any of the last I think by default is like 5 items so any of the last 5 things I've copied I can paste that whenever I want to I usually configure this to be at least 20 items because 5 is nowhere near enough but once you start doing this especially when you're doing string manipulation is it's super helpful um right oh one more thing on string type stuff is HTML so as you've probably seen if you already use HTML editing you get simultaneous tag editing so if I if I change one the other one changes as well that's great that's very cool actually because when I was young I used to HTML editing in a text editor and you never know whether your stuff is closed off whether your tags are closed correctly or not and IntelliJ just does that for you one of the other things I like is multiple cursors and see if I've got the right keyboard combination for this yes so if I do shipped alt and use the mouse which of course we shouldn't be using the mouse because we're in IntelliJ IDEA and we should be using the keyboard for everything but I can have multiple cursors and I can change things in multiple places at once I find this useful for text files XML files configuration files where there's often a lot of things repeated and you can also if the lines are underneath each other there's a magic keyboard combination for this which is where is it I don't remember what it is oh yes and double tap control and then bring your mouse bring your arrow key down and then you can do a basic list of common columns select and then edit things there and one other thing here is let's get rid of my multiple cursors if this works mf3 no it doesn't work hmm I've used the wrong thing Oh No and shift ctrl alt and J I can select all instances of a specific symbol inside my file so again this is kind of this can be useful I wouldn't do this inside a Java file because I would usually use refactoring if I was going to rename something but inside text files I might want to say you know say I don't want to use TDS anymore I want to use divs everywhere so it could be useful for that sort of thing right now let's get onto refactorings because refactoring is my favorite activity in my favorite set of features and we have let's look at invert boolean so here's showed some of the refactorings for Java 8 already which is a bit of a shame because I could basically in fact I have to spend 15 minutes just talking about Java 8 refactorings in the past but we're just going to spend a tiny amount of time on that because we've already seen some of that so you can do this also as you as you know there's like millions of refactorings you can do an IntelliJ IDEA you could do things like alt enter will allow you to invert your if condition if you want to so you can flip things around taking away or not or inserting and not let's see if it'll do it invert that's fine and one of the things that I've noticed with recent versions of Java if you do it with optional for example it won't just put a knot in front of it it will genuinely invert it so instead of saying optional dot is present it'll say it will use optional dot is empty instead so if there's like a reverse method it will use the reverse method when you invert the boolean so it's quite useful for from a readability point of view okay we have got let's look at some of the Java eight refactorings if you're using Java eight you've probably seen a bunch of these anyway for example we already saw in the last talk a bunch of stuff about going to and from for loops to stream operations oh and this is a good opportunity to show something else so I like my stream operations all lined up with the dots one above another I don't want to see one method here one method here one method here so I can show you another trick by if I go let's select this let me do alt enter on this it says adjust code style settings it will show me just the code style settings that apply to this block of code now if you're like me and you've tried to apply a consistent style to your code and you open up the code style settings in the big dialog you're like there's 50,000 different settings here and I don't know which magic incantation I need this will show you just the ones you want so here if I go to wrapping embraces Unchained method calls for for streams what I want is I want to say wrap always and then it will line up my stream operation very nicely and so I can I can either like revert that if that's not I want what I want or I can save it I get my nicely lined up a stream operation so I I like this especially when I'm migrating code from old java to java 8 or beyond because like it gives me much better visibility over what's happening in there in the stream operations so yeah so we can see you've seen this before probably you can check you can automatically convert to Count's you can automatically convert to some operations you can automatically convert so you can even get really complicated operations like this and just replace it with a really complicated collect operation instead I really I used these heavily when I was moving to Java 8 because I didn't really understand what filter Map Reduce meant and this is a really good way of migrating my brain so that's the Java 8 ones there's a whole bunch of stuff around optional optional of course came in Java 8 but has been updated in Java 9 Java 10 Java 11 so that's always getting new methods and IntelliJ IDE is always giving us new suggestions to say you could be using optional in a much better way if you want to so for example let's see there's a whole new load of methods that you can use you can replace it with if present and it will simplify code I mean this is this is what you know IntelliJ does it just says you know you've written loads of long code would you like me to condense it into one line of code instead and you say yes please and and that's what you do so use alt enter to to make everything much much simpler so we have those obviously for Java 8 Java 9 Java 10 I'm going to show you Java 12 because all of you on Java 6 are going please don't show us Java 12 it's so far in the future I can't even imagine so the Java 12 feature is switch expressions are kind of switch statements are kind of nasty right or like wind shouldn't really be using switches anyway they do look like code from the 1980s and in Java 12 they've been simplified to switch expressions and so you get way less code you don't have nasty breaks you don't have like nasty nasty anything and you get to use the lambda so and of course IntelliJ there just does that for you so you're like okay yes please use the shiny new features of Java so that I don't have to learn what they are so that's Java 12 you should migrate now from six to seven - eight - nine - ten no just go straight from go from eight straight to eleven just forget all the ones in the middle and what else how much time have we got and what do I really want to show I mean you probably know the basic refactorings like I already showed a bit of extract variable what is this and so you know you can do extract variable to give me so I can reduce duplication I can do extract method - what if we go here so yes so I could do something like extract this into a method ctrl alt M I'm gonna say yeah let's call it get strings why not and it will put things into a new method and yeah so you can use you can use all the amazing refactorings to simplify your code if you've got big methods like this you should be thinking about breaking them down into smaller methods you can do things like extract functional parameter I'm so this it's one thing to use lambda expressions when you're using something like the streams API is another thing to try and introduce methods that take lambda expressions in your code base because it's a different way of thinking for a lot of us Java developers you can do this with IntelliJ IDEA so let's say in this method we wanted this I plus string bit to be a lambda expression which is passed in by the method that calls us so he can use ctrl shift alt P handy and then IntelliJ goes which of these magic functional and functional interfaces do you want to use and I'm like okay I should probably use the I use by function because that's the one that comes in the JDK and then it does all the complicated generic stuff that Java eight lambdas need because Java is interesting and then it gives you the lambda expression up here and applies it here so in this case you'd probably look at this example and go I don't think I want to pass a lambda expression in there but you can use this refactoring to stop playing with your code and see like which bits might benefit from from moving code around the same way we do with extract method extract variable and so on and so forth right we have ten minutes yes okay what can I show you in ten minutes oh oh my goodness we've got data analysis we've got working with tests we got the debugger we've got databases version control version control is my favorite along with all my other favorites all right I'm gonna take a vote who wants to do data flow analysis and there's two you've got two options data flow analysis or version control data flow analysis that's a lot of you version control off for goodness sake that's like a 50/50 split all right let's all right two minutes on data flow analysis in two minutes on version control all right data flow analysis so this was mentioned in the last talk as well this was mentioned quite a lot in the last talk and one of the things that you can do is you can use the magic incantation of I always get this wrong it is shift control and pee on windows twice all right and that gives you the result of the data flow analysis here it goes okay well date get month could be any integer value you're like okay fine but then later on after you've gone through a few different if statements you say okay now tell me what could and I said good to get months wasn't it what could date get month be down here so I do control shift P twice says it's an INT and it's in the range of 1 or 3 through 12 and you're like oh that's quite useful and then down here you can do the same thing and it says it's it's too basically it has no range it is 2 at that point in time so you can use this to help you debug you can use this to help you reason about how you're going to write your your flow control stuff I find that super useful and I think there was some other stuff about data flow analysis and again this is a bit like this is the same as the inspection stuff so you know IntelliJ will just say I don't think you should be doing this it's it's not sensible it's just doesn't make any sense at this point in time so let's see oh yeah so this is some of the examples we saw earlier that these conditions can all are always true so you just say okay then I'm not going to do it and so yeah all this says like the results here is always false this result is always false and so you can use these warnings they're not all magic fixes they're just warnings for you to go oh okay I probably have a logical error in my code or I probably wrote my tests wrong or I'm gonna have to go away and think about this a bit more this is not necessarily a magic go away and fix this get the IntelliJ to fix my code for me thing all right I was two minutes on data flow analysis right version control how many of you are using a command line tool to work with get like all of you right you're doing it wrong no you're not you can do what you like whatever tool works for you and I I think quite visually so I use IntelliJ IDEA and version control stuff quite a lot now obviously you know that you can do ctrl + K to commit and obviously you know your commit dialog it shows you all of the things that you can you can commit you're going to write yourself a little message which is descriptive and explains what you did not just a staff it doesn't work nothing works and did you know that you get the list of your previous commit messages here so you can reuse previous commit messages if you want to and obviously you can see at the bottom you can see add if you of each of your individual files partial commits which I originally said partial Kitsap commits to a stupid idea that's a good way to commit something that doesn't compile and then I use them all the time so you can do things like say write I'm not going to I'm not going to commit the import I'm just going to commit the changes and it's difficult see in this resolution which is an example of something you should never do don't like not commit the import that would be not that's not going to work but you know you can just partially commit some things in a file so say I'm not gonna I'm not gonna put that change in amend commit I use this all the time never use a men's commit if you've already pushed because that's not a good idea but if you did something which is the sort of thing that I do I've changed three files I commit it I'm like oh no but I really just need to have this one change in there as well make one more change amend commit and it will amend your previous local commit if you've pushed it then don't bother because it's just game over so that's one thing and I use the log all the time this is not a great example because I don't really have a lot of branches but I used the log to do things like I can create myself a branch new branch at any point in my history I can call it something like new branch generally by default IntelliJ IDEA is going to check out that new branch for me but I don't have to I could just say right create me a new branch there and it shows it shows it here and when you're on the when you're on the log it shows you which branches that particular commit is in so that's kind of useful you have done here you have a branches list so I can do things like I can check out any of the branches that I want easily and I can I can merge and I can rebase which I'm gonna say I don't have enough time to merge and rebase right now but just because I'm really worried if I do like a live rebase everything is gonna mess up really badly maybe I could do a live merge I'm not really sure it's a it's a bit risky I'll be honest um but you can do merging and rebasing and cherry picking I quite often use cherry picking for my demo code because want like this stuff from here over here and a lot of the complicated stuff that you want to do in in get in particular is available inside IntelliJ IDEA and it's caught for me I find it quite nice to be able to visually see is that branch actually hanging off the commit I want it to be hanging off did that branch really merge or did a tree base so was i rebasing the wrong branch onto the wrong branch because I've done that before too so visually this is very useful and of course you can just look at just the branches that you want if you want to and you can look at specific users and things like that but in this code base that's not useful because the specific users are Mee Mee Mee Mee Mee let's see if Haddie's in here are you in here no okay anyway it was his code he should be in here somewhere um that's VC yes five minutes left we did we did inspections we did data flow we did a little bit of working with tests we haven't done debugging much should we do a bit of debugging or do you want me to me to take Tommy to take five minutes for questions debugging huh okay let's show debugging No so debugging going wrong and okay okay so basic debugging it there's some really cool stuff in debugging obviously and I can never remember the keyboard shortcuts for debug for some reason so let's debug it I I tend to use the run inside the context of things so I use shift ctrl + D which I can't remember if I've mapped that myself anyway so I'll open that in debug mode obviously so I placed a breakpoint I placed a breakpoint by using the mouse which you shouldn't do there is a keyboard shortcut for that and and then it will stop here and I can see here I can see my variables I can add a new watch in here if I want to so let's see maybe I want to look at order item and it will show me what auto item looks like and then I look at that and I say it's difficult to see if this text isn't but order item when I'm looking at it it actually just shows me that the default to string method for order item which is that the pointer I guess and that's not very useful so what I might want to do is I might want to create a custom data type renderer so for order type I'm going to use I want to show you I don't know oh that's a really bad example actually let's do customer product let's do product so if I put my goodness see it always goes wrong at the wrong time control f2 to stop everything go back let's start this again I'm gonna add a watch for product products because it doesn't give me much useful information obviously I can do what I normally do is open it up and look at all the values inside product that's fine but for a summary version I might want to see some specific field so I'm going to view as create a new data type renderer use the following expression of this dot for example title maybe and then title is null let's use ID I just saw that that's fine get rid of that change this one to ID and so now when I'm looking at product I can see the product ID here so I see like some summary information 0 minutes left and and of course that you've already seen that you can see in this kind of you can see the the basic version the basic information as you're debugging but this custom view will appear up here so it's a really good way to sort of annotate your debugger with more additional information I am out of time one more thing I do want to say even though out of time is you can also add a condition on here so I might want to add a condition of only stop on this breakpoint if the product is not equal to null for example and then that allows me not to have to stop at that breakpoint every single time even when it's values I don't about I'm right so we're out of time I'm going to be hanging out round by the booth so you can come and ask me questions anytime you want to but basically thank you very much you've been an amazing audience [Applause] [Music] [Applause]
Info
Channel: JetBrainsTV
Views: 28,298
Rating: 4.8964882 out of 5
Keywords: JetBrains, software development, developer tools, programming, developer, intellij idea, intellij, jetbrains idea, intellij tips and tricks, intellij idea tips and tricks, java ide, ide for java, professional java ide
Id: 9AMcN-wkspU
Channel Id: undefined
Length: 46min 9sec (2769 seconds)
Published: Fri Apr 26 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.