src/vs/editor/contrib/linesOperations/linesOperations.ts/TrimTrailingWhitespaceAction/run
class TrimTrailingWhitespaceAction:	public run(_accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {

		let cursors: Position[] = [];
		if (args.reason === 'auto-save') {
			// See https://github.com/editorconfig/editorconfig-vscode/issues/47
			// It is very convenient for the editor config extension to invoke this action.
			// So, if we get a reason:'auto-save' passed in, let's preserve cursor positions.
			cursors = (editor.getSelections() || []).map(s => new Position(s.positionLineNumber, s.positionColumn));
		}

		let selection = editor.getSelection();
		if (selection === null) {
			return;
		}

		let command = new TrimTrailingWhitespaceCommand(selection, cursors);

		editor.pushUndoStop();
		editor.executeCommands(this.id, [command]);
		editor.pushUndoStop();
	}