syntax: fix TOML / add Kconfig syntax highlighting#5009
Conversation
|
Please note that I used It looks like Dockerfile file matching rules are incorrect, as all files in Dockerfile* directory will be treated as docker files. |
|
BTW, I decided to highlight kconfig output files as Java properties, just because
|
Actually, there are quite a lot of rules (starting from the very first ones) that assume that we match on the filename and not the full path to the file. @mc-worker, do you know if there is a reason why we actually match on the full path to the file and does it make sense? Maybe we should change this to really only matching on the file name? % git diff
diff --git a/src/editor/syntax.c b/src/editor/syntax.c
index 9ccef28ae..8da7173d8 100644
--- a/src/editor/syntax.c
+++ b/src/editor/syntax.c
@@ -1555,7 +1555,7 @@ edit_load_syntax (WEdit *edit, GPtrArray *pnames, const char *type)
f = mc_config_get_full_path (EDIT_SYNTAX_FILE);
if (edit != NULL)
- r = edit_read_syntax_file (edit, pnames, f, vfs_path_as_str (edit->filename_vpath),
+ r = edit_read_syntax_file (edit, pnames, f, vfs_path_get_last_path_str (edit->filename_vpath),
get_first_editor_line (edit),
auto_syntax ? NULL : edit->syntax_type);
else |
* Fix broken comments handling. * Support escapes in basic (double-quoted) strings. * Highlight literal (single-quoted) strings. * Support multi-line strings. * Make tables (sections) easily distinguishable from comments. * Make highlighting of inline tables consistent. * Unify colors with other syntax files like YAML / C / Shell. Signed-off-by: Sergey Naumov <sknaumov@gmail.com> Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
ab71e52 to
68567d7
Compare
@KuzinAndrey, since you submitted the Dockerfile rules in #4788, could you please have a look at that and possibly other instances? Actually, I would love to see someone replace |
* Implement Kconfig specification with Kconfiglib extensions. * Highlight the following files: - Kconfig / Kconfig.* - for Linux kernel, U-Boot, Zephyr - Config.in / Config.in.* / Config.src - for Buildroot, Busybox - *.kconf / *.kconfig - just alternative extension-based variant Signed-off-by: Sergey Naumov <sknaumov@gmail.com> Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
* .config is already highlighted as Java properties => reuse it. It is not ideal, but better than nothing. * Additionally hightlight: - .config.* - e.g. .config.old produced by Kconfig. - *defconfig - used in Linux kernel, Buildroot, Busybox, U-Boot, Zephyr. * Kconfig.defconfig should still be treated as Kconfig definition file, not as its output. Signed-off-by: Sergey Naumov <sknaumov@gmail.com> Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
68567d7 to
09df6e0
Compare
zyv
left a comment
There was a problem hiding this comment.
Okay, I'm sorry for the lack of reaction. I have rebased the PR and updated the patterns to make them more understandable to me. @sknaumov, could you please check this?
I think this should be neither held back by #5067, nor the Dockerfile comment and/or other rule mistakes, of which it seems that we have plenty.
Hopefully, @KuzinAndrey would be interested enough to maybe clean the mistakes up, add case-insensitiveness where it makes sense, and make the patterns more understandable. He's done some valuable contributions in this direction in the past.
In my opinion, we should merge this.
|
@zyv i don't undestand issue with Dockefile rule.
And regexp with chars Or you can make these changes yourself. |
|
@zyv I used
|
Proposed changes
Improve syntax highlighting:
Highlight Kconfig output files.
Checklist
git commit --amend -smake indent && make check)I've not tried to build / install mc - I tested my changes on existing installation by modifying
/usr/share/mc/syntax/*files.