changeset 36419:88a9b794b773 draft v9.1.0823

patch 9.1.0823: filetype: Zephyr overlay files not recognized Commit: https://github.com/vim/vim/commit/a68bd6f089239a51ba90026b18109707e601b107 Author: Xudong Zheng <7pkvm5aw@slicealias.com> Date: Thu Oct 31 09:32:25 2024 +0100 patch 9.1.0823: filetype: Zephyr overlay files not recognized Problem: filetype: Zephyr overlay files not recognized Solution: detect '*.overlay' files as dts filetype, include syntax tests for DTS files (Xudong Zheng) Reference: https://docs.zephyrproject.org/latest/build/dts/howtos.html closes: #15963 Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 31 Oct 2024 09:45:02 +0100
parents 6259ba7c80d9
children 18023c4ab7e4
files runtime/filetype.vim runtime/syntax/testdir/dumps/dts_zephyr_00.dump runtime/syntax/testdir/dumps/dts_zmk_00.dump runtime/syntax/testdir/dumps/dts_zmk_01.dump runtime/syntax/testdir/input/dts_zephyr.overlay runtime/syntax/testdir/input/dts_zmk.keymap src/testdir/test_filetype.vim src/version.c
diffstat 8 files changed, 108 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -754,8 +754,12 @@ au BufNewFile,BufRead *.dsl
 " DTD (Document Type Definition for XML)
 au BufNewFile,BufRead *.dtd			setf dtd
 
