Homebrew Visual Studio Code



-->Homebrew

APPLIES TO: Azure SQL Database Azure SQL Managed Instance

Visual Studio Code is a graphical code editor for Linux, macOS, and Windows. It supports extensions, including the mssql extension for querying a SQL Server instance, Azure SQL Database, an Azure SQL Managed Instance, and a database in Azure Synapse Analytics. In this quickstart, you'll use Visual Studio Code to connect to Azure SQL Database or Azure SQL Managed Instance and then run Transact-SQL statements to query, insert, update, and delete data.

Homebrew’s package index. Homebrew Formulae. /api/cask/visual-studio-code.json (JSON API) Cask code on GitHub. Current version: 1.55.2. Install MacOS Homebrew Packages With Ansible. GitHub Gist: instantly share code, notes, and snippets. The Visual Studio Code Arduino extension relies on the Arduino IDE. Download and install the Arduino IDE for Windows. Make sure you download the Windows Installer version. Install Visual Studio Code. Download and install Visual Studio Code for Windows. This is the primary development tool for building IoT DevKit applications. Terminal.app's Homebrew theme for Visual Studio Code. Color Code Color Code; Black #000: Bright Black #666: Blue #0000b2: Bright Blue #00f. Terminal.app's Homebrew theme for Visual Studio Code. Color Code Color Code; Black #000: Bright Black #666: Blue #0000b2: Bright Blue #00f.

Prerequisites

  • A database in Azure SQL Database or Azure SQL Managed Instance. You can use one of these quickstarts to create and then configure a database in Azure SQL Database:

    ActionAzure SQL DatabaseAzure SQL Managed Instance
    CreatePortalPortal
    CLICLI
    PowerShellPowerShell
    ConfigureServer-level IP firewall rule)Connectivity from a virtual machine (VM)
    Connectivity from on-premises
    Load dataAdventure Works loaded per quickstartRestore Wide World Importers
    Restore or import Adventure Works from a BACPAC file from GitHub

    Important

    The scripts in this article are written to use the Adventure Works database. With a SQL Managed Instance, you must either import the Adventure Works database into an instance database or modify the scripts in this article to use the Wide World Importers database.

Install Visual Studio Code

Make sure you have installed the latest Visual Studio Code and loaded the mssql extension. For guidance on installing the mssql extension, see Install Visual Studio Code and mssql for Visual Studio Code.

Homebrew

Configure Visual Studio Code

macOS

For macOS, you need to install OpenSSL, which is a prerequisite for .NET Core that mssql extension uses. Open your terminal and enter the following commands to install brew and OpenSSL.

Linux (Ubuntu)

No special configuration needed.

Windows

No special configuration needed.

Get server connection information

Get the connection information you need to connect to Azure SQL Database. You'll need the fully qualified server name or host name, database name, and login information for the upcoming procedures.

  1. Sign in to the Azure portal.

  2. Navigate to the SQL databases or SQL Managed Instances page.

  3. On the Overview page, review the fully qualified server name next to Server name for SQL Database or the fully qualified server name next to Host for a SQL Managed Instance. To copy the server name or host name, hover over it and select the Copy icon.

Set language mode to SQL

In Visual Studio Code, set the language mode to SQL to enable mssql commands and T-SQL IntelliSense.

  1. Open a new Visual Studio Code window.

  2. Press Ctrl+N. A new plain text file opens.

  3. Select Plain Text in the status bar's lower right-hand corner.

  4. In the Select language mode drop-down menu that opens, select SQL.

Connect to your database

Use Visual Studio Code to establish a connection to your server.

Important

Before continuing, make sure that you have your server and sign in information ready. Once you begin entering the connection profile information, if you change your focus from Visual Studio Code, you have to restart creating the profile.

  1. In Visual Studio Code, press Ctrl+Shift+P (or F1) to open the Command Palette.

  2. Select MS SQL:Connect and choose Enter.

  3. Select Create Connection Profile.

  4. Follow the prompts to specify the new profile's connection properties. After specifying each value, choose Enter to continue.

    Property Suggested valueDescription 
    Server nameThe fully qualified server nameSomething like: mynewserver20170313.database.windows.net.
    Database namemySampleDatabaseThe database to connect to.
    AuthenticationSQL LoginThis tutorial uses SQL Authentication.
    User nameUser nameThe user name of the server admin account used to create the server.
    Password (SQL Login)PasswordThe password of the server admin account used to create the server.
    Save Password?Yes or NoSelect Yes if you do not want to enter the password each time.
    Enter a name for this profileA profile name, such as mySampleProfileA saved profile speeds your connection on subsequent logins.

    If successful, a notification appears saying your profile is created and connected.

Query data

Run the following SELECT Transact-SQL statement to query for the top 20 products by category.

  1. In the editor window, paste the following SQL query.

  2. Press Ctrl+Shift+E to run the query and display results from the Product and ProductCategory tables.

Insert data

Run the following INSERT Transact-SQL statement to add a new product into the SalesLT.Product table.

  1. Replace the previous query with this one.

  2. Press Ctrl+Shift+E to insert a new row in the Product table.

Update data

Run the following UPDATE Transact-SQL statement to update the added product.

  1. Replace the previous query with this one:

  2. Press Ctrl+Shift+E to update the specified row in the Product table.

Delete data

Run the following DELETE Transact-SQL statement to remove the new product.

  1. Replace the previous query with this one:

  2. Press Ctrl+Shift+E to delete the specified row in the Product table.

Next steps

  • To connect and query using SQL Server Management Studio, see Quickstart: Use SQL Server Management Studio to connect to a database in Azure SQL Database and query data.
  • To connect and query using the Azure portal, see Quickstart: Use the SQL Query editor in the Azure portal to connect and query data.
  • For an MSDN magazine article on using Visual Studio Code, see Create a database IDE with MSSQL extension blog post.

Once you’ve got the PHP Coding Standards set up in Visual Studio Code, I think it’s also important to make sure that you have PHPUnit installed so that you get in the practice of writing testable code.

If you wait to start doing this until after you’ve started a project, you’re far less likely to start doing it. I’m saying this both from experience and from working with other developers.

So before I start covering how to handle front-end linting and things like that, I want to walk through the process of setting up PHPUnit. If you’ve not yet read how we’re managing packages or how we’re using Visual Studio Code, I recommend catching up by reading the following articles:

Once you’re caught up, head back to this post.

[restrict paid=”true”]

PHPUnit in Visual Studio Code

For the remainder of the content, we’re going to look at:

  1. Installing PHPUnit,
  2. Installing the proper Visual Studio Code extension,
  3. Configuring PHPUnit within our user settings.

And we’ll get started with that now.

1. Installing PHPUnit

Since you’ve been using Homebrew throughout this series of posts, using Homebrew should be getting easier and easier. To install PHPUnit via Homebrew, simply enter the following command in your terminal:

It should result in a screen like this:

If you’ve previously installed it via some other means, then Homebrew may prompt you to update it (as it did for me). And if that’s the case, let it do its thing:

Once that’s done, it’s time to install the proper Visual Studio Code extension for PHPUnit.

2. PHPUnit For Visual Studio Code

Installing PHPUnit in Visual Studio Code is easy given the vast marketplace it has.

Of course, there’s always the challenge of having to determine which one to select. I’m a fan of the version of the extension via Elon Mallin (which you can also find in the marketplace and which is how I recommend installing it).

Once you’ve found it and installed it, then it will likely ask you to reload Visual Studio Code. If you’re in the middle of your work, go ahead and save the project and reload.

At this point, it’s time to configure your settings.

3. Configuring Your Settings

Visual Studio Code Download

Updating your settings is easy. As per usual, you’ll open up your User Settings JSON file (which you can find using this familiar screenshot):

From here, you can then enter the following code at the bottom of the file:

View the code on Gist.

This will tell Visual Studio code the following:

  • where the PHPUnit binary is located,
  • where the PHPUnit configuration file is located,
  • how you want to execute the tests.

We’ll be looking at the second and third points in more detail later in this series as it’s important to make sure we have a proper configuration file (and one that we and transfer from project to project) and how to go about doing so from within the editor.

But we’ll look at that in a future post.

[/restrict]

Brew Vs Brew Cask

Install visual studio code using homebrew

Homebrew Visual Studio Code Download

What About Now?

Homebrew Install Visual Studio Code

For now, focus on taking care of getting things set up in your IDE. If you opt to proceed with working with configuration files and executing tests, that’s completely fine; otherwise, I’ll be covering exactly how to do that in the next series of posts.