atom / language-csharp

C# language support for Atom
Other
62 stars 53 forks source link

Source code in strings confuses the parser #103

Closed bradwilson closed 6 years ago

bradwilson commented 6 years ago

Prerequisites

Description

C# code in strings confuses the parser. When it is seen, the colorizer flips around and starts colorizing the code in the string, and not the code outside the string.

Steps to Reproduce

  1. Open this file: https://github.com/xunit/xunit.analyzers/blob/a6bd742b15eb0fe9c00f2341404bccd5a55cc817/test/xunit.analyzers.tests/TestCaseMustBeLongLivedMarshalByRefObjectFixerTests.cs
  2. See the colorization flipped on the highlighted line:

Atom Colorization

FWIW, you can see it on Github (through the link above), which is how I discovered the issue in the first place.

Expected behavior:

Strings should be colorized as strings, and code should be colorized as code, even if there is code inside of strings.

Actual behavior:

Colors are flipped after the first instance of code in a string.

Reproduces how often:

100%

Versions

Atom    : 1.22.1
Electron: 1.6.15
Chrome  : 56.0.2924.87
Node    : 7.4.0