GithubHelp home page GithubHelp logo

jose-agg / languageserver.net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cxuesong/languageserver.net

0.0 0.0 0.0 565 KB

A .NET Standard server-side implementation of Language Server Protocol 2.0/3.x infrastructure library.

License: Apache License 2.0

C# 97.05% TypeScript 2.95%

languageserver.net's Introduction

LanguageServer.NET

NuGet version (CXuesong.LanguageServer.VsCode) Gitter

A .NET server-side implementation of Language Server Protocol infrastructure library for VSCode, and hopefully, might also be used with other IDEs that support Language Server Protocol. It provides necessary data structure used for JSON serialization and JSON RPC calls for LSP 3.6 and up.

The library is now available on NuGet. To install the package, run the following command

# Package Manager Console
Install-Package CXuesong.LanguageServer.VsCode
# dotnet CLI
dotnet add package CXuesong.LanguageServer.VsCode

If you found any missing data structures, please open an issue in this repository.

Based on CXuesong/JsonRpc.Standard, this .NET Standard library intends to provide basic interfaces and data structures so that you can write a language server in C#, build it on .NET Core and, with the help of the client-side code of Microsoft/vscode-languageserver-node, use it in VSCode.

For an actual (WIP) Wikitext language server based on this library, please take a look at CXuesong/MwLanguageServer.

To set up the demo

Screenshot of DemoLanguageServer

Prerequesites

  • .NET Core SDK 3.1
  • (Optionally) Visual Studio 2019
  • yarn (or npm)

Steps

  1. Open DemoLanguageServer in VS, choose Debug profile, and build the project.
    • Alternatively, run dotnet build under DemoLanguageServe folder.
  2. Open Client\VsCode folder in VSCode.
  3. Run yarn install in the terminal.
  4. Press F5 and a new VSCode window (Extension Development Host) should show.
  5. Open a folder in the new VSCode window, and create a new file.
  6. Change the file language to Demo Language
  7. Then your editor will work as shown in the screenshot. Enter .net core in the editor and see what happens.

To debug the server application, you may wish to turn WAIT_FOR_DEBUGGER conditional switch on in DemoLanguageServer/Program.cs. After starting up the Extension Development Host, and activating the language server, you may attach VS Debugger to dotnet process and go on debugging.

You may also set the default value of demoLanguageServer.trace.server to "messages" in package.json to make language client show more debugging information.

Notes

  • Though it's not mentioned in MS's official LSP documentation, by default VsCode uses stdin/stdout as JSON RPC transportation channel; thus it's important you SHOULD NOT read from/write to the console from your own code as long as the connection has been established, to avoid interfering the JSON RPC communication.
  • If you are using the LSP client library from vscode-languageserver-node, other transportation channels, such as named pipe (Windows) or Unix domain socket (Linux/MacOS) is possible via client-side configuration; though you will need to write your own server-side implementation.
  • It's worthwhile to be noted that Unix domain socket has been introduced since Windows 10 Build 17063. However, there is currently no means to set up a Unix domain socket client in Node.JS on Windows. Thus it seems that, up till now, we still cannot use Unix domain socket as JSON RPC as transportation channel on Windows. See the tracking issue: CXuesong/JsonRpc.Standard#4.

languageserver.net's People

Contributors

cxuesong avatar lextm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.