Visual Studio 2019 Mac Extensions



-->

Overview Visual Studio Tools for Unity is a free Visual Studio extension that turns Visual Studio into a powerful tool for developing cross-platform games and apps with Unity. While the Unity editor is great for putting your game world together, you can't write your code in it. To analyze all files, enable Visual Studio full solution analysis (see here) under the usual Visual Studio Analyze menu. Fine tune your rules SonarLint is integrated with Microsoft Code Analysis framework, so rules for C# and VB.NET can be fine-tuned in the. Ruleset file used by your project. Hi OrchestraMusic, Welcome to the MSDN forum. Now we have two Visual Studio versions (Visual Studio for Mac, Visual Studio Code) that can directly install on the Mac (macOS), refer to your description, it looks like you installed the Visual Studio for Mac, it is a developer environment optimized for building mobile and cloud apps with Xamarin and.NET. As I am already using VS Code IDE, I’m thinking of using it for Python programming. Here, I will share with you the steps I took for setting up Visual Studio Code for Python on macOS. Tools & Technologies Used. MacOS Mojave (10.14.5) Visual Studio Code (1.36.0) Python (3.7.3) Steps For Setting Up VS Code For Python Prerequisites. Visual Studio 2019 and Visual Studio 2017. Download and run the latest Visual Studio installer. If you have Visual Studio installed already, run the Visual Studio Installer, select the Modify option (see Modify Visual Studio) and go to step 2.

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.

  1. Begin by launching Visual Studio for Mac if it's not already open:

  2. Install the Add-in Maker extension package using the Extension Manager. From the Visual Studio menu, choose Extensions...:

  3. Navigate to the Gallery tab and type Addin Maker into 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:

  4. Now that the Addin Maker is installed, you can start building an extension package. Start by creating a new solution.

  5. From the New Solution dialog, choose Other > Miscellaneous > General > Xamarin Studio Addin > C# template and on the following screen name the new Solution DateInserter:

  6. Visual Studio for Mac will populate a new Solution:

  7. Remove the template code in Manifest.addin.xml and replace it with the following:

  8. 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:

  9. Let's remove the template code from InsertDateHandler.cs and replace it with the following code:

    We'll expand these two placeholder methods later.

  10. Right-click on the DateInserter Project and select Add > New File. Select General > Empty Enumeration, and then name the new file DateInserterCommands:

  11. Add the InsertDate Command as a new enumeration in the DateInserterCommands.cs file:

  12. 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.

  13. 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 Update method in InsertDateHandler.cs with the following code:

  14. Update the Command's Run method to insert the date and time with the following code:

  15. 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:

Mac

See also

We released this week the first 8.2 preview of Visual Studio for Mac. This release is important for us as it’s the first one to contain our improved editor experience for Android XML resources and Xamarin Forms XAML files both enabled by the port of the Visual Studio editor to the Mac.

You can read through the announcement above for the high-level improvements. In this post I want to focus on how we got there with specifically the Android side (I will speak about XAML in a future entry).

Now if you have read some of my previousposts, we started making heavy investment improving our editing experience for Android XML resources (originally only layout files) last year which first got delivered in the Visual Studio 2017 15.8 release and kept being improved in Visual Studio 2019.

At the time the landscape was quite different, Visual Studio for Mac and Visual Studio had only a few shared APIs (Roslyn mainly) and developing certain features (like editor extensions) required rewriting portion of the same code twice. Worse, on Windows the base XML editor that we were using as our editing canvas did not have many extensibility points.

One of the horror story of that time was around IntelliSense. Because the Visual Studio XML editor does not have an API to extend the completion list directly, we had to resort to generating on-the-fly XSD (XML Schema Definition) files that the XML language service would consume to provide the autocompletion experience.

Visual Studio 2019 Mac Extensions Download

This was alright at best with very basic elements and attributes completions but providing a comprehensive list that included all your resource references implied generating massive XSD files with a terrible performance cost.

On Visual Studio for Mac, we had the benefit of an existing and extensible XML pipeline complete with an incremental XML parser and a straightforward interface to inject our own completions depending on the caret location (elements, attributes or attributes values). This is the reason why our experience there was so much better and faster at the time.

