Skip to content

C# syntax coloring is broken inside of multiline interpolated strings when a line starts with a placeholder #131

@aeschli

Description

@aeschli

From @klick-barakgall on July 26, 2018 19:54

Issue Type: Bug

I apologize if this should actually be in the csharp extension issues, but I feel like syntax coloring is done in conjuction between the extension and vscode so I'm not really certain where the issue really lies.

Place the following code in a *.cs file:

string strParam = "Some string";
string syntaxColoringMessed = $@"
I am a multiline interpolated string with a parameter: {strParam}
Everything is fine except when a line STARTS with a parameter:
{strParam} <-- Not colored even though it compiles fine! grabbing
the strParam value.

However it's even worse when an interpolation includes another string:
{"some string..."}

";

Please see the following image:
vscode-syntax-coloring-smell

Note that despite the syntax coloring this compiles fine.

VS Code version: Code 1.25.1 (1dfc5e557209371715f655691b1235b6b26a06be, 2018-07-11T15:43:53.668Z)
OS version: Windows_NT x64 6.1.7601

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz (4 x 2808)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: enabled
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled
Memory (System) 31.63GB (19.90GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe C:_projs\OverKlock\CM
Screen Reader no
VM 0%
Extensions (1)
Extension Author (truncated) Version
csharp ms- 1.15.2

Copied from original issue: microsoft/vscode#55185

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions