Closed bennycode closed 9 years ago
+1 :+1: So - format on save + format on click "format source" in conext menu? i'd rather only have format on click ;)
+1 for format via menu "source/format" or click on context "format" -1 for format on save
:+1: on formatting when requesting a format anywhere (don't forget that you can call format for a directory structure also :)
:+1: on formatting on save IF its something that can be disabled/enabled per project or globally
I'm not sure whats the take on other plugins that how they work relating formatting on save.
Case example where automatic on save formatting is bad: you amend a old file add a minor fix or enhancement for it > you end up with a diff with loads of unnecessary changes
then we get to the question: if the "format on save" is a toggle-able thing should it be on by default or off.
Format on save should be always on because the EditorConfig will only format files which match the patterns that have been declared in the .editorconfig
file. If you don't want to apply EditorConfig rules to legacy files then you should adjust the globs used in your .editorconfig
file our you could add another .editorconfig
file for this particular folder which overwrites the default EditorConfig style.
+1 for format via menu "source/format" or click on context "format" +1 for toggle-able on-save
:+1:
:+1:
We can't use this plugin at all without this. I believe that editor's task is to edit opened file, not doing magic on all files in project.
:+1:
:+1:
:+1: for format via menu "source/format" or click on context "format" :+1: for toggle-able on-save
(shamelessly copy pasting from @jscssphtml)
+1 & :thumbsup: on this one; other editors only change files on save. They do not scan pro-actively for files to change.
Is there any quick fix for this problem, because one of our coders can't convince his NetBeans to leave legacy code alone, and has a major problem working with our Sublime text guys.
@fboes only fix that we have found to be solid is to remove the extension out of netbeans for the time being and set NB:s own formatting as close as possible per file type and just call format on NB manually.
Atleast for the indentations and just ignore possible differences on ending spaces and whatnots :).
Of course if most of the legacy code is in a subfolder then you could prevent formatting like @bennyn suggests:
"If you don't want to apply EditorConfig rules to legacy files then you should adjust the globs used in your .editorconfig file our you could add another .editorconfig file for this particular folder which overwrites the default EditorConfig style."
That should prevent the autoformatting atleast for now when opening the project on netbeans.
@FinBoWa Thx, @bennyn is completely right. And we just found out more about .editorconfig
's capabilities by targeting specific folders. I paste our small demo snippet here in case someone wants to follow our footsteps (this may be even smarter than providing an .editorconfig
you do not want your team to use anyhow ;)):
[*]
charset = utf-8
[htdocs/sites/all/{modules/custom/**/*,themes/**/*}]
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
tab_width = 4
Finally I had some time :) Hang on for pre-release 0.8 :package:
Thanks for the great feedback from everyone here!
Your +1's helped us to make an easy descision on what goes next into the plugin. A big "Thank you" also goes out to @Yserz for implementing the requested change.
Please download v0.0.8 and give us feedback if everything works now like expected.
One bug so far.. Or is it actually.
Open a file in get it to fire a save for the file > format happens > close the file in NB > reset the file changes with git for example (you don't just want to commit anything) > wait for a while > editorconfig related changes return back.
Same thing happens even without going the previous steps. Just open netbeans and call "touch README.md" for example.
Jeah, we are listening for changes for every file which is covered by the editorconfig. This does not only effect NetBeans changes. If you change it with another editor and save it while the project is still opened in NetBeans, it will apply the editorconfig rules automatically. The same applies when the git plugin saves the revert. Could be considered as feature too :) Dunno right now if we can change the way we detect file changes or differentiate the tool which saves the changes.
Tru dat :) . I have used that behaviour to fire up stuff on netbeans. NB it doesn't allow you to fire up a save without changing the contents so mostly I end up calling touch from the filesystem.
As per user request (welovecoding/editorconfig-netbeans#74, welovecoding/editorconfig-netbeans#77), we will only reformat files / apply EditorConfig rules when a file is explicitly changed from the NetBeans editor window.