lsp/

directory
v0.618.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2022 License: Apache-2.0

README

Sysl LSP Language Server Implementation

(forked from https://github.com/golang/tools/tree/378b9e1d59e2352276eff57e8153a4ff4053d8a7/internal/lsp)

gopls is a sophisticated LSP implementation providing language features for Golang. It's a large project that contains a combination of business logic, plumbing and boilerplate. Unfortunately it's all internal and can't be used as a library.

This Sysl LSP language server implementation copies the boilerplate from gopls, removes most of the plumbing for unnecessary features (e.g. remote servers, telemetry), and focuses on the much simpler Sysl language business logic.

Usage

For simple distribution, the Sysl LSP language server is built into the Sysl binary. It can be invoked via stdio with the command:

sysl lsp

Design

Folder structure

  • framework/: The LSP boilerplate and plumbing copied from gopls
    • fakenet/: implementation of the net.Conn interface over a reader and writer (used for stdio)
    • jsonrpc2/: minimal implementation of the JSON-RPC 2.0 spec
    • lsp/: LSP server boilerplate derived from the spec
    • xcontext/: extra functionality for the in-built context package
  • impl/: business logic computing and providing Sysl language feature content to client
  • server/: Connects the server in impl to a stream

Directories

Path Synopsis
framework
jsonrpc2
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
jsonrpc2/servertest
Package servertest provides utilities for running tests against a remote LSP server.
Package servertest provides utilities for running tests against a remote LSP server.
lsp/helper
Invoke with //go:generate helper/helper -t Server -d protocol/tsserver.go -u lsp -o server_gen.go invoke in internal/lsp
Invoke with //go:generate helper/helper -t Server -d protocol/tsserver.go -u lsp -o server_gen.go invoke in internal/lsp
lsp/protocol
Package protocol contains the structs that map directly to the wire format of the "Language Server Protocol".
Package protocol contains the structs that map directly to the wire format of the "Language Server Protocol".
xcontext
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
Package impl implements LSP for sysl.
Package impl implements LSP for sysl.
Package lsp/server implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel.
Package lsp/server implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL