See http://editorconfig.org/. Inspired by similar commit in universal-ctags.
The main reason why this might be interesting is that github understands it and shows correct tab sizes e.g. in pull requests. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1193
-- Commit Summary --
* Add .editorconfig
-- File Changes --
A .editorconfig (11)
-- Patch Links --
https://github.com/geany/geany/pull/1193.patch https://github.com/geany/geany/pull/1193.diff
Mmm… looks odd to add this when Geany doesn't support it in a "official-ish" way, but well. I kinda have no opinion on this one.
Yeah, it was just a suggestion. I just remembered it when I was looking at the code at github and tabs were too long. There's a Geany plugin here
https://github.com/editorconfig/editorconfig-geany#readme
but I haven't checked what it does.
I sort of agree with @b4n, adding this to Geany, which doesn't use it, is likely to confuse people. "I changed the `.editorconfig` and the Geany editor settings didn't change?"
Might be nice to see if the plugin dev wants to add the plugin to G-P and help them with it, or at least reference it from the "third party" section of the plugins pages.
Too bad it couldn't be called `.github.editorconfig` to avoid the confusion.
IMO, if it doesn't have to be `dist`ed, and is just for dev tools, why not add it? Maybe I'm bias, I read a lot of Geany's code on Github's web UI :)
Might be nice to see if the plugin dev wants to add the plugin to G-P and help them with it, or at least reference it from the "third party" section of the plugins pages.
Yeah, but it shouldn't block this PR. All it does is add some boilerplate file to make Geany's code look OK on Github. Nowhere in the tarball release or installed program does it have to mention `.editorconfig`, confusing users.
Yeah, not `dist`ing it would be fine.
@b4n, are you happy to add this to "fix" github, if the `.editorconfig` is not `dist`ed?
This format is supported "official-ish" in the EditorConfig project, at least.
+1 for this, though I haven't tested it or the Geany plugin yet.
Yeah why not, as said I don't really mind, and if it helps sure.
b4n commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
couldn't that apply to everything, and only special-case some other stuff? Or is the goal here not to risk overriding an automatic detection for stuff we don't know about for sure?
elextr commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
it should be gobal. When we edit Geany in Geany all filetypes should get indent 4 and the idea is to make github look the same.
b4n commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
Indentation width seems global, just not style (tab or space)
elextr commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
Sorry, should have added, my googling seems to suggest that the indent_width only works where indent_style = tab.
b4n commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
Seems its spelled `indent_size` :) And I'd be surprised if there was no way to change the indentation size when using spaces. Though, there indeed might be a setting to select the tab width, which might be different from the indentation step size.
elextr commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
width/size whatever :) the point is that from what I could find by googling (there is no official github documentation) is that github only uses the .editorconfig indent_size if indent_style = tab.
I guess it figures that if style is set to spaces then it better show the actual spaces, and if it comes across a tab, well let it show whatever the users ?ts= setting is (or default 8)
b4n commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
Oh you mean for display. Yeah sure then width doesn't matter for spaces. And to check GitHub it's fairly easy, just browse the file as changed by this PR: https://github.com/techee/geany/blob/a3ab9b63f731498a8b70074f8355beb343cfbfd... and see it works :)
elextr commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
Yeah, thats what I mean.
But, I guess limiting the indent_type=tab to only the filetypes that need it is probably useful when used for editing files. Wouldn't want Python scripts to get tabs in them would we :)
techee commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
Or is the goal here not to risk overriding an automatic detection for stuff we don't know about for sure?
Yes, that was the intention. Though as Geany doesn't use the editorconfig file right now it really doesn't matter much and I can change it to whatever else.
b4n commented on this pull request.
@@ -0,0 +1,11 @@
+root = true + +[*] +indent_size = 4 +end_of_line = lf + +[*.{c,h,cxx,am,m4}] +indent_style = tab
Nah, it makes sense.
If I were to contribute, for instance on starting a `nb` Norwegian Bokmål language file, I'd use VSCode on Windows. Wouldn't Geany maintainers be interested in making sure whatever IDE contributors use respect the chosen coding style, syntax, line endings for this project? Do you have a different way to enforce this?
@o-l-a-v Contributions to Geany need to be tested and used in Geany so they are are usually developed in Geany as well and thus use the default configuration that is part of Geany. Nobody is encouraged to use a foreign IDE to develop Geany contributions since the contributions need to be tested in Geany anyway. Therefore providing a `.editorconfig` file is not useful since a Geany user would have to obtain and load a foreign editorconfig plugin to use it in Geany when the default settings are part of Geany default setup.
IIUC you are intending to make a `.po` file for your language and again Geany has `.po` language support in Geany with the default file support provided by the `filetype.po` and `filetype.common` that defines that language for Geany PO files. That will be available in Geany in Windows.
As the `.editorconfig` file has not been added eight years ago, and no later requests have occurred, rather suggests nobody is using other IDEs for contributions to Geany. So there is no use for a `.editorconfig` file.
@o-l-a-v Contributions to Geany need to be tested and used in Geany so they are are usually developed in Geany as well and thus use the default configuration that is part of Geany. Nobody is encouraged to use a foreign IDE to develop Geany contributions since the contributions need to be tested in Geany anyway. Therefore providing a .editorconfig file is not useful since a Geany user would have to obtain and load a foreign editorconfig plugin to use it in Geany when the default settings are part of Geany default setup.
Well, I tried to add it because github uses it when displaying sources and right now it uses 8 for tab sizes instead of Geany's 4 which sometimes makes sources indented incorrectly. So I'd still like it but there doesn't seem to be a big support of this from others so I abandoned it.
By the way, there's also this plugin
https://github.com/editorconfig/editorconfig-geany
I think adding it is no big deal and if it is used by Github, it is worth it. I agree on not `dist`ing it.
> I agree on not disting it.
Which pretty much means what I did - i.e. just added the file without adding it to Makefile.am or meson. Is that correct?
@techee
> Well, I tried to add it because __github uses it when displaying sources__ and right now it uses 8 for tab sizes instead of Geany's 4 which sometimes makes sources indented incorrectly.
My highlighting is noticed :-)
I can't find anything in github docs that says it follows editorconf settings, although there are various hints and on editorconf website it lists github. If it does work then its waaaay more worthwhile that Geany code is shown on Github as 4 not 8. Has it been tested? If it works then merge last year :-)
Since its only for github @eht16 point not to dist is fine, managing settings for other stuff is too much work.
> > I agree on not disting it. > > Which pretty much means what I did - i.e. just added the file without adding it to Makefile.am or meson. Is that correct?
Yes. I just wanted to say that I second this. Sorry if I haven't been clear.
https://github.com/cirosantilli/test-editorconfig/tree/master this looks like it is respected by Github.
So, let's just try, it is only one small file. If it works, we could add it as well for G-P.
Merged #1193 into master.
Yah, works, merged!!!!
If only github had documented it :-(
> So, let's just try, it is only one small file. If it works, we could add it as well for G-P.
Could be tested on the branch adding this file, see https://github.com/geany/geany/pull/1193#discussion_r83170609
I'll prepare the same PR for G-P as well.
> I'll prepare the same PR for G-P as well.
Done in https://github.com/geany/geany-plugins/pull/1381.
github-comments@lists.geany.org