Giter Site home page Giter Site logo

whitespace's Introduction

Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

Whitespace package

OS X Build Status Windows Build Status Dependency Status

Strips trailing whitespace and adds a trailing newline when an editor is saved.

To disable/enable features for a certain language package, you can use syntax-scoped properties in your config.cson. E.g.

'.slim.text':
  whitespace:
    removeTrailingWhitespace: false

You find the scope on top of a grammar package's settings view.

Note: for .source.jade, .source.diff, .source.pug and .source.patch, removing trailing whitespace is disabled by default.

whitespace's People

Contributors

50wliu avatar aki77 avatar alhadis avatar benogle avatar bkeepers avatar bprodoehl avatar burodepeper avatar ccoenen avatar damieng avatar darangi avatar daviwil avatar githubgeekjoellol avatar gjtorikian avatar iolsen avatar izuzak avatar jasonrudolph avatar jeremyramin avatar kevinnathan avatar kevinsawicki avatar lee-dohm avatar lettertwo avatar maxbrunsfeld avatar mnquintana avatar muchweb avatar norio-nomura avatar probablycorey-and-nathan avatar sadick254 avatar t9md avatar thomasjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whitespace's Issues

Regarding trailing whitespace..

My git commits were being mangled for a few months and I've finally discovered why: #10

It should not take so much effort to discover the editor is silently changing things. Someone says the codebase should change. Unfortunately that's not an option, it's not my code base it's my employers.

If atom is going to be taken seriously it's default plugins can't silently mangle code to meet the authors style preference. Any destructive modifications should at the very least ask. And yes, removing arbitrary characters because the author doesn't like them is destructive.

I realize I'm free to use any editor. I like everything else about atom and now I know how to disable this. That's not the point, and as others stated some languages literally break when whitespace is removed

Please make this way more obvious. Or disabled by default. Or even a popup that says "Do you want Atom to enforce it's own style on your code regardless of your employers requirements"

Binary corruption when used with Autosave

This is clearly an issue that shows that the plugin works perfectly well.

But given this scenario :

  1. Work on a binary file (Let's say PSD) for a few hours without committing (well, obviously a bad idea, but happens)
  2. Get back on atom to check a markdown file
  3. Accidentally click on the binary when trying to get back there
  4. See very nice symbols
  5. Whitespaces that were part of binary data magically disappeared
  6. Autosave helps you by saving the binary corruption : Thanks !

It could (did ?) happen that someone (me ?) could lose a lot of work by corrupting some binaries ...

So to avoid this kind of annoying situation (that shouldn't happen if you work with regular commits ... but still ...), we should just check if we're not facing something that is obviously not text ...

But still, excellent plugin when working with code !

Whitespace should not be trimmed within Markdown code block

I can't write the following block in my README:

var isBinaryFileSync = require("isbinaryfile");

if (isBinaryFileSync(process.argv[2]))
  console.log("It is!")
else
  console.log("No.")

The whitespace extension trims the leading " " (two spaces) before the console.log.

Feature Request: Exclude whitespace-only lines

As in Xcode's option: "Automatically trim trailing whitespace" > "Including whitespace-only lines"

Xcode's default value of these settings are following:

"Automatically trim trailing whitespace" = YES
"Including whitespace-only lines" = NO

Adding this feature will make Atom to be more friendly for users who are using Xcode by default settings.

Enable or disable by project?

Would it make sense to be able to disable this only for specific project (i.e.: paths)?

It would make sense for my specific use case for sure.

Thoughts?

"Ignore Whitespace Only Lines" combined with "Ensure Single Trailing Newline"

Consider I have a document that ends like this:
("#" = newline, "." = space)

....)#
..)#
..#
..#
..#
#
#

It will only trim the trailing newlines up to the spaces

....)#
..)#
..#
..#
..#

My suggestion is to add an exception to "whitespace only lines" so that it does trim the line if the rest of the document has only whitespace characters

Keep more than one blank line at the end of the file

