Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filetypes.Dockerfile.conf #3752

Open
andy5995 opened this issue Feb 5, 2024 · 7 comments · May be fixed by #3757
Open

filetypes.Dockerfile.conf #3752

andy5995 opened this issue Feb 5, 2024 · 7 comments · May be fixed by #3757

Comments

@andy5995
Copy link
Contributor

andy5995 commented Feb 5, 2024

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
@elextr
Copy link
Member

elextr commented Feb 5, 2024

You have not quite read the fine manual well enough 😁 check the format of the filenames for custom filetypes again.

@andy5995
Copy link
Contributor Author

andy5995 commented Feb 6, 2024

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

@andy5995 andy5995 changed the title filetypes.Dockerfile filetypes.Dockerfile.conf Feb 6, 2024
@elextr
Copy link
Member

elextr commented Feb 6, 2024

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.
lexer_filetype=Dockerfile

Well thats because there is no Dockerfile lexer, which is because there is not one in the Lexilla 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.

@elextr
Copy link
Member

elextr commented Feb 6, 2024

PS the extension= setting is the default extension for new files, so its only one value, not a list

@andy5995
Copy link
Contributor Author

andy5995 commented Feb 6, 2024

Thanks.

I consulted phind 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/"

@elextr
Copy link
Member

elextr commented Feb 6, 2024

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]).

andy5995 added a commit to andy5995/geany that referenced this issue Feb 9, 2024
Per @elextr will require further discussion.

Closes geany#3752 but
@andy5995 andy5995 linked a pull request Feb 9, 2024 that will close this issue
@andy5995
Copy link
Contributor Author

andy5995 commented Feb 9, 2024

Any other docker users want to comment (for example the one using docker to build Geany for Windows [end subtle]).

PR #3757 opened. @rcjsuen @alexr00

andy5995 added a commit to andy5995/geany that referenced this issue Feb 9, 2024
Per @elextr will require further discussion.

Closes geany#3752 but
andy5995 added a commit to andy5995/geany that referenced this issue Feb 9, 2024
Per @elextr will require further discussion.

Closes geany#3752 but
andy5995 added a commit to andy5995/geany that referenced this issue Feb 13, 2024
Per @elextr will require further discussion.

Closes geany#3752 but
andy5995 added a commit to andy5995/geany that referenced this issue May 10, 2024
Per @elextr will require further discussion.

Closes geany#3752 but
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants