devicetree-language-server 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -0
- package/dist/server.js +150 -150
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,6 +47,10 @@ interface Settings {
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
### Sample configurations
|
|
51
|
+
|
|
52
|
+
#### kakoune
|
|
53
|
+
|
|
50
54
|
Sample configuration in for `kakoune` with `Zephyr` 3.7.99 or later.
|
|
51
55
|
Contribution by [topisani](https://github.com/topisani)
|
|
52
56
|
|
|
@@ -75,6 +79,94 @@ EOF
|
|
|
75
79
|
}
|
|
76
80
|
```
|
|
77
81
|
|
|
82
|
+
#### neovim
|
|
83
|
+
|
|
84
|
+
Example setup using [lazygit](https://github.com/jesseduffield/lazygit)
|
|
85
|
+
|
|
86
|
+
```lua
|
|
87
|
+
return {
|
|
88
|
+
"neovim/nvim-lspconfig",
|
|
89
|
+
opts = function(_, opts)
|
|
90
|
+
-- Don't let Mason try to handle this custom server
|
|
91
|
+
opts.servers.devicetree_ls = nil
|
|
92
|
+
|
|
93
|
+
local lspconfig = require("lspconfig")
|
|
94
|
+
local configs = require("lspconfig.configs")
|
|
95
|
+
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
96
|
+
|
|
97
|
+
-- Enable semantic tokens
|
|
98
|
+
capabilities.textDocument = capabilities.textDocument or {}
|
|
99
|
+
capabilities.textDocument.semanticTokens = {
|
|
100
|
+
dynamicRegistration = false,
|
|
101
|
+
requests = {
|
|
102
|
+
range = false,
|
|
103
|
+
full = true,
|
|
104
|
+
},
|
|
105
|
+
tokenTypes = {
|
|
106
|
+
"namespace", "class", "enum", "interface", "struct", "typeParameter", "type",
|
|
107
|
+
"parameter", "variable", "property", "enumMember", "decorator", "event", "function",
|
|
108
|
+
"method", "macro", "label", "comment", "string", "keyword", "number", "regexp", "operator",
|
|
109
|
+
},
|
|
110
|
+
tokenModifiers = {
|
|
111
|
+
"declaration", "definition", "readonly", "static", "deprecated", "abstract",
|
|
112
|
+
"async", "modification", "documentation", "defaultLibrary",
|
|
113
|
+
},
|
|
114
|
+
formats = {'relative'}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
-- Enable formatting
|
|
118
|
+
capabilities.textDocument.formatting = {
|
|
119
|
+
dynamicRegistration = false
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
-- Enable folding range support
|
|
123
|
+
capabilities.textDocument.foldingRange = {
|
|
124
|
+
dynamicRegistration = false,
|
|
125
|
+
lineFoldingOnly = true,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if not configs.devicetree_ls then
|
|
129
|
+
configs.devicetree_ls = {
|
|
130
|
+
default_config = {
|
|
131
|
+
cmd = { "devicetree-language-server", "--stdio" },
|
|
132
|
+
filetypes = { "dts", "dtsi" },
|
|
133
|
+
root_dir = lspconfig.util.root_pattern("zephyr", ".git", "."),
|
|
134
|
+
settings = {
|
|
135
|
+
devicetree = {
|
|
136
|
+
defaultIncludePaths = {
|
|
137
|
+
"./zephyr/dts",
|
|
138
|
+
"./zephyr/dts/arm",
|
|
139
|
+
"./zephyr/dts/arm64/",
|
|
140
|
+
"./zephyr/dts/riscv",
|
|
141
|
+
"./zephyr/dts/common",
|
|
142
|
+
"./zephyr/dts/vendor",
|
|
143
|
+
"./zephyr/include"
|
|
144
|
+
},
|
|
145
|
+
cwd = "${workspaceFolder}",
|
|
146
|
+
defaultBindingType = "Zephyr",
|
|
147
|
+
defaultZephyrBindings = {
|
|
148
|
+
"./zephyr/dts/bindings"
|
|
149
|
+
},
|
|
150
|
+
autoChangeContext = true,
|
|
151
|
+
allowAdhocContexts = true,
|
|
152
|
+
contexts = {},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
capabilities = capabilities,
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
vim.notify("Custom devicetree_ls LSP loaded with semantic tokens & folding")
|
|
161
|
+
|
|
162
|
+
-- Setup the LSP
|
|
163
|
+
lspconfig.devicetree_ls.setup({
|
|
164
|
+
capabilities = capabilities,
|
|
165
|
+
})
|
|
166
|
+
end,
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
78
170
|
## Using Devicetree-Org bindings example settings
|
|
79
171
|
|
|
80
172
|
```json
|