Is there any way to configure the number of allowed blank lines at the bottom of the file? All the time I have to add a bunch of blank lines, because LINTER messages pop up over my code while I'm typing - and I need blank lines to scroll the code up. Then I save - and my code is back at the bottom. That's kinda annoying.

I know, actually the real fix would be to allow Atom to scroll beyond the end of the file - but for a start it would be nice to have an option to let me have any fixed number of blank lines at the end of the file.

(So far my fix is to have a bunch of blank lines and then a line with just "//" in it - but there has to be a better way.)

failing to remove whitespace from markdown file

I ran into a markdown file that had a bunch of trailing whitespace. None of it was actually required for it to render properly, it was just there by mistake. So I opened & saved the file with Atom, expecting it to be stripped, but only some of it was (all the lines with 2 trailing spaces remained). Using the "Whitespace: Remove Trailing Whitespace" command also failed to strip it.

I think that this is the code responsible - some special logic for leaving 2 spaces alone in GFM.

I propose that we either remove this, since nearly the same thing can be accomplished if people who use trailing whitespace in their markdown added the following to their config:

".gfm.source":
  whitespace:
    removeTrailingWhitespace: false

...or at least make enabling it an option, since I only found out about it by reading the source.

Opens devtools and errors on save

I updated whitespace today and it broke file saving. To reproduce:

  1. Change a file
  2. Press command + s or click File > Save.

This happens:

atom

With these errors:

screen shot 2014-03-03 at 12 05 00 pm

Just started happening after I updated. Tested with all other plugins disabled, restarted Atom, etc.

Uncaught Error: This TextEditor has been destroyed

Sorry I have no idea how this came up. I just pressed save and suddenly...

Atom Version: 0.201.0
System: Mac OS X 10.10.3
Thrown From: whitespace package, v0.29.0

Stack Trace

Uncaught Error: This TextEditor has been destroyed

At /Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:759

Error: This TextEditor has been destroyed
  at DisplayBuffer.module.exports.DisplayBuffer.screenPositionForBufferPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:1040:15)
  at Marker.module.exports.Marker.getHeadScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/marker.js:174:33)
  at new Marker (/Applications/Atom.app/Contents/Resources/app.asar/src/marker.js:34:41)
  at DisplayBuffer.module.exports.DisplayBuffer.getMarker (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:1265:20)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:1280:24
  at Array.map (native)
  at DisplayBuffer.module.exports.DisplayBuffer.getMarkers (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:1276:39)
  at DisplayBuffer.module.exports.DisplayBuffer.refreshMarkerScreenPositions (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:1397:20)
  at DisplayBuffer.module.exports.DisplayBuffer.emitDidChange (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:304:14)
  at DisplayBuffer.module.exports.DisplayBuffer.updateScreenLines (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:1473:19)
  at Fold.module.exports.Fold.updateDisplayBuffer (/Applications/Atom.app/Contents/Resources/app.asar/src/fold.js:90:35)
  at Fold.module.exports.Fold.destroyed (/Applications/Atom.app/Contents/Resources/app.asar/src/fold.js:98:19)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/fold.js:20:24
  at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
  at Marker.module.exports.Marker.destroy (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/marker.js:249:20)
  at Fold.module.exports.Fold.destroy (/Applications/Atom.app/Contents/Resources/app.asar/src/fold.js:43:26)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/fold.js:28:26
  at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
  at Marker.module.exports.Marker.emitChangeEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/marker.js:380:27)
  at MarkerStore.module.exports.MarkerStore.emitChangeEvents (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/marker-store.js:223:32)
  at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:691:24)
  at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/whitespace/lib/whitespace.js:52:25
  at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
  at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:974:20)
  at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:967:19)
  at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:567:26)
  at Pane.module.exports.Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:523:18)
  at Pane.module.exports.Pane.saveActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:506:19)
  at Workspace.module.exports.Workspace.saveActivePaneItem (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:585:35)
  at atom-workspace.atom.commands.add.core:save (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace-element.js:314:30)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:238:29)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:519:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:354:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:178:20)