When maintaining the previous XSD logic on Windows became untenable we went looking for other solutions. To implement an autocompletion experience at the time you had 3 possibilities:

Visual Studio Best Extensions

Visual studio 2019 mac extensions list
  • Use a bespoke system like the XSD files we were using (which in turn is based on a legacy Visual Studio API for language services)
  • Use Roslyn editor features layer. Unfortunately this implied having an XML parser that could output Roslyn trees which we didn’t have.
  • Use the low-level, MEF-based, synchronous completion API from the Visual Studio editor. This is what Roslyn would use under the hood but had extensively improved to be more asynchronous.

Fortunately for us, we asked ourselves that question right at the time when the Visual Studio editor team were developing a new more modern IntelliSense API that was async-friendly. It represented the best of both the older API (no semantic dependencies) and Roslyn (asynchronous capabilities).

We made a proof-of-concept by porting part of the Visual Studio for Mac XML service to be layered on top of this new API with great help from the editor team. The result was so much better that we decided this was the way to go. As one of the earliest adopter of this new editor feature we also (hopefully) influenced it positively (Roslyn now uses it too).

Thanks to this newfound knowledge of editor extensibility, we continued implementing more features: syntax highlighting (classification in Visual Studio jargon), semantic operations, go-to-definition and others. It came to the point that we provided enough functionality to simply drop the original XML editor altogether.

We also took advantage of our other work to employ a better XML parsing pipeline in the designer itself to make the interactions between the design surface and the text editor more seamless.

Together, all those improvements switched things around and Visual Studio was now leading in terms of editor experience. We were keeping watch on Visual Studio for Mac though and we knew that, at the very least, work was on-going to provide those same editor extensibility API there to enable other teams at Microsoft to port their existing Visual Studio code over to the Mac.

As it turns out, the team decided to bite the bullet even further and ported the entireVisual Studio editor to the Mac (with its whole extensibility API coming for the ride). This was a boon for us and, from that point on, we started making sure all our Android extension code was portable across both IDEs.

Excitingly, we didn’t have to do much work to make this happen. Most of the available Visual Studio editor extensibility is actually cross-platform (meaning do not depend on a Visual Studio-specific API or a UI toolkit like WPF) and thus our extensions were easy to simply share in our common codebase.

(There is actually enough of that type of code aside from the WPF frontend that it was possible to create a unit-testing library with all of the open-source code available that was also shareable across both Windows and Mac)

The extensions that couldn’t be ported straightaway usually fell into two categories: they either used Visual Studio specific APIs or they referenced WPF. Here are a few example of how we solved those issues:

Visual Studio C++ Extensions

  • For code depending on Visual Studio-specific API we looked to see why. In our case it turns out a lot of it boiled down to initializing various part of the code on-demand. Instead we moved that initialization into a single ITextViewCreationListener part that was IDE-specific and thus were able to remove the equivalent calls in our other extensions to make them agnostic.
  • Another solution was to isolate the offending functionality behind another interface. We had this case with our go-to-definition service where opening a document in the IDE required platform-specific calls. What we did is hide that code behind an extremely simple interface that we could [Import] from the now shareable service and only [Export] the much smaller implementation in each IDE layers.
  • One last case was where we used JoinableTaskFactory from the vs-threading library by querying it directly from Visual Studio. Rather than doing that, we simply [Import]’ed in our parts the JoinableTaskContext that is already exported by both IDEs and thus severed that dependency.
  • For some extensions you may end up providing some UI adornments. In this case, you can leverage the IViewElementFactoryService API to reference a data object from the shared code and only provide the UI-specific portion in your IDE layer.
  • Finally, as part of porting the editor to Cocoa, a number of public interfaces had to be de-WPF-ized and new types introduced to replace them. That work is expected to be shared back to Visual Studio but in the meantime you may have to do some creative subclassing to share functionality. A good example of this are adornment tags (think of the inline color previews in our editor).

As a testament of the hard work from the Visual Studio for Mac team to integrate the editor, we expect that by the final 8.2 release we will have ported 100% of our originally Windows-only extensions to be shared on both IDEs.

What Are Visual Studio Extensions

Visual

Visual Studio Extensions Download

If you are yourself interested in doing that kind of work, the team has started publishing documentation. Keep an eye out for new content showing up there in the near future.