Forum Discussion

shankar_r's avatar
shankar_r
Community Hero
7 years ago
Solved

Code alignment in Units

Hi,

 

I have installed TD in 2 machines, One machine[#1] TC having tab count as 6 in another machine[#2] on having count as 4 like below

 

 

 

 

 

 

 

I have edited some scripts created in #1 from #2 machine.

 

And committed code into Git hub.

 

But the looks like below.  I don't see any difference in TC alignment in both mahicne's TC

 

Is there any way to make it better in formating or aligning the code in code Editor?

 

I'm using TC 12.30 

  • It almost looks like there are tab characters being used even though you don't have that item checked.  I'm not sure what Git Hub does when importing code files, if it attempts to replace spaces with tabs or if, when you edit in Git Hub, it uses tab characters.

     

    Your settings in TestComplete looks right... however, it's a good rule of thumb to keep the same setup on multiple machines so you don't end up with mismatched formatting alignments.

     

    Another possibility could be encoding.  If one is using UTF-8 and another is using UTF-16, that could account for some differences as well.

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    It almost looks like there are tab characters being used even though you don't have that item checked.  I'm not sure what Git Hub does when importing code files, if it attempts to replace spaces with tabs or if, when you edit in Git Hub, it uses tab characters.

     

    Your settings in TestComplete looks right... however, it's a good rule of thumb to keep the same setup on multiple machines so you don't end up with mismatched formatting alignments.

     

    Another possibility could be encoding.  If one is using UTF-8 and another is using UTF-16, that could account for some differences as well.

  • JuliaBernikova's avatar
    JuliaBernikova
    SmartBear Alumni (Retired)

    Hi Shankar,

     

    I've referred to the screenshots, but still do not quite understand what the issue is. Could you describe it in more detail what improvements in the code formatting exactly you'd like to see? Where exactly do you observe problems with formating now: in TestComplete or in the tool you used to compare the scripts?

    • shankar_r's avatar
      shankar_r
      Community Hero

      I'm using tab in my scripts to indent, I'm able to see proper alignment in Test Complete with different setup But not in the Git Hub.

       

      This maybe not related to Test Complete code formatting but just want to check here is this issue anything to do with TC.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Yeah, I think it might be a Git Hub deal.  I'd check the text encoding and also make sure that Git Hub is not interpreting tab characters or doing it's own formatting.