Viewing CR, LF, and CRLF inside Atmel Studio's Editor? - SOLVED

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simple question, maybe not so simple answer.  How do I see the line ending characters inside Atmel Studio's editor?

 

In Notepad++ I can view line endings via the menu option "View->Show Symbol->Show End of Line".  Perfect, just what I want.

 

In Visual Studio 2017 there is no native option.  You can see white space via "Edit->Advanced->View White Space", no line endings though.  But there is a third party extension "End of the Line" which works.

 

What about Atmel Studio?  It's built off VS2015 as far as I can tell.  The "Edit->Advanced->View White Space" is there.  But I can't find a third party extension that works with AS.  Does anybody know of an extension that works?

This topic has a solution.

Last Edited: Thu. Apr 19, 2018 - 05:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you use '\n' and other escape sequence characters inside code string text, it will show perfectly.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah not so much inside text strings delimited by pairs of double quotes.  I'm interested in seeing the actual CR, LF, or CRLF terminators at the end of every line of source code while in the AS editor.  Normally these are hidden as white space just like spaces and tabs.  Other editors can show all white space.  How do I see it inside Atmel Studio's editor?

 

Windows by default uses CRLF at the end of every line for source files.  Linux typically uses LF only.  Atmel's libraries seem to use LF, but sometimes use CRLF.  It becomes a pain in mixed environments because parts of the file use LF only, other parts use CRLF.  And every once in awhile there is a rouge CR terminated only couple of lines.  It makes source file comparisons difficult.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are probably going to need an extension from the gallery for stuff like that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ScottMN wrote:
In Notepad++ I can

so probably easiest to just use Notepad++ (or whatever) when you need this feature.

 

That's what I do, anyhow.

 

You can probably set it up as an "external tool" for quick access, if you feel the need ...

 

EDIT

 

As I've no doubt mentioned before, I have yet to find a single editor which includes every little "useful feature" like this - so I have several editors on my PC, and will choose whichever one has the particular feature that I need at the time.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Apr 19, 2018 - 03:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have found most tools will read the others format and save a file in its native format, so line endings are seldom an issue. 

If it is an issue, use notepad++(windose) or what ever tool is used for linux,  to correct and move on.   As for file diffs, use a tool that can be set to ignore white space,  on windows I use ExamDiff.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Thu. Apr 19, 2018 - 03:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

You are probably going to need an extension from the gallery for stuff like that.

 

That's where I started.  "End of the Line" extension works great in VS2017.  Found it via a google search.  It's supposed to support VS2012, VS2013, VS2015 and VS2017.  For some reason it doesn't seem to work with AS, even though AS is built off VS2015.  Or at least I can't get it to work with AS.  https://marketplace.visualstudio...

 

What other extension works with AS?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The creator of the extension needs to confirm support for Atmel Studio in the extension manifest.

As it works in 2015 I would expect it to just work, but it needs to be added to the manifest.

The extension is developed at https://bitbucket.org/rolfwr/endoftheline so I'm sure you can send the author a ping and ask...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

so probably easiest to just use Notepad++ (or whatever) when you need this feature.

 

That's my path right now.  Notepad++ works how I want AS to work.  I'll stick with Notepad++ if there is no working AS extension.  Perhaps the "external tool" setup will at least remove the "navigate to the source file location and launch Notepad++" painful step.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
... or what ever tool is used for linux, ...
dos2unix and unix2dos

A search for one of those will result in other alternatives including Python and PowerShell.

Unix utilities are in Windows 10 Windows Subsystem for Linux (WSL) (Ubuntu multiple on Windows)

 

https://docs.microsoft.com/en-us/windows/wsl/install-win10#install-your-linux-distribution-of-choice

 

Edit: URL

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Apr 19, 2018 - 04:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:
dos2unix and unix2dos
  Thank you!

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I've re-read the thread and still have the obvious question:  Why might this be important?

 

I can't think of any reason to be concerned during usual development activities with an "IDE".

 

In experience there is the occasional "oops this 'Nix file doesn't look right in my Win editor"; usually easily fixed with an option on open or some kind of "import".

Image result for programmers font cr lf

Maybe occasionally to check stuff when e.g. writing a text file to an SD card.  Again just a one-time operation and easily done with any kind of "file dump" utility.

 

 

Surely I don't want my code-editing pane to be full of tiny little CR and LF symbols? 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Thu. Apr 19, 2018 - 05:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I edit all my files in TextWrangler on a Mac. I have zero problems with code line endings. This includes third party library files which I do not edit as well as files that I create. Editor-created line endings are set to "LF". No problem in AS7.

 

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

meolsen wrote:
...the extension needs to confirm support for Atmel Studio in the extension manifest. As it works in 2015 I would expect it to just work, but it needs to be added to the manifest.

 

Success!  I modified the .VSIX file by hand adding a single line to the manifest and now the extension installs in Atmel Studio.  Line ending characters now toggle on and off while showing white space via Atmel Studio's "Edit->Advanced->View White Space"

 

 

Details to get the extension installed on AS 7.0:

.VSIX files are just .zip files.  Using 7-Zip I opened the archive, then edited the file "extension.vsixmanifest", adding a single line:

 

  <Installation>
    <InstallationTarget Version="[14.0,16.0)" Id="Microsoft.VisualStudio.Community" />
    <InstallationTarget Version="[11.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
    <InstallationTarget Version="[7.0,7.0]" Id="AtmelStudio" />
  </Installation>

 

Notice the surrounding '[' and ']' meaning greater than or equal to 7.0, and less than or equal to 7.0.  This line is different than the version ranges above with '[' and ')' for less than only.

 

Then save the file, 7-Zip automatically updates the archive.  Double-click the .VSIX file and VSIXInstaller.exe runs, asks to install to Atmel Studio, and success!

 

 

 

Showing white space

 

Hiding white space

 

More details here: https://www.avrfreaks.net/forum/...

 

Last Edited: Thu. Apr 19, 2018 - 05:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cool. If I were you I would make a PR to the extension author so that others can get it as well...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
I can't think of any reason to be concerned during usual development activities with an "IDE".

For me it's something that concerns me daily. We have a large body of software written in Linux for ultimate deployment in Linux but by a strange quirk of fate all our hardware simulating software is written and used in Windows. We share the same core source which might be modified for either environment. Git is very clever about handling line endings, able to check out different endings in different environments and yet "diff" s ignore the endings but even so things get mixed up from time to time so i generally use editors with view line endings enabled. I also have tabs/spaces enabled so I can see the naughty people who have violated our coding standards.