viasfora icon indicating copy to clipboard operation
viasfora copied to clipboard

"Highlighting Escape Sequence" doesn't handle C/C++'s "#include" file names and raw string literals correctly.

Open EFanZh opened this issue 12 years ago • 9 comments

For example, in the following code:

#include <abc\def.h>

"\d" isn't an escape sequence.

Also, the raw string literals are not handled correctly, like this:

R"(abc\def)"

EFanZh avatar Dec 14 '13 05:12 EFanZh

Great catch. Not quite sure how to fix it, yet, as it would require checking if the previous classification span was a preprocessor directive, and want to make sure the check doesn't impact performance negatively.

tomasr avatar Dec 18 '13 02:12 tomasr

I guess this is the same type error but in F#/C#. The \123 is colored incorrectly.

let newLines = System.IO.File.ReadAllLines(@"c:\users\12345678\desktopsmall-new.txt") |> Array.toList

fdncred avatar Feb 24 '17 14:02 fdncred

@fdncred I did not know F# supported @ strings, so that's definitely a bug. I'll fix that one.

However, I would not expect this to be an issue in C#, are you seeing it happening there as well?

tomasr avatar Feb 24 '17 15:02 tomasr

You are correct, sir. This error does not show up in C#.

fdncred avatar Feb 24 '17 15:02 fdncred

There seems to be a bug when interpolated and verbatim symbols are both used for the same string in C#. Although the character after the backslash is not escaped, the coloring suggests it is: private string Test1 => $@"{foo}\bar";

In this screenshot, Test1 is incorrectly colored, but Test2 and Test3 are correct.

Visual Studio 2017 v15.2 (26430.12) Viasfora v3.5.139

chasingcode avatar Jun 02 '17 16:06 chasingcode

@chasingcode Created a separate issue to track this one. Thanks for reporting, interpolated strings give me headaches!

tomasr avatar Jun 02 '17 20:06 tomasr

Thank you for the quick response and making such a helpful extension! It's much appreciated

chasingcode avatar Jun 03 '17 00:06 chasingcode

@tomasr - Are you still working on proper highlighting for include files in C++? It's pretty annoying.

fdncred avatar Aug 06 '18 19:08 fdncred