Crates.io | ginko_ls |
lib.rs | ginko_ls |
version | 0.0.8 |
source | src |
created_at | 2024-02-08 20:46:13.170947 |
updated_at | 2024-11-12 18:25:05.022489 |
description | A language server for device-trees |
homepage | |
repository | https://github.com/Schottkyc137/ginko |
max_upload_size | |
id | 1132660 |
size | 53,749 |
A device-tree source parser, analyzer and language server. The main goal of this project is to make working with device-trees easy. For example, for the following device-tree:
/dts-v1/;
/ {
pic@10000000 {
phandle = <1>;
interrupt-controller;
reg = <0x10000000 0x100>;
}
};
dtc
produces the following output:
Error: test.dts:9.1-2 syntax error
FATAL ERROR: Unable to parse input tree
whereas ginko
produces the following output:
--> test.dts:8:6
|
8 | }
| ^ Expected ';'
At the moment, the command-line tool ginko
only checks the device-tree source.
It curently does not generate device-tree binary files nor can it output reformatted device-tree source files.
To install ginko with the rust toolchain, simply call
cargo install ginko
Additionally, pre-built binaries exist for x86 Linux and x86 Windows. Simply downloading them and adding the executables to a directory that is on the path should suffice to run the tool. Pre-built binaries also exist for macOS running on Apple Silicon, however these are not signed and notarized with apple so installation is more tedious. See this for more information.
Run
ginko <path/to/file.dts>
to run ginko on a device-tree source file and check the contents.
This project is in its infancy. Therefore, a couple of features aren't supported yet:
#include "some_header.h"
)ginko_ls is meant to be a feature-complete language server for device-trees. Language servers can be used in many editors, such as Visual Studio Code, Emacs or Vim
Either install the ginko_ls
manually, or you can install with :Mason
.
Configure the server with nvim-lspconfig
with the
configuration name ginko_ls
.
In order to configure it, simply add the following to your init.lua
lspconfig = require('lspconfig')
lspconfig['ginko_ls'].setup({
on_attach = on_attach,
capabilities = capabilities
})
This assumes you have on_attach
and capabilities
defined, see the nvim-lspconfig
docs for more information.
Use Ginko VSCode
If you want to use the Helix
Editor, you can modify the
devicetree
language definition in languages.toml
. An example is below.
[[language]]
name = "devicetree"
language-servers = ["ginko_ls"]
[language-server.ginko_ls]
command = "ginko_ls"
config = { provideFormatter = false }
All contributions, whether in the form of Pull Requests or Issues are highly appreciated and welcome.