Commands

  8x -1:35.9.0 core:select-up (atom-text-editor.editor.is-focused)
     -1:34.6.0 core:copy (atom-text-editor.editor.is-focused)
  5x -1:30.7.0 core:select-up (atom-text-editor.editor.is-focused)
     -1:29.4.0 core:select-left (atom-text-editor.editor.is-focused)
     -1:28.9.0 core:paste (atom-text-editor.editor.is-focused)
     -1:23.7.0 core:copy (atom-text-editor.editor.is-focused)
  3x -1:22.5.0 core:paste (atom-text-editor.editor.is-focused)
     -1:10.8.0 editor:move-to-first-character-of-line (atom-text-editor.editor.is-focused)
     -1:10 editor:select-to-end-of-line (atom-text-editor.editor.is-focused)
     -1:09.9.0 core:copy (atom-text-editor.editor.is-focused)
     -1:07.4.0 core:move-down (atom-text-editor.editor.is-focused)
  5x -1:06.7.0 core:select-down (atom-text-editor.editor.is-focused)
     -1:05.6.0 core:select-up (atom-text-editor.editor.is-focused)
     -1:05.3.0 core:paste (atom-text-editor.editor.is-focused)
     -1:04.2.0 editor:newline (atom-text-editor.editor.is-focused)
  2x -1:03.8.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "language-toml",
      "language-sass",
      "language-ruby-on-rails",
      "language-php",
      "language-perl",
      "language-mustache",
      "language-less",
      "language-html",
      "language-css",
      "language-coffee-script",
      "language-c",
      "language-clojure",
      "language-objective-c"
    ]
  },
  "whitespace": {}
}

Installed Packages

# User
autocomplete-paths, v1.0.2
go-plus, v3.3.11
linter, v0.12.6
linter-pep257, v0.2.1
linter-pep8, v0.2.0

# Dev
No dev packages

Remove trailing whitespace on _current_ line

I seem to end up with a lot of trailing whitespace in my files when those trailing lines are after the cursor's position. I guess they're the result of me tabbing twice or something?

Is it possible to add an exception to "Ignore whitespace on current line" so that trailing whitespace is still trimmed, while whitespace preceding the cursor is still intact?

Error with Split Pane on save

Using split pane, 2 files (1 file in each pane). When I try to save the on right I get an error.

This error can be reproduced by having set "Ensure Single Trailing Newline" to be enabled. Then in the file on the right to have no new line, eg.

4:   Rails.do_something
5: end

Will cause this error: https://gist.github.com/richrace/9413192

But having:

4:   Rails.do_something
5: end
6:

Will save fine.

Intelligently strip whitespace when the user edits a line

