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

Add Dockerfile filedef #3757

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add Dockerfile filedef #3757

wants to merge 1 commit into from

Conversation

andy5995
Copy link
Contributor

@andy5995 andy5995 commented Feb 9, 2024

Per @elextr this will require further discussion.

Closes #3752

@andy5995
Copy link
Contributor Author

andy5995 commented Feb 9, 2024

Source

image

@andy5995 andy5995 force-pushed the iss-3752 branch 2 times, most recently from 9d7ede1 to 93f5698 Compare February 9, 2024 15:44
@eht16
Copy link
Member

eht16 commented Feb 10, 2024

See also the already filetype configuration for Docker and Docker-Compose files in the wiki: https://wiki.geany.org/config/docker-compose.

It might be the version in the wiki could be updated for recent Docker features but it is already working.

@andy5995
Copy link
Contributor Author

See also the already filetype configuration for Docker and Docker-Compose files in the wiki: https://wiki.geany.org/config/docker-compose.

You don't want it included with the Geany distribution then?

@elextr
Copy link
Member

elextr commented Feb 12, 2024

@andy5995 I think the main point of @eht16's reply (putting words in his mouth :-) was that there are significant differences between the Wiki and your filetype, including more keywords in the wiki version, using Python not Sh for syntax etc etc so its unclear which is better and how to combine them. That would need to be resolved. I asked for user comment about how well yours works, so that question is now expanded to which is better, Dockers please comment.

As for putting it in the Geany release, there have always been debates about adding more filetypes, especially for filetypes that no or few Geany devs use, so we cannot support or make decisions about the filetypes adequacy. Each language makes the download bigger, adds to the filetype menu, and adds to support.

Personally I have flip/flopped a few times, but given that the "lightweight" bird has flown some time ago I don't think the cost of a small file for adding a custom filetype is material. Built-in filetypes are another thing.

The menu issue is harder to address, on small screens large menus may go offscreen, and as menus can't be scrolled that means some items can't be selected (there have been a number of issues about that). I don't have a solution for this as the Geany categories are hard coded (not that they are very good anyway), maybe it should be alphabetical, PRs welcome 😁.

As for support, thats where the question to the Docker users in general comes in, does it work well enough that you are actually going to use it?

@eht16
Copy link
Member

eht16 commented Feb 12, 2024

Full agree with what @elextr said, these were mostly the words already in my mouth, I just didn't speak it explicitly.

One addition: after this PR we should not have a Docker filetype in Geany and the wiki page as it is now. In the end, we should decide on one solution.

I think it might be worth to add the filetype to Geany itself, Dockerfiles are quite common and often used among developers. Then replace the wiki page with a stub page stating that it has been integrated into Geany and add a reference link to the Git version of the configuration file.

As for the support, if we decide to include the filetype in Geany, I can do a proper review. I use Dockerfiles regularly at work and around. Just be patient with me :D.

@dolik-rce
Copy link
Contributor

Hi, Docker user here.

I have tested both filetype definitions, the one from this PR and the one from wiki. As far as I can tell, they are not much different. I have noticed only one visual difference and that is that the configuration from @andy5995 renders strings in RUN commands better (because it uses sh lexer). It also has more up-to-date keywords (contains MAINTAINER).

The other file from wiki claims to also support docker-compose files. That is IMHO not very good idea, because those formats are completely different and should not be mixed in single configuration file. It can only lead to worse behavior in both filetypes.

As to whether the filetype should be bundled in Geany release: I'd definitely vote to include it. I am using Geany for years (I could probably say decades by now 😅) and it never occurred to me to search for Docker filetype support on wiki. If it were installed with geany, I would definitely be a happier user. It is also much easier than having to set this up manually (even though the documentation is great).

So I would vote to merge this (if I had any voting rights 😃) and perhaps remove the other version from wiki.

@elextr
Copy link
Member

elextr commented Feb 12, 2024

@dolik-rce thanks, if only we got more reviews by third parties things would proceed faster. I don't know how many people consult the wiki to find out configurations etc. Given the number of projects where the only docs are the wiki I would have thought many dedicated open sourcers would consult it, but beginners who installed from the distro (or windows installer) probably won't think to look, YMMV. And then there are those who forget ... what was I saying?? ;-)

@andy5995 @dolik-rce @eht16 I have some questions to try:

  1. would it be better to make extension= the canonical docker extension rather than empty, that way new docker files will get that extension automatically?

Given that the lexer is Sh and seems to work well

  1. why is the [styling=C] not [styling=Sh]` ?
  2. why is the tag_parser=C not tag_parser=Sh?

@andy5995
Copy link
Contributor Author

@dolik-rce thanks, if only we got more reviews by third parties things would proceed faster. I don't know how many people consult the wiki to find out configurations etc. Given the number of projects where the only docs are the wiki I would have thought many dedicated open sourcers would consult it, but beginners who installed from the distro (or windows installer) probably won't think to look, YMMV. And then there are those who forget ... what was I saying?? ;-)

@andy5995 @dolik-rce @eht16 I have some questions to try:

1. would it be better to make `extension=` the canonical docker extension rather than empty, that way new docker files will get that extension automatically?

Given that the lexer is Sh and seems to work well

2. why is the `[styling=C]` not [styling=Sh]` ?

3. why is the `tag_parser=C` not `tag_parser=Sh`?

Due to lack of understanding and QA on the part of @andy5995

Thanks for the explanation above, @elextr and for the feedback and testing @dolik-rce

@eht16
Copy link
Member

eht16 commented May 4, 2024

Nice.

I think we could add this new filetype and then update the wiki page to have it only a seperate docker-compose filetype and a reference to the GIT version of this Docker filetype. I'm happy to do this after merge.

Regarding the extension= setting: what do you think about using lower case? So that new files will be named "untitled.dockerfile". I don't know if there is a correct answer at all but IIRC what I've seen when there are mutliple dockerfiles is rather something like "Dockerfile.dev" or "Dockerfile.production" but we don't support this ordering in Geany.
So, when using extensions, they are usually written in lowercase in my experience.

For the reasons outlined above, I would add to the filetype extension list the pattern "Dockerfile.*" as this is more common than the others in my experience.

Do we need to adjust anything for the Meson build system?

Per @elextr will require further discussion.

Closes geany#3752 but
@andy5995
Copy link
Contributor Author

Do we need to adjust anything for the Meson build system?

No, this is in data/meson.build:

install_subdir('filedefs', install_dir: cdata.get('GEANY_DATA_DIR'), exclude_files: 'filetypes.python.in')

I think this is done now.

@eht16
Copy link
Member

eht16 commented May 20, 2024

If there are no objections, I would merge this next weekend and update the Wiki accordingly.

@eht16 eht16 added this to the 2.1 milestone May 20, 2024
@eht16
Copy link
Member

eht16 commented May 26, 2024

One last remark: could we add AS to the keywords? It's not strictly a directive on its own but is part of the FROM directive, e.g. FROM debian:bullseye-slim AS builder and without the highlighting looks a bit broken.

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 this pull request may close these issues.

filetypes.Dockerfile.conf
4 participants