This can be used with the corresponding custom filetype.
@techee @elextr @b4n do we have some policy or already decided in the past how we handle ctags parsers and Scintilla lexers for filetype which are not included in Geany?
In this case, it is only a ctags parser for HCL for which we have a custom filetype in the wiki (https://wiki.geany.org/config/hcl-terraform) but not in Geany. Obviously, it'd be nice to be able to use the existing ctags parser with the custom filetype.
`terraform.c` is taken from uctags master without modifications, same for the unittest file. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/4237
-- Commit Summary --
* Add HCL (Terraform/OpenTofu) ctags parser
-- File Changes --
M ctags/Makefile.am (1) A ctags/optlib/terraform.c (88) 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) M tests/ctags/runner.sh (3) 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/4237.patch https://github.com/geany/geany/pull/4237.diff
@eht16 commented on this pull request.
@@ -18,6 +18,9 @@ mkdir -p "$CONFDIR/filedefs/" || exit 99
# are no extension patterns, like e.g. Meson. sed 's/^([^=[]{1,})(=[^;]{1,}(;[^;]{1,})*);*$/\1\2;*.\1_unittest;/' \ < "${top_srcdir:-../..}"/data/filetype_extensions.conf > "$CONFDIR/filetype_extensions.conf" || exit 99 +# add HCL filetype extension for the Terraform parser test (HCL is not an official Geany filetype) +echo 'HCL=*.tf;*.tfvars;*.hcl;' >> "$CONFDIR/filetype_extensions.conf"
I feel dirty :(.
Though I had to add this to make Geany recognize the file extension and map to the correct parser.
@techee @elextr @b4n do we have some policy or already decided in the past how we handle ctags parsers and Scintilla lexers for filetype which are not included in Geany?
Wouldn't it actually be best to grab
https://github.com/xird/geany-hcl-syntax-highlighting
and make it an official Geany filetype?
@b4n commented on this pull request.
@@ -18,6 +18,9 @@ mkdir -p "$CONFDIR/filedefs/" || exit 99
# are no extension patterns, like e.g. Meson. sed 's/^([^=[]{1,})(=[^;]{1,}(;[^;]{1,})*);*$/\1\2;*.\1_unittest;/' \ < "${top_srcdir:-../..}"/data/filetype_extensions.conf > "$CONFDIR/filetype_extensions.conf" || exit 99 +# add HCL filetype extension for the Terraform parser test (HCL is not an official Geany filetype) +echo 'HCL=*.tf;*.tfvars;*.hcl;' >> "$CONFDIR/filetype_extensions.conf"
As @techee said, why not add the filetype? Is it of too poor quality and cannot be made better, or is it a question of how much the language is spread? If it's useful I don't see why not adding it ptoperly rather than adding a hack like that :)
@eht16 commented on this pull request.
@@ -18,6 +18,9 @@ mkdir -p "$CONFDIR/filedefs/" || exit 99
# are no extension patterns, like e.g. Meson. sed 's/^([^=[]{1,})(=[^;]{1,}(;[^;]{1,})*);*$/\1\2;*.\1_unittest;/' \ < "${top_srcdir:-../..}"/data/filetype_extensions.conf > "$CONFDIR/filetype_extensions.conf" || exit 99 +# add HCL filetype extension for the Terraform parser test (HCL is not an official Geany filetype) +echo 'HCL=*.tf;*.tfvars;*.hcl;' >> "$CONFDIR/filetype_extensions.conf"
As @techee said, why not add the filetype? Is it of too poor quality and cannot be made better, or is it a question of how much the language is spread? If it's useful I don't see why not adding it ptoperly rather than adding a hack like that :)
It was a question of "how much the language is spread" for me. But if we agree that it's fine to add a custom filetype, I'd be happy.
Closed #4237.
eht16 left a comment (geany/geany#4237)
Ok cool, I created #4246 to add a custom filetype for HCL.
And it's actually based on https://github.com/xird/geany-hcl-syntax-highlighting. I will ping them once we agreed and merged #4246 and also update the wiki accordingly.
github-comments@lists.geany.org