(This is generalization of #14)

Stripping whitespace in the whole document can be sometimes be a bit anti-social, maybe you just wanted to change a spelling mistake, but you end up making lots of whitespace changes just because your editor and your collaborator's editors don't agree. It's easy to end up with diffs that hide the real change because of all of the whitespace changes.

A better solution would be to apply things like strip whitespace and ensure newline at end of document only on lines that the user edits, and leave all other lines be. For example, if the user doesn't edit the last line of the document, don't add a newline. When they do edit the last line, or adds lines to the end of the document, add that extra newline at the end. Similarily, don't strip whitespace in the whole document, just do it when a user edits a line.

Moves the caret to next line on save

When I edit text in Atom it always moves my caret to the next line if it's the last line in the document.

Before save:
image
After save:
image

That becomes very annoying when Autosave is enabled. When you write a new document and often switch to another window, Autosave performs save, when you switch back to Atom, you need to return the caret back to continue typing.

I have also enabled Whitespace plugin with Ensure Single Trailing Newline option set to true.

Expected behaviour: new line is added, the document is saved, but the caret leaves there where it originally was.

via @antonmoiseev atom/autosave#2

Whitespace is not stripped on the insertion point's line

As of v0.21.0: If I

  • type a line in a file
  • end that line with a space
  • leave the insertion point on that line

When I save the file the whitespace is not stripped from that line.

If I move my insertion point to a different line and safe the file, then the whitespace is stripped as expected

Not removing trailing whitespace

I enter two spaces at the end of a line in a ruby file and press save, and the trailing whitespace is not removed.

I have "Remove Trailing Whitespace" checked, am running OS X 10.9.3 and Atom 0.101.0 with Whitespace 0.22.0

Only whitespace on edited lines should be removed

Sometimes, specifically when editing code from others, removing all trailing whitespace in a file leads to a very large number of line changes that are meaningless but make revision control systems difficult to use. This plugin would be improved by only removing trailing whitespace from modified lines, thus preventing functionally unchanged lines from being marked as changed by version control software.

In my opinion, it would also be acceptable if this were simply an option. Making it the default would be nice though for organizations where different developers use different IDEs.

Spaces —> tabs should only convert leading spaces

If I have a file like

var a = {
····x:······3,
····y:······78,
····length:·2
}

and I do whitespace:convert-spaces-to-tabs, then I expect:

var a = {
————x:······3,
————y:······78,
————length:·2
}

but I get:

var a = {
————x:————··3,
————y:————··78,
————length:·2
}

tab = ——
space = •


I would like only the leading spaces to be converted. (Gist)

Does Not Show Whitespace Between Words

Only leading and trailing whitespace is shown. Spaces within a line of text or code are not shown.

Is this expected?

Is there a way to enable that ability?

"Remove Trailing Whitespace" should not be on by default

Indented blank lines is a pretty common use case. Having them destructively removed by default is going to lead to a lot of confusion when users inadvertently commit massive whitespace changesets they didn't notice on saving to their Git repos.

Save without stripping command/keybinding?

Perhaps it might be nice to add a command/keybinding to allow one to save a file without stripping trailing whitespace and adding a trailing newline, rather than requiring the user to disable the package, go back to the buffer in question, save, and reenable the package.

Most of the time I want the behavior this package offers, but every now and then I want to be able to save a file without.

For instance, if I start to make changes in multiple files and I ultimately decide to revert a change in one of those files and intend to leave it untouched, but because saving the file will clean it up, I'll either need to checkout that file to revert, leave some unstaged changes hanging around, or commit cleanup changes to a file that doesn't need to be in that commit. With my proposed change, it would be as easy as "Undo, nostrip-save" (after making sure the file is no longer highlighted in the tree view as having changes).

Another example is when working in a codebase I don't control: I may want to make a single line change so I can submit a pull request without also including dozens of whitespace cleanups (which might create merge conflicts by the time the maintainer gets around to looking at my change), but without first disabling this package, I can't save that one-line change in someone else's messy codebase.

Trailing whitespace is not stripped on save in .jade files

Description:

When saving a .jade file, this package does not strip whitespace at the end of lines.

Repro steps:

  1. Open Atom.
  2. Open the package's settings and turn on only "Ensure Single Trailing Newline" and "Remove Trailing Whitespace."
  3. Create a new .jade file, or open an existing one.
  4. Ensure that Atom recognizes the file's language as Jade.
  5. Add spaces to the end of any line (except for the last one).
  6. Press Command-S (Mac) to save.

Results:

The file is saved, but trailing whitespace remains. However, the "Ensure Single Trailing Newline" setting works correctly.

Expected:

Trailing whitespace should be automatically removed before the file is saved. This is the observed behavior in other types of files (e.g., .coffee, .less).

Converting spaces <-> tabs should only apply to a selection when one exists

When the user has made a selection, the convert spaces to tabs and convert tabs to spaces options should only apply to the selected lines.
((If you have some reason to dislike this behaviour, please at least make it a preference))

I had the unexpected experience of trying to correct the spaces in a small spot of a file and finding that not only were the leading spaces elsewhere in that file converted, but spaces in the middle of the line that were used for => alignment were converted into tabs (and into the wrong number of tabs).

Uncaught TypeError: undefined is not a function

Uncaught TypeError: undefined is not a function

Atom Version: 0.156.0
System: Mac OS X 10.10.2
Thrown From: whitespace package, v0.28.0

Steps To Reproduce

  1. Save a file

Stack Trace

At /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:121

TypeError: undefined is not a function
  at ScopeDescriptor.module.exports.ScopeDescriptor.getScopeChain (/Applications/Atom.app/Contents/Resources/app/src/scope-descriptor.js:29:26)
  at Config.module.exports.Config.getRawScopedValue (/Applications/Atom.app/Contents/Resources/app/src/config.js:735:72)
  at Config.module.exports.Config.get (/Applications/Atom.app/Contents/Resources/app/src/config.js:163:22)
  at /Users/johnbland/.atom/packages/whitespace/lib/whitespace.coffee:29:24
  at History.module.exports.History.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:112:18)
  at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:683:27)
  at /Users/johnbland/.atom/packages/whitespace/lib/whitespace.coffee:27:14
  at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:82:11)
  at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:961:20)
  at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:954:19)
  at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:585:26)
  at Pane.module.exports.Pane.saveItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:511:16)
  at Pane.module.exports.Pane.saveActiveItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:501:19)
  at Workspace.module.exports.Workspace.saveActivePaneItem (/Applications/Atom.app/Contents/Resources/app/src/workspace.js:596:35)
  at atom-workspace.atom.commands.add.core:save (/Applications/Atom.app/Contents/Resources/app/src/workspace-element.js:287:30)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:243:29)
  at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:549:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:391:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:167:20)

