 Yes, good morning everyone! Are you awake? Okay, yeah, it is the first talk in the morning, it is always a little bit sleepy. So, welcome to my talk. Thanks for coming. This talk is going to be about RubyMind, about RubyMind different tips and tricks and some productivity hints, and I hope you will learn something new today. But before we can start, I would ask you to do something for me. So, please stand up. Okay, thank you. So, please raise both your hands if you use RubyMind. Okay, please just stay. Please raise both your hands if you don't use RubyMind. No, no, no, just stay with your hands, yeah? Okay, let's raise your hand a bit. Okay, yeah, morning routine, thanks a lot. So, please sit down. I think that now we are ready to start. So, my name is Tatyana, I'm a product marketing manager of RubyMind. I'm a part of RubyMind team at JetBrains, but I'm not a developer. I used to be a developer 10 years ago, I used to be a Ruby Rails developer when Rails was really young, but now I'm not. If something is not working today, don't blame me. Okay, I'm joking. I'm a RubyMind part of RubyMind team, so of course you can blame me, but I will blame the team, the developers. Okay, so, let's start. When talking about ID, the first thing you start with is actually making your environment looking good for you and making your environment comfortable as possible to your eyes and fingers. So, we will start with some tips in making your ID a little bit more suitable for your needs. And we will start with the color scheme. Oh, sorry. It's my rescue time. So, let's go ahead. I want to use this very quick switcher and change a look and feel. For example, to duck one. Or you can switch it back to default one. And just want to ask you which is better for you, for this presentation, for today. Duck one? Duck one? Okay. Okay, let it be duck. So, another thing that sometimes it's useful when you're working in a pair for something or making presentations. Or a quick way to switch the color. And the same way you can switch the key map. I'm using this one. But, of course, you can use another one. We have some predefined ones like TextMate, Emacs, and some others. Again, for example, if you're a pair programming with someone who uses another key map, it is the best way to switch between them. You don't need to go to preferences to search for key maps there. Just make it in one click. But, still, if you want to go to preferences and, for example, adjust the key map for your needs, you can do it here. Go to key map in preferences. You can see all the comments here. You can change the shortcuts. And you can even search by Kstroke. And then change it. So you can adjust any predefined key map for your habits and for things that you are used to. Okay, so let's go back. And, of course, you can also adjust all the colors. I mean that we can switch these predefined color schemes. But, again, you can save all the colors for everything you need to. You can change it. Adjust. So, just in case you need it. And another thing I want to show you that, from my point of view, is quite useful. It is a list of plugins. You can see that we have a lot of them. Most of them are bundled with RubyMind, so they are pre-installed. But if you need something more from RubyMind, you can always go to the list of plugins and install something new. For example, for this presentation, I'm using this one, Presentation Assisted Plugin. It shows all the shortcuts I use at the bottom. So, here it is. And to install new one, you just need to go to this Install JetBrains plugins, or even to install, not, luckily, it's from JetBrains, but from the community. Okay, so, you can also adjust the look and feel of the window. You can see that I have, in my view, I have a project tree at the left, usually, I have an editor at the right. You can also switch all the tool bar, switch on navigation bar, status bar, and here the small icon that helps you to navigate among all the tool windows. You can have these tool window icons here, but you can hide them as well. And another interesting tip here is that you can see these numbers in the name and the title of every tool window, and this number means that you can choose command this number to open this tool window, like command one to open project view and to hide it. Or, for example, command four to open around window and to hide it. So, and if you're open too many, for example, tool windows, a lot of them, and you're a little bit lost and you want to go back to your code, the best way to do is to use shift command F12. This will hide all the tool windows and just go back to editor for you. So, it's a good way to stay focused on your code without having all these tool window icons actually open. So, I hide them. I don't need them. I navigate with a keyboard and I don't need to see all of them all the time. If you want something even more to be even more focused on your code, you can go to these view mode and to destruction free mode and it looks like that. Nothing, just code. Or you can exit this destruction view mode and, for example, enter presentation mode and it will look like that. Sometimes I use it when I'm coding a lot, when I have live coding during the presentation, but today I won't use it because I want to show you all the windows and all the ID, actually we want code. So, I will exit it. Okay, so something that was about setting up your environments and now let's talk a little bit more about navigation through your code. Maybe the most common way to navigate the most simple one is to see this project tree, project structure and nothing special here. I hope you know that you can search here. Just start typing and you will search for this tree, but the things that I want to show you is this small icon in the settings and these two options. It is auto scroll to source and auto scroll from source. By the way, who uses that? Whoa, one person. Okay. So, if you switch auto scroll to source, it means that when just going through your tree, you will also open all the files in the editor, but frankly speaking, I don't like it. I don't think it's very useful. What I do like, it's another one. It is auto scroll from source and this one means that when switching through your tabs, through your code, you will still be aware where you are in your project when the project structure is opened. Sometimes it's good. For example, when you are debugging and digging in your code, sometimes you really need to know where you are when you are closed. From my point of view, it's a good option. Okay. So, it's about project view. Another thing is that if you are doing Rails, and I think that most of you are doing Rails, because we are at RailsConf, you can also switch this project view. Don't blame me. Please blame developers. Just a moment. Let's try to fix it on the fly. But I will definitely add a bug report. Sorry for that. Okay. So, you can use this Rails view and this view means that you will see the structure of your code, not at the folders and files structure, but by means of models, views, and controllers. So, what you can see here is all the controllers in one place. And, for example, under each controller you can see other actions. And under each, actually, you will see all the corresponding views. So, kind of Rails view. And, of course, you can navigate from here as well. Let's switch to views and et cetera. But if you still need, for example, I prefer Rails view, but sometimes I still need to get back to project structure view, to folders and files structure. The best way to do this is not to switch this project view, actually, but to use navigation bar. So, you can see that here on the top I have navigation bar, and I can really easily, very, very easy navigate through all the folders and I can, again, just start typing here and it understands snake case and, of course, camel case. So, it's a good way to navigate through your files and folders if you still need them without opening project, project review at the left. Or, staying on the Rails view there. Okay, but I have a question, one question. Do you feel comfortable with this view or something is a little bit weird, a little bit strange, something you don't like? Come on. Any ideas? Tabs, yeah! I think that, yes, I think that tabs are really awkward here. They take so many plays of your code editor. Why do you need them? I don't think that we actually do need them. I don't. I hope that you don't as well. So, the best way to deal with them is just to switch them at all, switch them off. And we can, of course, do it with the preferences, go to preferences, find the right line here and switch it back. But I have a smarter way. It is a way by using find action feature. Do you use it? Or, my users, do you use it? Okay. So, do you know that you can, with this shortcut, find any every action in the ID by the name, like start searching like copy or something like that. And it is also a good way if you forgot some shortcut to remember it. But it is also a good way to change preferences. For example, if I start typing not tab, but tab placement here, you can see that all the preferences as well. So, just start searching and you can just manage them from there. There is no need to go to preferences. There is no need to search through all the preferences lists. So, please use it. But, you may now ask me if I don't have tabs, how I'm going to navigate through my recently edited files and so on. And the best way to do it for me is to choose command E to see all the recent files or to shift command E and you will see all the recently edited files. And for that, speaking, you will see all the files and tool windows and from my point of view, it is much better than tabs. And of course, you can just start typing here to filter if you have the huge list, if you have edited a lot. Okay, so another thing that I, sorry, just want to click escape. If you still want to go to let's go back to controller and sometimes if I'm in view, I can do with the simple icon. If I want to navigate not only from my files, but also to navigate, let's do here, for example, to navigate through all the methods, for example, in my class, in my file. The best way for me to do it is to use command F12. It shows structure pop up and it shows all the methods. And the interesting thing here is that if you will click it once more time, you will see all the inherited methods as well. So sometimes quite useful. And another thing, a little bit more smarter, a way smarter navigation is actually to use go to definition, because I believe that a lot of times what you really need is not to navigate to any file or class, but to navigate to declaration, to definition of any variable method you are looking at. And the best way to do is to use command B and you will navigate to definition, to declaration. Okay. And you can use it again and again to dig your code. And you will navigate to libraries to gems as well, not only through your source, project, but through gems as well. And you can also use this one is command Y. If you don't want to switch to that file, where the definition is you can use this quick definition pop up to see the method definition in a pop up, not going to the file. Okay. So now I have a question for you. Please raise your hands if you already use something new from the last slides. Okay, great. Now you can leave. No, I'm joking. I'm hoping that you will use something more you as well. Okay. Let's talk a little bit more about coding now. So yeah, starting with creating new file, I think that it is very basic action. I hope that you know it. But interesting thing here, hopefully know it, that you can use Rails generators from here as well to use your scaffolding controls and whatever. And one more thing here is that when creating, for example, a new file, simple file, you can also use like directories here and everything will be created for you. No, I don't want to edit. And with this auto scroll from source action, you can see that you will be navigated in your project structure very fast as well. Here I am. No, don't really need it. So I'm going to delete. Yeah. But sometimes for example myself, sometimes I want to create this temporary file, temporary directories with this 4 rb file just to experiment to play with some piece of code. And for making that I don't want these files to be stored in my project structure. I don't actually want them to be stored in my version control system or whatever. I just want to play with them. And the best way to do that, not to create these temporary folders and these 4 rb files, but to create scratch files. And you can do that with shift command n, create for example some ruby file and it is like file but it is not physical file and it will be stored inside inside ruby mine inside IDE. But still you can start coding here and everything will be available like code completion. And good thing is that you can also use shift control r and you can run it from here as well. So for ruby code it's pretty useful from my point of view. Okay. And if you want to go for example to see where these files actually are you can go here, go to scratch files, again the same box, sorry for that but I won't do this now. And you can see there that for example I have free scratches so they are stored for you. You can then back to them again and do something. Okay. Hmm. Okay it's just my thoughts about this bug. Let's go back to some controller. For example this one. This one. Of course when coding you manipulate code a lot and you use a lot of copy and select code actions and so on so forth and ruby mine they're pretty pretty basic files but still I don't know if you use it you can use this extend selection it is quite useful it will select the chunks of code semantically and you can then like for example here yeah. And you can then for example move them please don't do it paste just move them if you need moving. And you can also copy some lines and you don't need to select the whole line you just need to put a cursor on it and you can duplicate them delete them again you don't need to select the whole line just put the cursor. And when copying a lot of them and if you need to paste you can use it with shift and you will see the history of your clipboard sometimes it is useful as well and we also do have some multiple selections you can set multiple course source by finding next occurrence for example and you can just start typing and you will see that code completion is working here as well for all the places and so on and so forth right now speaking if you want all the power of for example WIM editing and by the way who is using WIM ok so for example if you want the whole power of WIM editing code editing in RubyMind so if you want to have the boss from both worlds the best way to do it is to install a special plugin you need to go to plugins find sorry idea WIM plugin you need to install it it is not bundled from these general plugins and once it is installed you can go here to tools WIM emulator and just enable the emulation I won't do that but if you want to try then welcome to go after my talk or to go to our booth JetBrains booth we have it and to try on my laptop for example with this plugin just to try all the actions because I'm not a WIM user so I'm just not even not pretending to try all this smart things from WIM but you still can take a look how it works in RubyMind ok so one more thing about editing a little bit more about code snippets so do you use code snippets ok so ok so in RubyMind we have a lot of predefined code snippets but you can also create your own ones and sometimes it is a great way when you have a kind of very looking similar code that you don't want to type a lot of times and I'm not thinking about defecting here it's another topic so you can just select this code fragment and go here like save as live template here it is and you will need to add a title for it and you can go there and add some variables here I also want to add variable it means that I want to put a cursor another line after ending with this code snippet ok let's now try so if I go there sorry and now command G and TCC here you can see that cursor was placed on the right place it is the first variable place and now you can start just typing and complete and it will be completed according to our code snippet template and then I just click tab and go to the end of line it is the end of my code snippet ok so let's go back to them to the list just to show you that of course you can also use a lot of predefined ones or you can change them slightly if you want or you can set up your own ones and we have a lot of them not only for Ruby but for JavaScript and Rails and SQL and everything ok I'm just going to delete this one another really quick way to code when I'm now talking about html it is emet so anyone using emet here ok I really I do like emet I'm not really experienced in it but still so you can use it in RubyMind as well just start typing and with the tab it will make you html from your emet and another thing that you can now select this code and use shift command G now alt command G and surround it with emet so like here yes here it is and you can also if you're not really sure about your emet I use it a lot you can also choose emet preview oh where is my link ok oh I see it depends on the place where the cursor stays so you can preview before adding to your code ok and now for example if I change something let me sometimes I want to look at it a little bit nicer and I mean that sometimes I want to after that to reformat it to make code style looks good so talking about code styles there are several there are several ways to work with the code styles in RubyMind and first of all we have a lot of code style preferences you can change them if you want to they're based on some community community styles and you can use this alt command L or with shift to define a scope for the code fragment that you want to reformat according to this code style settings but actually you can also use editor config anyone using editor config yeah you're not doing a lot of open source or something like that because they really do have editor config files with the code style settings just to have the same code style for all the developers among the project ok so by the way if you have editor config you can just put this file editor config file it will be got from here sorry for my English and if you're writing JavaScript and using ESLint you can set up RubyMind to use this one as well so it's about code style ok we'll have not a lot of time here so now I want to talk a little bit more about not only writing your code but about cleaning it up so about some inspections and refactorings hope you know and about our I need some broken code at least ok yeah here it is hopefully you know that RubyMind highlights all the errors according to a lot of inspections that we have and it provides a quick fix option so with alt enter you can see that you can see that it was unless used with else and you can just click enter to fix it to change the code and sometimes into the good way just maybe to provide for example new methods so not only to clean your code but to write it as well like you're just then you're just going to intention action and create it with one click so and one thing that maybe you don't know that you also have this small icon where you can manage your highlighting level and switch the power safe mode if you need to so if you don't want to have all these highlightings no problem just don't be panic just switch it off okay but be responsible for your code in this point and we have you can also run the code inspector through all the whole projects for example to see all the errors that RubyMind can find and I want to show you one of the examples it is not only inspecting but it is also about like anything duplicates yep RubyMind finds all the duplications in your code you can see the details here like here it is almost identical you can see or like here it is just identical and it means that if you have a lot of duplications in your code it means that you want to do something with this with this code it is definitely not dry and you can just go from this window to your editor you can see that we have navigated to an editor and RubyMind highlights this code fragment and now I can for example just select it and use my refactor this option and for example extract method from this code some new method okay and this dialog is very interesting because you remember you had two places with the same code so RubyMind warns you that if you are extracting a method from a code fragment if you do have the same code fragment so you probably want to change to invoke this method there as well so do you want to replace it yes do you want to replace it yes okay so it is just a way to inspect and refactor like your code okay now let's talk a little bit more about testing and debugging stuff all my tests with rake yeah and while running maybe if you use testrunner maybe you know that by default it is on the bottom but you can always move this tool window on this option you can move it top bottom left or right no matter I like to place it on the left but maybe you prefer some other options the interesting things here I want to show you is this small icon it filters all the tests so you can see all the list of tests or you can just click and see only failed ones so I think that you may want to stay focused on the failed ones not on the green ones and you can see what was gone wrong what was wrong by switching and you can see yeah here what was going on and you can just navigate by clicking from here to the test code so quite useful and again if you want to if you have some failed tests but what was wrong you can navigate to test and a good way is just to debug this test it is like a quite natural next step I guess so you can just put a break point here and you can debug control shift yeah I just forgot okay so you can see that now our test is running on a debug mode and we stop the break point you can see that and we can see the list of variables here yeah and we can go step by step okay set equal maybe just one more time to show you without step over but with step inter so here it is you can step over you can go through your code look for some more details and by the way you can also manage break points you can go to these more break points and see all the break points through your code you can enable or disable them so if you have a lot of them sometimes it is also useful and you can also add some break points and and etc and one quite a new feature that I want to tell about debugging it is this small preference non-source no where is it oh I know where is it yeah ignore yeah so we can go there and you can see that we have this small setting in debugging stepping and it actually means that you can decide whether you want to step into your libraries into your gems or you want to stay inside your project so if you don't want to go to dig into all the libraries just put this setting and you will debug by stepping over only in your code even if you have break points in your gems you will go only through your code and step on break points in your code in your own code okay so the main tips and tricks and just one more question if you use version control system with ruby mine if you use ruby mine okay we have not a lot of time and maybe if you don't mind I will answer all the questions afterwards because I want to show you one more tricks if you don't mind okay so about version control systems it's quite a useful thing let's go to version control and okay you can see all the history here for all the project for all the repository and you can see your local changes but the useful thing that the small trick I want to show is that for example if you are going to if you are going to commit your changes not push okay common K it was the wrong shortcut yeah you can see that we have this commit dialog with the diff view as well and now you can actually edit your code just in your commit dialog if you need to fix something small and you mention it you don't need to go back to editor you just need to check this icon and now you can just change whatever you need for example just get the version from the left or just start typing here something so whatever you want so it's a small trick that from my point of view is quite useful if you are using version control systems okay and one more question is about databases do you use databases in RubyMind database you okay so you know about them quite a lot but if you don't use just want to let you know that we have this database where you can see all the data you have just open your tables you can see all the data of course you can even change the database from here but I think it's better to do with migration files you know so but when you want to look through your data and to have some queries like we do it's sometimes good to go for example to where is it yeah here it is like open some console and just start typing and it will well highlight not highlight but complete everything you need and you can run them and what else so you can play with the database and you don't need to set up everything cause as far as Rails project do have database configurations files actually everything you need when you set up your database the first time you need to go to this database click here and you can see part from sources so everything will be suggested to you just according to your database configuration files so it's quite useful for my photo view okay so that's it only one minute left thank you for your attention if you have some short questions I will be glad to answer we can just have a chat after the talk or at the booth we have a booth at the exhibition called JetBrains so if you want to have more demos if you have any questions we will be glad to help and there one guy he is a developer to remind you so if you want to blame something to have some bugs to talk about come on you are very welcome okay so thanks thank you