![]() ![]() You can apply formatting rules for alignment, wrapping, indentation, and much more. DataGrip can reformat selected blocks of source code, all code in the current file, or changes uncommitted to VCS.Ĭustomize your SQL code style in Preferences | Editor | Code Style | SQL. In the editor, select a code fragment you want to reformat and press Cmd+Opt+L/Ctrl+Alt+L. The Cmd+Shift+L/Ctrl+Shift+Q combination opens a new console way faster than you can do via the toolbar. Open new console: Cmd+Shift+L/Ctrl+Shift+Q Probably the best shortcut for peace of mind. You can open the search window with the needed scope right from the start: Tabįor those moments when you accidentally close the tab you need: Cmd/Ctrl+E brings up your history in DataGrip. And searching for ‘caret’ will also bring up items with ‘cursor’ in their name. Search Everywhere: Double-press Shiftĭouble-press Shift to open the search window, and just start typing! You can use abbreviations and synonyms in your search.įor instance, ‘ fa‘ is enough to find ‘ film_actor‘. Use Opt+Enter/Alt+Enter to open the list of suggestions and select an action from the list. By clicking a yellow bulb icon, you can view intention actions available in the current context. They cover a wide range of situations from warnings to optimization suggestions. This means that DataGrip has detected elements of your code that can be improved and is ready to make suggestions. You might have seen a yellow bulb icon in the editor. Show intention actions: Opt+Enter/Alt+Enter Set up a query suggestion list, choose how to view query results, choose how to show errors, and much more. Statements that you are going to execute are highlighted in a query editor.īy the way, you can customize query execution settings by clicking the Сustomize link. It always contains the option to run all the statements. If there are several statements, a list of suggestions appears and you can choose which one to execute. Press Cmd/Ctrl+Enter.ĭataGrip executes the whole statement or only the selection if you’ve highlighted a fragment of code. It can be a subquery or a group of statements. Execute statement: Cmd/Ctrl+EnterĬlick the statement or select the fragment of code that you want to execute. With that in mind, we’ve put together a list of our top-10 most useful DataGrip shortcuts. But they are not always easy to remember. They make coding faster and more efficient. DataGrip plugin: Database Tools and SQL (bundled 221.5080.212).Here, the list items are all on a new line, indented from the opening line, and not aligned with the opening parenthesis Software Details Regardless of the formatting method (enter key or Format Code action), the list behaviour that I want is: SELECT However, the 'Format Code' action (Ctrl + Alt + L) wraps these items and aligns with the opened parenthesis: SELECT Ĭonsider the following query with a long list: SELECTĪND data_type NOT IN ('item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item', 'item')Ĭlicking the enter key with the cursor before the items behaves in the same way as described above Ĭlicking the enter key with the cursor before the second 'item' and then the closing parenthesis leaves the code formatted like. However, when I place the cursor before the first 'item' and click the enter key, it places the text on the next line but aligned with the opening parenthesis. The 'Format Code' action (Ctrl + Alt + L) does nothing notable to this query I've changed all of my wrapping options to Chop (or Chop If Long) across all of the settings and I've changed most of the alignment options to Wrapped Unindented (where I think it'll make a difference), but lists are still only wrapping if they're long and the alignment is not working as expected - I can't figure out which options apply to lists Current Behaviour (Not Wanted) Short ListĬonsider the following query with a short list: SELECT The items in a list should be on a new line, indented once from the start of the opening line (not relative to the opening parenthesis, though).There's 2 behaviours that I want to enforce: I'm hoping that answers to this question will show me which settings to change to get the behaviour that I want (explained below) I've been messing around with the Code Style options in P圜harm (but for SQL, hence the DataGrip title):Īlthough I can get almost everything to the style that I use, I can't figure out how to get lists to format how I expect ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |