I'm trying to add a `Dockerfile` filetype (primarily so I can use Format->comment_lines in Geany).
When I select Document->filetype, the Dockerfile type doesn't magically appear. Anyone around to give me clues?
My custom filetype_extensions.conf
``` # Filetype extension configuration file for Geany # Insert as many items as you want, separate them with a ";". # See Geany's main documentation for details. [Extensions] Dockerfile=Dockerfile;
# Note: restarting is required after editing groups [Groups] Programming=Arduino;Clojure;CUDA;Cython;Genie;Groovy;Kotlin;Nim;Scala;Swift; Script=Graphviz;TypeScript;Meson; Markup= Misc=JSON;Dockerfile; None= ```
And my filetypes.Dockerfile
``` # For complete documentation of this file, please see Geany's main documentation [styling=cmake]
[keywords] primary=ADD ARG CMD COPY ENV RUN FROM USER WORKDIR
[settings] # default extension used when saving files extension=Dockerfile
# MIME type mime_type=text/x-Dockerfile
# single comments, like # in this file comment_single=# comment_use_indent=false
# context action command (please see Geany's main documentation for details) context_action_cmd=
[indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0 ```
You have not _quite_ read the [fine manual](https://www.geany.org/manual/current/index.html#custom-filetypes) well enough :grin: check the format of the filenames for custom filetypes again.
The format of the filenames... I've renamed it to `filetypes.Dockerfile.conf` and now it shows up under Document->filetype->Misc but there's no syntax highlighting when I'm viewing a Dockerfile.
``` [styling] # Default styles default=default comment=comment string=string number=number operator=operator identifier=identifier preprocessor=preprocessor keyword=keyword directive=directive builtins=builtins line_marker=line_marker
[keywords] instruction=FROM AS COPY ADD RUN CMD ENTRYPOINT ARG ENV WORKDIR EXPOSE directive=FROM AS ARG CMD COPY ENTRYPOINT ENV EXPOSE FROM LABEL ONBUILD RUN STOPSIGNAL USER VOLUME WORKDIR builtins=ADD COPY ENTRYPOINT ENV EXPOSE FROM LABEL STOPSIGNAL USER VOLUME WORKDIR
[lexer_properties] comment_single=# comment_open=<!-- comment_close=-->
[settings] lexer_filetype=Dockerfile extension=docker;Dockerfile;*Dockerfile;Dockerfile*;docker;
# MIME type mime_type=text/x-Dockerfile
# set to false if a comment character/string should start at column 0 of a line, true uses any # indentation of the line, e.g. setting to true causes the following on pressing CTRL+d # #command_example(); # setting to false would generate this # # command_example(); # This setting works only for single line comments comment_use_indent=false
# context action command (please see Geany's main documentation for details) context_action_cmd=
[indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0 ```
I've renamed it to filetypes.Dockerfile.conf and now it shows up under Document->filetype->Misc :+1:
but there's no syntax highlighting when I'm viewing a Dockerfile. `lexer_filetype=Dockerfile`
Well thats because there is no Dockerfile lexer, which is because there is not one in the [Lexilla](https://github.com/ScintillaOrg/lexilla/tree/master/lexers) project they come from. A "custom" filetype is really a "customisation" of existing filetypes, so it can only use lexers already in Geany. You might find one that is "good enough" but YMMV.
PS the `extension=` setting is the default extension for new files, so its only one value, not a list
Thanks.
I consulted [phind](https://www.phind.com/search?cache=m3jm69uiaqguzjakctnepwd9) to get it to work. You want a PR?
``` [styling=C] [keywords] primary= ADD ARG CMD COPY ENTRYPOINT ENV EXPOSE FROM HEALTHCHECK LABEL MAINTAINER ONBUILD RUN SHELL STOPSIGNAL USER VOLUME WORKDIR [lexer_properties=C] [settings] lexer_filetype=Sh tag_parser=C extension= comment_single=# comment_use_indent=true context_action_cmd=xdg-open "https://docs.docker.com/engine/reference/builder/" ```
While the lexer_filetype being sh seems ok (based on 10 secs inspection of dockerfile format), but does the C tagparser really generate useful symbols?
Any other docker users want to comment (for example the one using docker to build Geany for Windows [end subtle]).
Any other docker users want to comment (for example the one using docker to build Geany for Windows [end subtle]).
PR https://github.com/geany/geany/pull/3757 opened. @rcjsuen @alexr00
Closed #3752 as completed via #3757.
github-comments@lists.geany.org