A Language Server Protocol (LSP) server for Jsonnet

Jsonnet Language Server

A Language Server Protocol (LSP) server for Jsonnet.

Features

Jump to definition

self-support.mp4
dollar-support.mp4

Error/Warning Diagnostics

error-support.mp4

Linting Diagnostics

linting-support.mp4

Standard Library Hover and Autocomplete

stdlib-support.mp4

Formatting

Installation

To install the LSP server with Go into "${GOPATH}"/bin:

go get -u github.com/grafana/jsonnet-language-server

To download the latest release binary from GitHub:

curl -Lo jsonnet-language-server https://github.com/grafana/jsonnet-language-server/releases/latest/download/jsonnet-language-server

Contributing

Contributions are more than welcome and I will try my best to be prompt with reviews.

Commits

Individual commits should be meaningful and have useful commit messages. For tips on writing commit messages, refer to How to write a commit message. Contributions will be rebased before merge to ensure a fast-forward merge.

Developer Certificate of Origin (DCO)

Contributors must sign the DCO for their contributions to be accepted.

Code style

Go code should be formatted with gofmt and linted with golangci-lint.

Editor integration

Emacs

Refer to editor/jsonnet-language-server.el for an example of enabling the LSP server with lsp-mode.

VSCodium / VSCode

Use the vscode-jsonnet extension

