Files are always called "meson.build"
Here is an example: https://git.gnome.org/browse/glib/plain/meson.build
Here is a configuration for the syntax highlighting library meson uses for their documentation, which might help: https://github.com/mesonbuild/meson/blob/master/docs/theme/extra/prism_compo...
Somebody could make a custom filetype using Python or maybe cmake as the base type.
Here is a typical meson.build file, from the project gnome-builder:
project('gnome-builder', 'c', license: 'GPL3+', version: '3.26.4', meson_version: '>= 0.40.1', default_options: [ 'c_std=gnu11', 'cpp_std=c++11', 'warning_level=2', 'with_channel=other', ], )
version_split = meson.project_version().split('.') MAJOR_VERSION = version_split[0] MINOR_VERSION = version_split[1] MICRO_VERSION = version_split[2]
pkgdocdir_abs = join_paths(get_option('prefix'), get_option('datadir'), 'doc', 'gnome-builder') pkglibdir_abs = join_paths(get_option('prefix'), get_option('libdir'), 'gnome-builder') pkglibdir = join_paths(get_option('libdir'), 'gnome-builder') pkgincludedir = join_paths(get_option('includedir'), 'gnome-builder') pkggirdir = join_paths(get_option('datadir'),'gnome-builder', 'gir-1.0') pkgtypelibdir = join_paths(get_option('libdir'), 'gnome-builder', 'girepository-1.0') pkgvapidir = join_paths(get_option('datadir'), 'gnome-builder/vapi')
I think it is a python file. Would it work to just associate ".meson" file types with the ".py" extension? Is there a document that describes how to add such a new file type (or associate with it?)
If it is really just a python file then it may be enough to just append ".meson" as to how .py files are parsed.
Not sure where the filetypes are defined; one file I found via grep was
**data/filetype_extensions.conf**:Python=*.py;*.pyw;SConstruct;SConscript;wscript;
Mapping extensions and creating custom filetypes are both covered in the Geany manual.
It would be better to create a custom filetype so that the reserved words can be changed to match meson, but personally I don't bother, meson "just works" and I don't spend much time staring at its files.
I don't know if this is really the "right" way, but it's working for now.
After you create the file below, edit `filetype_extensions.conf` and add
`Meson=*.build`
## filetypes.Meson.conf
``` [styling=Python]
[keywords] primary=if else elif endif foreach endforeach true false and not or in continue break identifiers=add_global_arguments add_global_link_arguments add_languages add_project_arguments add_project_link_arguments add_test_setup alias_target assert benchmark both_libraries build_target configuration_data configure_file custom_target declare_dependency dependency disabler error environment executable find_library find_program files generator get_option get_variable import include_directories install_data install_headers install_man install_subdir is_disabler is_variable jar join_paths library message warning summary project run_command run_target set_variable shared_library shared_module static_library subdir subdir_done subproject test vcs_tag
[lexer_properties=Python]
[settings] lexer_filetype=Python tag_parser=Meson extension=build comment_single=# mime_type=text/x-meson ```
tag_parser=Meson
No such thing, you can probably just leave `tag_parser` out.
Closed #1734 via #2850.
github-comments@lists.geany.org