I won't maintain this fork any further. If you liked some of the new feature just use my new LSP.
A Language Server Protocol (LSP) server for Jsonnet.
Master is (probably) always somehow broken or not tested on a complex codebase. Tags should be stable though
- Autocomplete function parameter names
- Autocomplete function parameter with their default values
- Find references
- Rename
- Very basic signature help
- Inlay hints
- unnamed function parameters
- Index (e.g. extcode variables)
- Bugfixes
- Infinite loops
- Completion with named args and objects without a space
- Binary Object completion
- Complete rework of the autocomplete code
- Proper extcode support
- Complete extVar/Code variables and all valid values e.g. std.extVar("PARAMS")
- Complete for objects
- Supports completion after newlines and whitespaces e.g. myobj.\n myVal
- Completes returns of functions
- e.g. myFunc({val: 5}).argVal.val
- Builder pattern
- Complete imports from all jpaths
- Complete import function calls (import 'a.libsonnet')("myArg").val
- Support super completion
- Complete keywords (super, self, local)
- Complete conditionals
- Currently not all conditions are supported
- Complete array access
- Complete unused argument names: myFunc(1, arg3=3, arg2=),
- Basic automatic ast fix
- Basic semantic token support
- Only the basic stuff. It is assumed you are also using something like tree sitter
- Reimplement
- Go to definition
- Inlay hints
- Refactor/Cleanup new features
- General cleanup after understanding more lsp stuff
- Code actions?
- Flow typing?
Documentation Full default Config:
{
"log_level": "panic",
"resolve_paths_with_tanka": false,
"jpath": [],
"ext_vars": null,
"ext_code": null,
"formatting": {
"Indent": 2,
"MaxBlankLines": 2,
"StringStyle": 1,
"CommentStyle": 1,
"PrettyFieldNames": true,
"PadArrays": false,
"PadObjects": true,
"SortImports": true,
"UseImplicitPlus": true,
"StripEverything": false,
"StripComments": false,
"StripAllButComments": false
},
"diagnostics": {
"enable_eval_diagnostics": false,
"enable_lint_diagnostics": false
},
"inlay": {
"enable_debug_ast": false,
"enable_index_value": false,
"enable_function_args": false,
"function_args": {
"show_with_same_name": false
},
"max_length": 120
},
"enable_semantic_tokens": false,
"workarounds": {
"assume_true_condition_on_error": false
},
"completion": {
"enable_snippets": false,
"enable_keywords": true,
"use_type_in_detail": false,
"show_docstring": false
}
}functionbody.mp4
forloop.mp4
rename.mp4
self-support.mp4
dollar-support.mp4
multi-defs-demo.mp4
error-support.mp4
linting-support.mp4
stdlib-support.mp4
Download the latest release binary from GitHub: https://github.com/grafana/jsonnet-language-server/releases
Contributions are more than welcome and I will try my best to be prompt with reviews.
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.
Contributors must sign the DCO for their contributions to be accepted.
Go code should be formatted with gofmt and linted with
golangci-lint.
- Emacs: Refer to editor/emacs
- Vim: Refer to editor/vim
- VSCod(e|ium): Use the Jsonnet Language Server extension (source code)
- Jetbrains: Use the Jsonnet Language Server plugin (source code)