![]() I can highlight this code (mouse or Shift+arrows). Here, I've typed the declaration and check below the query. What I can do is just start typing the code I need in that spot and then move it. Let's imagine I'm working on some code, maybe I've got this query in a proc. With the multi-line editing, this lets me set up test data quickly. Play around with the up and down arrows, and you'll get the line in above or below your cursor. This is what I'd do for a multi-line cursor in SSMS. If I have the cursor in the line with the data, I can hold ALT+Shift and down arrow. Not hard, but a neat trick in ADS I like. I can hold down Shift, then arrow up to highlight the line, then CTRL+C, then down arrow, then CTRL+V to paste this. I do this all the time for test data, and I need to copy the values line. Imagine you write some code like this: INSERT INTO Workout (WorkoutDt, ActivityGroup, WorkoutTime) This is sometimes easier, sometimes harder than search and replace, but it's worth experimenting with in your work. Each times I click CTRL+D, it selects the next occurrence of the characters. If I press CTRL+D twice more, I'll see all the items selected, with separate cursors. Note the other instances are highlighted, but not selected. Here I can select some characters, like the WorkoutDt word. If I want to edit this, I can search and replace, but I find that cumbersome at times. I've mis-typed the WorkoutDate as WorkoutDt. Look at this code: INSERT INTO Workout (WorkoutDt, ActivityGroup, WorkoutTime) I can use multiple mouse cursors automatically with CTRL+D. What if I have a typo in the code in many places. Once I have the cursors in the right place, I can then let go of ALT, hold Shift, and then use the arrow keys to select the characters I want to edit. ![]() This lets me pick the places where I want the same edit. I can hold down the ALT key and click in a few places to add additional cursors. Using the multi-line trick doesn't work as well, because we have the dates in different places on the different lines (off by one character). If I wanted to edit the dates, maybe change to 2019 because I've mistyped this or am testing something. INSERT INTO Workout (WorkoutDate, ActivityGroup, WorkoutTime) I see this type of structure often in work I might do. I can then let go of these key and hold down Shift to arrow and select multiple characters.Īs in SSMS, I can type different items then in this space. In ADS, if I want this to work, I need to use CTRL+ALT and then down arrow. For example, I can use ALT+Shift+arrows to highlight more than one line in SSMS. In SSMS, some of you may know that you can use Shift+Alt with arrow keys to work with the same space across multiple lines. This can make it much easier to look at some code and hide other code, like parameter checks. If I click on any of these down arrows, a section of code will collapse. Suppose I have some code, I can put my cursor in the left sidebar, and I'll see some arrows. It sometimes seems like I'll be working with two pieces of code and I have lots of stuff in the way. While we would all love to see procedures and batches of code limited to what's on the screen, that's often not possible. If you're like me, sometimes you get lots of code in a file. We'll look at some editor tricks, handy extensions, and some customization. There are a few neat things that I have found to make it easier to work with code that I want to show here. Coding TricksĪDS is designed to be a lightweight, quick and easy to use editor for coding T-SQL. Keep up to date with these, as the team at Microsoft is constantly evolving things. There's one every month, as well some hotfixes. The main sections in this article are:ĪDS has changed quite a bit since my last article, with lots of updates. I'll cover some of the ergonomic features, as well as how different languages might be used in ADS. This article continues the series, looking at some of the tips and tricks that might help you work a little more effectively in Azure Data Studio. If there are other features you're interested in, let me know. Editor Tips and Tricks for Azure Data Studio.Getting Comfortable Writing Code in Azure Data Studio.I've written a few articles on how ADS works, shown here: Azure Data Studio (ADS) is a lightweight IDE built on Visual Studio Code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |