Visual Studio For Mac C++ Extension
PowerShell extension is a very good example of how to use powerful Code editor not just for Web development but for many different tasks including IT Professional stuff. Tag: Visual Studio Code. C/C++ support for Visual Studio Code is provided by a Microsoft C/C++ extension to enable cross-platform C and C++ development using VS Code on Windows, Linux, and macOS. The extension is still in preview and our focus is code editing, navigation, and debugging support for C and C++ code everywhere that VS Code runs.
-->X Code
This topic guides you through building a simple extension package. The extension package will create a new Command in Visual Studio for Mac's Edit menu that allows the user to insert the current date and time into an open text document.
This example uses the Add-in Maker. The Add-In Maker creates a new Project template and populates it with the required files for our custom extension package.

Begin by launching Visual Studio for Mac if it's not already open:
Install the Add-in Maker extension package using the Extension Manager. From the Visual Studio menu, choose Extensions...:
Navigate to the Gallery tab and type
Addin Makerinto the top-right search bar. Select Addin Maker from the Add-in Development category and click Install. If nothing shows up, hit Refresh and search again:Now that the Addin Maker is installed, you can start building an extension package. Start by creating a new solution.
From the New Solution dialog, choose Other > Miscellaneous > General > Xamarin Studio Addin > C# template and on the following screen name the new Solution
DateInserter:Visual Studio for Mac will populate a new Solution:
Remove the template code in
Manifest.addin.xmland replace it with the following:Now you need to set up the files that will eventually handle inserting the date and time into the text editor. Right-Click on the project node and add a new file. Select General > Empty Class and name the new file InsertDateHandler:
Let's remove the template code from
InsertDateHandler.csand replace it with the following code:We'll expand these two placeholder methods later.
Right-click on the DateInserter Project and select Add > New File. Select General > Empty Enumeration, and then name the new file DateInserterCommands:
Add the
InsertDateCommand as a new enumeration in theDateInserterCommands.csfile:At this point, you should have a working extension package. You can test it out by saving your work and running the application. The IDE will launch a new instance of Visual Studio for Mac with the new extension package installed. If you navigate to the Edit menu, you'll see that Visual Studio for Mac has a new option called Insert Date, as illustrated by the screenshot below:
Note that selecting Insert Date from the menu has no effect as the current implementation only has placeholder methods.
The framework is in place for the extension package, and it's time to write the code that powers inserting the date. First, make sure that the Insert Date Command is only enabled when the user has a text file open by replacing the
Updatemethod inInsertDateHandler.cswith the following code:Update the Command's
Runmethod to insert the date and time with the following code:Finally, let's run our extension package to test it. In the new instance of Visual Studio for Mac, select Edit > Insert Date. The current date and time is inserted at our caret, as illustrated by the screenshot below:
Visual Studio For Mac
