DotJoshJohnson / vscode-dotnet

A Visual Studio Code language server implementation for .NET/.NET Core.
http://dotjoshjohnson.github.io/vscode-dotnet/api-docs
MIT License
8 stars 3 forks source link

:bangbang: Please note, this product is still in alpha.

VSCode.NET

VSCode.NET is a Visual Studio Code language server for .NET/.NET Core. It is designed to be fully compliant with the language server protocol and compatible with Microsoft's NodeJS language server client implementation.

Getting Started

Creating a language server using VSCode.NET is pretty simple:

  1. Create a new VS Code extension based on the language server example outlined in the VS Code documentation.

  2. In extension.ts, change the contents of the activate(context: ExtensionContext) function to the following (making changes as needded for your extension):

    export function activate(context: ExtensionContext) {
      let clientOptions: LanguageClientOptions = {
          documentSelector: ['plaintexet'],
          synchronize: {
              configurationSection: 'yourConfigSection',
              fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
          }
      };
    
      let disposable = new LanguageClient('VSCode.NET', {
          command: 'path/to/your/server/executable.exe'
      }, clientOptions).start();
    }
  3. Create a new .NET or .NET Core project and reference the VSCode package.

  4. Spin up a language server:

    using VSCode;
    using VSCode.Editor;
    
    namespace MyApp
    {
      class Program
      {
          static void Main()
          {
              using (LanguageServer server = new LanguageServer())
              {
                  server.Start();
                  server.WaitForState(LanguageServerState.Started);
    
                  server.Editor.ShowMessage(MessageType.Info, "Hello from .NET!");
              }
          }
      }
    }
  5. Read the API Documentation to learn more!

FAQ