/cc @atom/core

Causing TextBuffers to leak

I noticed a bunch of leaking TextBuffer objects in the heap profile. Looks like whitespace is holding on to them somehow even after they're closed.

Advances cursor when cursor at end of file and trailing newline added

Repro Steps

  1. Set Autosave to Enabled
  2. Set Whitespace to Ensure Single Trailing Newline
  3. Put the cursor at the very end of the file, without a trailing newline
  4. Change focus (like cmd-TAB away to copy that URL you wanted to paste into the file)
  5. Come back

Actual: Trailing newline added and cursor advanced to the next line.
Expected: Trailing newline to have been added, but the cursor should not have moved.

Screenshots

Before Save:

screen shot 2014-03-03 at 11 23 37 pm

After Save:

screen shot 2014-03-03 at 11 23 54 pm

Expected After Save:

screen shot 2014-03-03 at 11 25 11 pm

Avoid creating unnecessary whitespace when auto indenting

In SublimeText when you press return multiple times the auto indents of the blank lines doesn't remain (I've seen other editors behave like this too, not TextMate though). The way Atom behaves is different, the auto indentation created is left as is. This works poorly with git and other tools that complain about trailing whitespace.

A concrete example, type

def hello_world

then press return twice, you end up on a line indented two spaces, but the blank line above also has two spaces. Repeat in SublimeText (and many other editors), the blank line above will be completely blank.

To illustrate, this is what you currently end up with (spaces showed as dots, | is the caret):

def hello_world
··
··|

And this is the desired outcome:

def hello_world

··|