-" DTS/DSTI/DTSO (device tree files)
-au BufNewFile,BufRead *.dts,*.dtsi,*.dtso,*.its,*.keymap	setf dts
+" Devicetree (.its for U-Boot Flattened Image Trees, .keymap for ZMK keymap, and
+" .overlay for Zephyr overlay)
+au BufNewFile,BufRead *.dts,*.dtsi,*.dtso	setf dts
+au BufNewFile,BufRead *.its			setf dts
+au BufNewFile,BufRead *.keymap			setf dts
+au BufNewFile,BufRead *.overlay			setf dts
 
 " Earthfile
 au BufNewFile,BufRead Earthfile			setf earthfile
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/dts_zephyr_00.dump
@@ -0,0 +1,20 @@
+>/+0&#ffffff0| |{| @71
+@8|c+0#00e0003&|h|o|s|e|n| |{+0#0000000&| @58
+@16|z|e|p|h|y|r|,|u|a|r|t|-|m|c|u|m|g|r| |=| |&+0#e000e06&|c|d|c|_|a|c|m|_|u|a|r|t|0|;+0#0000000&| @22
+@16|z|e|p|h|y|r|,|s|h|e|l@1|-|u|a|r|t| |=| |&+0#e000e06&|c|d|c|_|a|c|m|_|u|a|r|t|1|;+0#0000000&| @23
+@8|}|;| @64
+|}|;| @72
+@75
+|&+0#e000e06&|z|e|p|h|y|r|_|u|d|c|0| +0#0000000&|{| @60
+| +0#af5f00255&@7|c|d|c|_|a|c|m|_|u|a|r|t|0|:| +0#0000000&|c+0#00e0003&|d|c|_|a|c|m|_|u|a|r|t|0| |{+0#0000000&| @36
+@16|c|o|m|p|a|t|i|b|l|e| |=| |"+0#e000002&|z|e|p|h|y|r|,|c|d|c|-|a|c|m|-|u|a|r|t|"|;+0#0000000&| @23
+@8|}|;| @64
+@75
+| +0#af5f00255&@7|c|d|c|_|a|c|m|_|u|a|r|t|1|:| +0#0000000&|c+0#00e0003&|d|c|_|a|c|m|_|u|a|r|t|1| |{+0#0000000&| @36
+@16|c|o|m|p|a|t|i|b|l|e| |=| |"+0#e000002&|z|e|p|h|y|r|,|c|d|c|-|a|c|m|-|u|a|r|t|"|;+0#0000000&| @23
+@8|}|;| @64
+|}|;| @72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/dts_zmk_00.dump
@@ -0,0 +1,20 @@
+>#+0#e000e06#ffffff0|i|n|c|l|u|d|e| |<+0#e000002&|b|e|h|a|v|i|o|r|s|.|d|t|s|i|>| +0#0000000&@49
+|#+0#e000e06&|i|n|c|l|u|d|e| |<+0#e000002&|d|t|-|b|i|n|d|i|n|g|s|/|z|m|k|/|k|e|y|s|.|h|>| +0#0000000&@41
+@75
+|/+0#0000e05&@1| |D|e|f|i|n|e| |m|a|c|r|o| |f|o|r| |l|a|y|e|r|s|.| +0#0000000&@47
+|#+0#e000e06&|d|e|f|i|n|e| |L|A|Y|E|R|_|M|A|I|N| |0| +0#0000000&@54
+@75
+|/| |{| @71
+@8|k+0#00e0003&|e|y|m|a|p| |{+0#0000000&| @58
+@16|c|o|m|p|a|t|i|b|l|e| |=| |"+0#e000002&|z|m|k|,|k|e|y|m|a|p|"|;+0#0000000&| @32
+@75
+@16|l+0#00e0003&|a|y|e|r|_|0| |{+0#0000000&| @49
+@24|b|i|n|d|i|n|g|s| |=| |<+0#e000002&| +0#0000000&@38
+| +0#e000002&@31|&+0#e000e06&|k|p| +0#e000002&|Z| +0#0000000&@37
+| +0#e000002&@31|&+0#e000e06&|k|p| +0#e000002&|M| +0#0000000&@37
+| +0#e000002&@31|&+0#e000e06&|k|p| +0#e000002&|K| +0#0000000&@37
+| +0#e000002&@31|&+0#e000e06&|z|m|k|_|s|t|r|i|n|g| +0#0000000&@31
+| +0#e000002&@31|&+0#e000e06&|t|o| +0#e000002&|L|A|Y|E|R|_|M|A|I|N| +0#0000000&@28
+| +0#e000002&@23|>|;+0#0000000&| @48
+@16|}|;| @56
+@57|1|,|1| @10|T|o|p| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/dts_zmk_01.dump
@@ -0,0 +1,20 @@
+| +0#e000002#ffffff0@31|&+0#e000e06&|k|p| +0#e000002&|M| +0#0000000&@37
+| +0#e000002&@31|&+0#e000e06&|k|p| +0#e000002&|K| +0#0000000&@37
+| +0#e000002&@31|&+0#e000e06&|z|m|k|_|s|t|r|i|n|g| +0#0000000&@31
+| +0#e000002&@31|&+0#e000e06&|t|o| +0#e000002&|L|A|Y|E|R|_|M|A|I|N| +0#0000000&@28
+| +0#e000002&@23|>|;+0#0000000&| @48
+@16>}|;| @56
+@8|}|;| @64
+@75
+@8|Z|M|K|_|M|A|C|R|O|(|z|m|k|_|s|t|r|i|n|g|,| |w|a|i|t|-|m|s| |=| |<+0#e000002&|1|0|>|;+0#0000000&| |t|a|p|-|m|s| |=| |<+0#e000002&|1|0|>|;+0#0000000&| |b|i|n|d|i|n|g|s| |=| |<+0#e000002&|&+0#e000e06&|m
+|a|c|r|o|_|t|a|p| +0#e000002&|&+0#e000e06&|k|p| +0#e000002&|Z| |&+0#e000e06&|k|p| +0#e000002&|M| |&+0#e000e06&|k|p| +0#e000002&|K|>|;+0#0000000&|)| @45
+|}|;| @72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|9|,|3|-|1|7| @6|B|o|t| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/input/dts_zephyr.overlay
@@ -0,0 +1,16 @@
+/ {
+	chosen {
+		zephyr,uart-mcumgr = &cdc_acm_uart0;
+		zephyr,shell-uart = &cdc_acm_uart1;
+	};
+};
+
+&zephyr_udc0 {
+	cdc_acm_uart0: cdc_acm_uart0 {
+		compatible = "zephyr,cdc-acm-uart";
+	};
+
+	cdc_acm_uart1: cdc_acm_uart1 {
+		compatible = "zephyr,cdc-acm-uart";
+	};
+};
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/input/dts_zmk.keymap
@@ -0,0 +1,23 @@
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/keys.h>
+
+// Define macro for layers.
+#define LAYER_MAIN 0
+
+/ {
+	keymap {
+		compatible = "zmk,keymap";
+
+		layer_0 {
+			bindings = <
+				&kp Z
+				&kp M
+				&kp K
+				&zmk_string
+				&to LAYER_MAIN
+			>;
+		};
+	};
+
+	ZMK_MACRO(zmk_string, wait-ms = <10>; tap-ms = <10>; bindings = <&macro_tap &kp Z &kp M &kp K>;)
+};
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -239,7 +239,7 @@ def s:GetFilenameChecks(): dict<list<str
     dracula: ['file.drac', 'file.drc', 'file.lvs', 'file.lpe', 'drac.file'],
     dtd: ['file.dtd'],
     dtrace: ['/usr/lib/dtrace/io.d'],
-    dts: ['file.dts', 'file.dtsi', 'file.dtso', 'file.its', 'file.keymap'],
+    dts: ['file.dts', 'file.dtsi', 'file.dtso', 'file.its', 'file.keymap', 'file.overlay'],
     dune: ['jbuild', 'dune', 'dune-project', 'dune-workspace', 'dune-file'],
     dylan: ['file.dylan'],
     dylanintr: ['file.intr'],
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    823,
+/**/
     822,
 /**/
     821,