Owner
Grafana Labs
Grafana Labs is behind leading open source projects Grafana and Loki, and the creator of the first open & composable observability platform.
Grafana Labs
Comments
  • New release (0.7.1) keeps crashing

    New release (0.7.1) keeps crashing

    Hi, I was working with the previous release (0.7.0) and all good so far. As soon as I upgraded the version to the latest one (0.7.1) the language server keeps crashing:

    [Info  - 3:54:06 PM] Connection to server got closed. Server will restart.
    [Info  - 3:54:06 PM] Connection to server got closed. Server will restart.
    [Info  - 3:54:06 PM] Connection to server got closed. Server will restart.
    [Info  - 3:54:06 PM] Connection to server got closed. Server will restart.
    [Error - 3:54:06 PM] Connection to server got closed. Server will not be restarted.
    

    Any ideas how to get more logs so I can help here? Also, any ideas how to rollback to the previous version in my setup?

  • added config option for ext_code

    added config option for ext_code

    For various tasks I need to use the extCode parameter in the jsonnet cli. Hence why I wanted to include it into this codebase, so that I can work with it easily.

  • Lint alway warning when use std.get

    Lint alway warning when use std.get

    When I use std.get, LSP get two warning from lint

    local getValue(obj, key) = std.get(obj, key, null);
    

    it always reports Indexed object has no field "get" and Called value must be a function, but it is assumed to be void

  • Failing to expand helm chart

    Failing to expand helm chart

    RUNTIME ERROR: Expanding Helm Chart: exec: "helm": executable file not found in $PATH /Users/cyril/work/deployment_tools/ksonnet/vendor/github.com/grafana/jsonnet-libs/tanka-util/helm.libsonnet:46:23-67 thunk <chartData> from <function <anonymous>> /Users/cyril/work/deployment_tools/ksonnet/vendor/github.com/grafana/jsonnet-libs/tanka-util/helm.libsonnet:48:21-30 thunk from <function <anonymous>> /Users/cyril/work/deployment_tools/ksonnet/vendor/github.com/grafana/jsonnet-libs/tanka-util/k8s.libsonnet:43:7-13 thunk from <function <anonymous>> /Users/cyril/work/deployment_tools/ksonnet/vendor/github.com/grafana/jsonnet-libs/tanka-util/k8s.libsonnet:13:21-27 thunk from <function <anonymous>> <std>:31:26-27 thunk from <function <anonymous>> <std>:31:17-28 function <anonymous> /Users/cyril/work/deployment_tools/ksonnet/vendor/github.com/grafana/jsonnet-libs/tanka-util/k8s.libsonnet:13:8-28 function <anonymous> /Users/cyril/work/deployment_tools/ksonnet/vendor/github.com/grafana/jso...
    

    While I do have helm in the path, vs-code seems to complains, not sure how to resolve it.

  • feat: dynamic formatting configuration

    feat: dynamic formatting configuration

    Allow users to customize the formatting parameters using LSP runtime configuration, which is modifiable w/o restarting the jsonnet-language-server.

    Sample configuration looks like:

    settings = {
    	formatting = {
    		Indent = 4,
    		StringStyle = 'double',
    	},
    }
    

    See TestConfiguration_Formatting for a complete list of allowed keys.

  • Split find into multiple files

    Split find into multiple files

    Here are the main feature of this PR:

    • Processing functions are split into multiple files
    • Tests are unmodified, they still pass the same way
    • Finding a field now returns an array of objectRange instead of a field directly. This will allow us to implement issues that require multiple definitions (such as listing overrides and getting autocomplete)
    • Finding a parameter has been split from finding a var bind (as suggested here: https://github.com/grafana/jsonnet-language-server/pull/16)
  • Find definitions through function applies

    Find definitions through function applies

    Started in https://github.com/grafana/jsonnet-language-server/pull/63 and https://github.com/grafana/jsonnet-language-server/pull/70 I think this now covers all (or most) cases Most of this PR is just tests, since the missing code was just a few missing switch cases

  • Support symbols for computed fields

    Support symbols for computed fields

    Bug introduced in https://github.com/grafana/jsonnet-language-server/pull/60 The server currently panics while trying to get symbols when there's a computed field present This will instead list the fields at [field.content] in symbols

  • Enable go-to-definition for computed field names.

    Enable go-to-definition for computed field names.

    When finding node by position, push field.Name to the search stack. This allows us to now search through the field names as well when finding definitions.

  • Symbols support

    Symbols support

    Report symbols to clients of the language server This allows features like the VSCode outline

    In the following screenshots, see the tab in the lower left

    image image

  • Unable to run vscode extension

    Unable to run vscode extension

    I've installed the latest v0.3.1 version. Opening the Visual Studio Code console shows this:

    Not using custom binary path. Using default path
    Binary path is /Users/heydonovan/Library/Application Support/Code/User/globalStorage/grafana.vscode-jsonnet/bin/jsonnet-language-server (exists: true)
    Auto-update is enabled. Fetching latest release from https://api.github.com/repos/grafana/jsonnet-language-server/releases/latest
    Latest release is 0.8.0
    Failed to get current version from /Users/heydonovan/Library/Application Support/Code/User/globalStorage/grafana.vscode-jsonnet/bin/jsonnet-language-server
    Error: Command failed: /Users/heydonovan/Library/Application Support/Code/User/globalStorage/grafana.vscode-jsonnet/bin/jsonnet-language-server --version
    

    Manually attemping to run that binary results in:

    $ cd /Users/heydonovan/Library/Application\ Support/Code/User/globalStorage/grafana.vscode-jsonnet/bin/
    
    $ ls -lah
    total 13M
    drwxr-xr-x 3 heydonovan staff  96 Aug 30 13:25 ./
    drwxr-xr-x 3 heydonovan staff  96 Aug 30 13:25 ../
    -rwxrwxrwx 1 heydonovan staff 12M Aug 31 14:33 jsonnet-language-server*
    
    $ ./jsonnet-language-server
    fish: Job 1, './jsonnet-language-server' terminated by signal SIGKILL (Forced quit)
    
    $ ./jsonnet-language-server --version
    fish: Job 1, './jsonnet-language-server --ver…' terminated by signal SIGKILL (Forced quit)
    
    $ uname -m
    arm64
    
    $ sw_vers
    ProductName:	macOS
    ProductVersion:	12.5
    BuildVersion:	21G72
    
  • License question

    License question

    Hi, thanks for this great tool!

    Tanka & jsonnet-bundler are Apache-2.0, why not this repo? The choice of AGPL seems quite arbitrary to me. Furthermore, as you may know, this specific license is entirely forbidden in several open-source friendly companies such as Google (see here, even for personal productivity use.

    Would you consider Apache-2.0 instead?

    Thanks!

  • Will this project be available through NixPkgs?

    Will this project be available through NixPkgs?

    I couldn't help but notice that this project has Nix files but it is not submitted to NixPkgs? Why is this the case? It will be really nice to be able to install this project trough Nix without extra steps.

  • Command: Evaluate at position

    Command: Evaluate at position

    The language server currently has the evaluateFile and evaluateExpression commands. Another very useful one, but much harder to implement, is evaluateAtPosition. This could allow a user to check the value of self, or a local at any location

    Since locals cannot be queried, we could define temporary attributes at runtime, like this:

    {
      local my_key = 'test',
      temp:: my_key, // Line added at eval time (not defined by the user)
    }
    
  • CodeLens: Add `jb` support

    CodeLens: Add `jb` support

    An operation that has to be done quite often for jsonnet projects is to interact with dependencies. A very common package manager for jsonnet is the jsonnet bundler.

    The language server could have CodeLens buttons (a-la-gopls) to check for updates and if there are any, buttons to update dependencies. That would prevent users from having to call jb directly

⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

Oct 27, 2022
a simple http server as replacement of python -m http.server

ser a simple http server as replacement of python -m http.server

Dec 5, 2022
OpenAPI specs for your Go server, generated at server runtime. No CLI, no code generation, and no HTTP

Overview "oas" is short for "OpenAPI Spec". Go package for generating OpenAPI docs at runtime. Non-features: No code generation. No CLI. No magic comm

Dec 3, 2021
Go web server - A web server that can accept a GET request and serve a response.

go_web_server A web server that can accept a GET request and serve a response. Go is a great language for creating simple yet efficient web servers an

Jan 3, 2022
:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support
:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support

Web server with built-in support for QUIC, HTTP/2, Lua, Markdown, Pongo2, HyperApp, Amber, Sass(SCSS), GCSS, JSX, BoltDB (built-in, stores the databas

Jan 1, 2023
Fast, multi-platform web server with automatic HTTPS
Fast, multi-platform web server with automatic HTTPS

a project Every site on HTTPS Caddy is an extensible server platform that uses TLS by default. Releases · Documentation · Get Help Menu Features Insta

Jan 1, 2023
A simple SHOUTcast server.

DudelDu DudelDu is a simple audio/video streaming server using the SHOUTcast protocol. Features Supports various streaming clients: VLC, ServeStream,

Nov 20, 2022
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️

??️ go-feature-flag A feature flag solution, with YAML file in the backend (S3, GitHub, HTTP, local file ...). No server to install, just add a file i

Dec 29, 2022
An XMPP server written in Go (Golang).

jackal An XMPP server written in Go. About jackal is a free, open-source, high performance XMPP server which aims to be known for its stability, simpl

Dec 29, 2022
High-performance PHP application server, load-balancer and process manager written in Golang
High-performance PHP application server, load-balancer and process manager written in Golang

[RR2-BETA] RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports runnin

Jan 4, 2023
Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob

SFTPGo Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support, written in Go. Several storage backends are supporte

Jan 9, 2023
A RTP -> WebRTC broadcast server for Project Lightspeed.

Project Lightspeed WebRTC A RTP -> WebRTC server based on Pion written in Go. This server accepts RTP packets on port 65535 and broadcasts them via We

Sep 1, 2022
Heart 💜A high performance Lua web server with a simple, powerful API
Heart 💜A high performance Lua web server with a simple, powerful API

Heart ?? A high performance Lua web server with a simple, powerful API. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

Aug 31, 2022
The Galène videoconferencing server

The Galène videoconferencing server

Dec 28, 2022
A push notification server written in Go (Golang).
A push notification server written in Go (Golang).

A push notification micro server using Gin framework written in Go (Golang)

Jan 9, 2023
KissLists is a very simple shared lists server
KissLists is a very simple shared lists server

KissLists is a very simple shared lists server. with mobile optimised design basic theme support websockets messages sqlite database but no

Nov 30, 2022
Demonstration of a browser connecting to Pion WebRTC without a signaling server.
Demonstration of a browser connecting to Pion WebRTC without a signaling server.

Offline Browser Sync WebRTC without a signaling server! This repo demonstrates how you can connect two WebRTC proccesses without signaling. No configu

Dec 29, 2022
A simple HTTP Server to share files over WiFi via Qr Code
A simple HTTP Server to share files over WiFi via Qr Code

go-fileserver A simple HTTP server to share files over WiFi via QRCode Installation You can download compressed version from

Oct 8, 2022