Using VSCode Extensions in Visual Studio

2019-05-23 16:36发布

问题:

Today I found a VSCode extension that I would very much love to use in Visual Studio 2017 (Pro or Enterprise). I'm not at all familiar with VSCode. Are the platforms entirely different, or is there some hope that I could somehow modify the extension and "port it over"?

回答1:

Are the platforms entirely different [...]

Yes, they are - VSCode extensions run in a JavaScript engine (and are usually written with TypeScript), while Visual Studio extensions seem to run on .NET (usually C#). They also have different extension APIs:

  • Visual Studio 2017 SDK
  • Visual Studio Code Extension API

That doesn't mean that extension couldn't be ported over of course, provided Visual Studio has equivalents for all the required APIs, but it would essentially be a rewrite.

Now, there's an exception to this with language servers, using Microsoft's Language Server Protocol. It is designed to be IDE-independent and servers can be written in basically whatever language you prefer. There's LSP clients implementations for both VSCode (built-in) and Visual Studio. The extension you linked doesn't fall under that though.