Try the new alpha Devicetree LSP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi all,


I am Kyle and I have been working on an LSP ( https://github.com/kylebonnici/dts-lsp ) for devicetree to help with everyday development.


First I would like to start with an overview of what an LSP is.

Most text editors/IDEs like Emacs, VSCode, VIM,  neoVim, VSCodium etc… provide functionality to make our life working with code a bit easier. Some of the main features that we would see when using an LSP are: 
- Syntax highlighting
- Document/Workspace Symbols
- Diagnostics to show errors such as syntax errors or warnings to help avoid common issues
- Code actions to help resolve diagnostic issues that were reported 
- Find all references
- Find definitions
- Find declarations
- Rename edits (refactoring)
- Hover tooltips with information related to the code in question
- And more; full spec can be found here https://microsoft.github.io/language-server-protocol/ 
I personally am not an Emacs user but I found some documentation on how to set this up. Emacs support this module, lsp-mode (https://emacs-lsp.github.io/lsp-mode/) and here you can find how to install and configure an LSP.

This LSP is not in the list that is natively supported by lsp-mode (https://emacs-lsp.github.io/lsp-mode/page/languages/  https://github.com/emacs-lsp/lsp-mode/blob/master/docs/lsp-clients.json ) but one can configure a custom LSP; this is documented here https://emacs-lsp.github.io/lsp-mode/page/adding-new-language/ 
This new Devicetree LSP can be installed using npm (https://www.npmjs.com/package/devicetree-language-server). Readme in npmjs is coming soon but you can see the one I have for VSCode for information on the structure of the configuration  (https://github.com/kylebonnici/dts-lsp/blob/main/README.md)

Installing the LSP on VSCodium or VSCode is quite easy; just download the VSIX file from https://github.com/kylebonnici/dts-lsp/releases and follow the steps on this guide https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix.

In the future, I will be adding this to the Microsoft marketplace and others, but first I’m looking for initial feedback to iron out anything that needs improvement. 

Non Emacs/VSCode/VSCodium users will need to read up on how this can be configured on their editor. 

What can this alpha version do so far?
- Document Formatting 
- Document/workspace symbols
- Syntax Diagnostics
- Type Diagnostics (Standard Types)
- Binding Diagnostics (Zephyr) 
- Go to Type (Zephyr)
- Auto completion
- Find all references
- Find all definitions
- Find declaration
- Node label Renaming
- Node name Renaming
- Property Renaming
- On hover (Current node state)
- On hover (Zephyr binding description)
- On hover (Standard Types description)

If you are not using Zephyr bindings, please do share with me some examples and docs of binding types that you think should be added so I can extend this LSP.

At this stage I have an LSP that works with the DTS Spec 0.4 and Implements Chapters 1 and 2. I will soon be adding the requirements for Chapter 3. 

Feel free to reach out to me or open issues directly on GitHub for any issue or feature request. 

Thanks and regards,
Kyle




[Index of Archives]     [Device Tree]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Photos]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]

  Powered by Linux