This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Add to "Blank lines" - add empty line at end of file | ||
---|---|---|---|
Product: | cnd | Reporter: | avp <avp> |
Component: | Editor | Assignee: | Alexander Simon <alexvsimon> |
Status: | NEW --- | ||
Severity: | blocker | CC: | brucec, dpirch |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
avp
2008-02-14 09:49:26 UTC
IMHO formatter should add missing new line in end of file in any case. *** Bug 186355 has been marked as a duplicate of this bug. *** Bug 186355 suggests that NB should just add missing new line on saving file, without the need to call formatting. Note that GCC does *not* want an empty line at the end of the file: it just wants to see a newline character. i.e. it wants to see: void somefunc(void)\n {\n dostuff();\n }\n not: void somefunc(void)\n {\n dostuff();\n }\n \n What NB currently produces is: void somefunc(void)\n {\n dostuff();\n } The C standard requires a newline at the end of a file, which is why gcc and clang warn if it is missing: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character [...]" (C11, 5.1.1.2.2) Ideally NetBeans would have would an "Ensure newline at end of file" option for each language, under Tools > Options > Editor > On Save. There is already a plugin called "EOF Line Feed" for this, which can be enabled through Tools > Plugins > Available Plugins (works in NetBeans 8.1, http://plugins.netbeans.org/plugin/56323/eof-line-feed) |