(Please note that this is NOT solved by any strip-trailing-whitespace-on-save feature. That kind of feature is horrible when you work with other people's code and they use an editor that does not srtrip whitespace. Suddenly your one line change ends up as a hundred line diff because your editor decided to strip whitespace from the whole file, not just where you edited. I think editors should only automatically reformat things on lines the user has edited, otherwise collaboration becomes harder).

This might be similar to #13, but I don't know how Xcode behaves so I don't know if the desired behaviour is the same.

Ignore Whitespace On Current Line doesn't work with split files

Steps to reproduce:

  1. Open a file
  2. Split it
  3. On the first split, tab a bit on a random line so that there's some trailing whitespace
  4. Keep the cursor on that line in the first split, but not in the second one
  5. Save the file

Expected:
Whitespace is preserved since it's on a line with a cursor

Actual:
Whitespace is removed

Atom 0.211.0-ca146c9, Ubuntu 15.04, safe mode.

How do I ensure newlines are stripped in jade files

It looks like a result of #46 is that .jade files now no longer have whitespace stripped on save, by default.

I’d like to enable this, but I can’t see how to do so from the (scant) settings menu.

screen shot 2015-05-26 at 15 42 02

I assume this is possible by editing my config.cson but I can’t find documentation on that, and my attempts have all failed.

Please add some docs, or a comment in the settings menu, on how to do that.

Thanks!

Revisit Issue #10 > "Remove Trailing Whitespace" should not be on by default

Since the issue has been closed, a lot of people have asked you to reconsider. Personally, i think that this issue has been closed too early.

Yes, trailing whitespace is not per se neccessary, but making changes to code just to conform to coding style is unneccessary, too. And in some cases (mentioned in #10 as well), this change can be destructive.

You're trying to prevent churn, and i get that. But you're creating churn with this, yourselves.

Then, there's people who don't use atom (gosh i know). I don't want to clean up other people's white space after them. Most certainly not incidentally.

Atom doesn't react to any key combination after disabling whitespace

Each time I disable the whitespace package, I have to restart Atom as it stops listening to CMD+SOMETHING key combinations. In fact, even the menu option to save doesn't work. It seems to be related to whitespace, but this doesn't make much sense at the same time.

Steps to reproduce:

  • open a file
  • open the settings and disable the whitespace package
  • go back to your file and try to save
  • 💥

Ideas? Hints?

Remove leading spaces / or change indentation

When reformatting text it sometimes needed to remove all the leading spaces.
The way this would be used is either on a text selection -or- on the current line.

Would also be great to be able to increase or decrease indentation. This would "fix" the leading space issue as well.

Plugin no longer showing as installed

The other day after disabling the plugin briefly I found it had disappeared when I went to re-enable it.

When I search in packages available it doesn't show as installed and I can't find a way to resolve this. The preferences also no longer show for it.

Can't access prefs

Showing as not installed

I'm running Atom 0.140.0 on OS X Yosemite

Not stripping whitespace in certain cases

Not sure how to reproduce this yet, but just a heads up that we're not stripping whitespace in certain cases even when ignoring for the current line is disabled and the cursor is on a different line.

Right click menu item

Removing whitespace is a nice feature. However, I find it necessary to disable the automatic setting for many reasons:

  • It seems to break jade.
  • If I make a one-off patch/PR to another repo, I don't want to mess with their formatting.
  • Some files I have have deliberate extra whitespace, and having it automatically removed is a pain.

Because I have to disable the automatic setting, it is a lot less convenient to use the feature manually. Could there be a right click menu item like "Remove Unnecessary Whitespace" to make it more convenient?

Thanks

P.S. : Is there a reason that the automatic setting is true by default? It seems rather destructive with git diffs...

Option to kill trailing whitespace only on lines I touch

If I edit a file with lots of trailing whitespace and change one line, the diff is going to be hard to read if all the whitespace is stripped. I would still like to make sure I'm not introducing trailing whitespace and even strip it from lines that I've edited.

Convert spaces<->tabs ignores "tab stops"

The convert spaces to tabs and tabs to spaces commands ignore the tab stop positions that Atom itself honors.

For example, with tabs set to 4-spaces wide, if the line is (with spaces represented as . and tabs as -):

A-  gap-here

Should translate to:

A...gap.here

But instead tabs are blindly replaced with a set number of spaces, making the translation (wrongly):

A....gap....here

Which then changes where the characters line up in Atom, when it shouldn't.

Going from spaces to tabs is similarly wrong, where it will only replace runs of spaces that are a full tab width (4, in this example), regardless of where they are. They should also honor the tab stop positions.

I created pull request #67 with the necessary code fixes and spec updates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.