-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeviceTree Formatter #583
Comments
Please reply to this issue if you start work on it so that we can assign the issue to you (avoids duplicate efforts). |
Given #568, a Prettier plugin seems like a convenient way to implement this. Ignoring I've written a mostly complete DT parser that runs in NodeJS at https://github.com/joelspadin/tree-sitter-devicetree. It is built on https://tree-sitter.github.io/tree-sitter/. Here is a project that uses it as an example: https://github.com/joelspadin/zmk-tools/blob/main/src/Parser.ts. (To my knowledge the only thing not yet supported in the parser is labels inside property values.) |
To anyone who reads this, we're still looking for a volunteer to spearhead this issue. If you're a developer wishing to contribute to ZMK without touching C/embedded, this might be just the ticket. |
* Add new `&key_repeat` behavior that captures and re-sends the most recently triggered keycode. Closes: zmkfirmware#583
Hi! I've been doing a little work on this for my own project with the help of tree-sitter-devicetree and I don't know if I can satisfy the requirements describe above, but I'd be interested in some discussion and knowing if the ZMK maintainers have any kind of preferred style for formatting devicetree code. Here are the basic rules I came up with for myself. Indentation
I picked 4-space tabs because... if I have to force something on people it seems like a safe bet. But it's gotten me thinking about the ways people make these configurations portable. I'm not a vim user but it might be simple enough to look out for a modeline to get the preferred tab size (I'm reading the file already) or even to check for an Spacing
As is frequently the case, this is what I came up with by experimentation and it's more than likely I'm missing some more critical edge cases due to my ignorance of devicetree and maybe more complex keymaps. I haven't even looked at applying it to board/shield definitions yet. |
I understand that it makes sense to structure keymaps as DeviceTree files under the hood, but is this really a good way for the end user to create their keymaps? Ive built a preprocessor that allows you to create your keymaps in typescript programmatically and outputs the relevant DTS. Would this be something the zmk project is interested in? Right now its very tailored to my use but I'd be happy to make it more generic and make the repo public/contribute the code to zmk Sorry for bad formatting/grammar. Currently on mobile. |
I landed here from a search for a devicetree formatter and came across dtsfmt. I don't know if the maintainer would be interested in contributing to ZMK directly, but I wanted to bring it to the group's attention. |
We're increasingly in need of a DeviceTree formatter. We're looking for a volunteer to implement one.
It must ...
.dts
.dtsi
.overlay
.keymap
It should ...
bindings = < ... >;
It may ...
See relevant conversations:
The text was updated successfully, but these errors were encountered: