A Language Server Protocol (LSP) server for Jsonnet

Overview

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

Issues
  • 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?

    bug 
    opened by thepalbi 9
  • 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)
    opened by julienduchesne 2
  • Completion: Add in parameters when the suggestion is a function

    Completion: Add in parameters when the suggestion is a function

    Closes https://github.com/grafana/jsonnet-language-server/issues/13 This works pretty well out of the box because the args given by the jsonnet docs are valid jsonnet Ex: Autocompleting std.manifestYamlDoc will give std.manifestYamlDoc(value, indent_array_in_object=false, quote_keys=true)

    opened by julienduchesne 1
  • Enhancement request: ability to disable

    Enhancement request: ability to disable "No errors or warnings" diagnostic

    Most language servers I have used simply do not report anything when there are no errors. Would be nice to be able to switch this diagnostic off. I attached a couple screenshots from NeoVim to show you how it looks in other editors (seems like the repo authors are using VSCode? the diagnostic just might not be as noticeable/bothersome there).

    opened by CameronNemo 1
  • bug: multiple Jsonnet Language Server instances

    bug: multiple Jsonnet Language Server instances

    The language server seems to be started many times:

    image

    OR if not started many times, the entry in the extensions is not removed.

    This may be the cause of non working extension over time.

    opened by davidovich 1
  • Fix `self` scope

    Fix `self` scope

    Fields outside of the scope of self are currently being resolved See the test for an example Fixes https://github.com/grafana/jsonnet-language-server/issues/2

    opened by julienduchesne 1
  • Good Jetbrains support

    Good Jetbrains support

    We have gotten the feedback that the Jetbrains LSP support plugin is not very good. Most features do not work correctly.

    Perhaps we should develop an extension for it, like https://github.com/grafana/vscode-jsonnet? However, a VSCode extension is easy because LSP support is good. Developing the whole LSP support would not be easy

    Or perhaps we should wait for Jetbrains Fleet which advertises first-class LSP support and tell people to use that

    bug question 
    opened by julienduchesne 1
  • Remove

    Remove "no errors" diagnostics

    Closes https://github.com/grafana/jsonnet-language-server/issues/44

    Don't know why I needed this. I just tested again without it and VSCode is clearing the errors successfully :shrug:

    opened by julienduchesne 0
  • Update golang to 1.18

    Update golang to 1.18

    Also upgrade golangci-lint This seems to fix CI checks that were failing (typecheck was failing here: https://github.com/grafana/jsonnet-language-server/pull/40 and it doesn't fail anymore. It's still being run in go 1.18, it's not part of the checkers that are not 1.18 compatible)

    opened by julienduchesne 0
  • Refactoring + Speed improvements

    Refactoring + Speed improvements

    Removed unnecessary return values in node stack Added an import cache bringing some performance improvements

    Ran some benchmarks. Pretty good improvement 😄

    name                                                             old time/op  new time/op  delta
    Definition/goto_deeply_nested_imported_attribute-8                162µs ±13%    12µs ± 6%  -92.57%  (p=0.000 n=20+20)
    Definition/goto_deeply_nested_imported_attribute_through_self-8   166µs ±10%    48µs ± 9%  -71.35%  (p=0.000 n=20+20)
    
    opened by julienduchesne 0
  • Add benchmark test for

    Add benchmark test for "go to definition"

    I want to refactor this code a bit but it'll be nice to see if the new code is faster This extracts the test cases and uses them for both testing and benchmarking

    To benchmark the code:

    1. Run benchmark with the old code: go test ./... -bench "BenchmarkDefinition/test_goto_definition_for_var_myvar" -count=10 > old.txt
    2. Modify the code
    3. Run benchmark again: go test ./... -bench "BenchmarkDefinition/test_goto_definition_for_var_myvar" -count=10 > new.txt
    4. Compare files: benchstat old.txt new.txt
    opened by julienduchesne 0
  • 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.

    opened by entombedvirus 2
  • 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.

    opened by claudio4 0
  • 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)
    }
    
    enhancement 
    opened by julienduchesne 0
  • 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

    enhancement 
    opened by julienduchesne 0
Releases(v0.7.2)
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
⚡ 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.

Bolt 16 Jan 19, 2022
a simple http server as replacement of python -m http.server

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

Changkun Ou 4 Feb 16, 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

Nelo Mitranim 0 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

Gilbert Ngeno 0 Jan 3, 2022
: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

Alexander F. Rødseth 2k Aug 10, 2022
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

Caddy 42.2k Aug 18, 2022
A simple SHOUTcast server.

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

Matthias Ladkau 136 Apr 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. 🎛️

??️ 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

Thomas Poignant 492 Aug 13, 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

Miguel Ángel Ortuño 1.3k Aug 8, 2022
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

Spiral Scout 6.7k Aug 15, 2022
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

Nicola Murino 4.6k Aug 18, 2022
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

Garrett GRVY Graves 70 Jun 23, 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. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

Hyperspace Logistics 76 Jul 15, 2022
The Galène videoconferencing server

The Galène videoconferencing server

Juliusz Chroboczek 657 Aug 11, 2022
A push notification server written in Go (Golang).

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

Bo-Yi Wu 6.5k Aug 12, 2022
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

Vincent Lark 38 Jul 29, 2022
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

Pion 138 Jul 12, 2022
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

Pradeep Khileri 69 May 30, 2022