Search code examples
visual-studio-codesftpvscode-extensionsfilezilla

How to fix extra empty lines in files that are downloaded by FileZilla Client and Uploaded by VS code


I have problem when i upload file to remove server with VS code and extension SFTP then if i download same file with FileZilla Client and open with VS code im getting a lot of extra empty lines. How to fix that extra empty line ?

for example if the code i upload via SFTP look like this:

<?php
class ControllerApiCart extends Controller {

public function add() {
    $this->load->language('api/cart');

    $json = array();

    if (!isset($this->session->data['api_id'])) {
        $json['error']['warning'] = $this->language->get('error_permission');
    }

when i download the same file with FileZilla Client the code look like this:

<?php

class ControllerApiCart extends Controller {

public function add() {

    $this->load->language('api/cart');



    $json = array();



    if (!isset($this->session->data['api_id'])) {

        $json['error']['warning'] = $this->language->get('error_permission');

    }

Solution

  • i fix this issue by creating .editorconfig file in work directory of my project an insert this code

    [*]
    charset = utf-8
    
    # Use LF (Unix) line endings
    [*.{php,js,css,html}]
    end_of_line = lf