New custom filetype for HCL.
Loosely based on https://github.com/xird/geany-hcl-syntax-highlighting.
`terraform.c` is taken from uctags master without modifications, same for the unittest file.
Replaces #4237. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/4246
-- Commit Summary --
* Add new filetype and ctags parser for Terraform HCL language
-- File Changes --
M ctags/Makefile.am (1) A ctags/optlib/terraform.c (88) M data/Makefile.am (1) A data/filedefs/filetypes.HCL.conf (40) M data/filetype_extensions.conf (1) M meson.build (1) M src/tagmanager/tm_parser.c (18) M src/tagmanager/tm_parser.h (1) M src/tagmanager/tm_parsers.h (3) M tests/ctags/Makefile.am (1) A tests/ctags/simple.tf (29) A tests/ctags/simple.tf.tags (12) M tests/meson.build (1)
-- Patch Links --
https://github.com/geany/geany/pull/4246.patch https://github.com/geany/geany/pull/4246.diff
techee left a comment (geany/geany#4246)
LGTM. I've just tested this (lightly) and it seems to work as expected.
@b4n commented on this pull request.
I can't say much about the language itself, but it seems to give reasonable results with the provided sample. See below for a couple comments.
@@ -0,0 +1,40 @@
+# For complete documentation of this file, please see Geany's main documentation +[styling=C] +# style "preprocessor" as comment, as for HCL lines starting with "#" are comments +preprocessor=comment + +[keywords] +# all items must be in one line +primary=data local locals module provider resource terraform var
There is neither `variable` nor `output`, yet those look like keywords in the `simple.ft` test file, aren't they?
+# style "preprocessor" as comment, as for HCL lines starting with "#" are comments
+preprocessor=comment
Hum… sounds like a hack :) I would suggest giving `[styling=HTML]` and `lexer_filetype=Zephir` a try. It looks a bit weird with the default colors because for some reasons strings are getting green, but Zephir being basically PHP it has all of `#`, `//` and `/* */` comments builtin. Just a suggestion, the hack here seems to work.
@@ -0,0 +1,40 @@
+# For complete documentation of this file, please see Geany's main documentation +[styling=C] +# style "preprocessor" as comment, as for HCL lines starting with "#" are comments +preprocessor=comment + +[keywords] +# all items must be in one line +primary=data local locals module provider resource terraform var +# for autocompletion tags, see https://wiki.geany.org/tags/start#hcl_terraformopentofu_tags + +[lexer_properties=C] +styling.within.preprocessor=0
An explanation of the relation to the comment hack would be welcome here
github-comments@lists.geany.org