Bug 14030 - incorrect syntax highlighting in concatenated Format() string
Summary: incorrect syntax highlighting in concatenated Format() string
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 4.0.12
Hardware: PC Windows
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
Depends on:
Reported: 2013-08-16 09:51 UTC by eduard.qualls
Modified: 2014-03-28 03:21 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description eduard.qualls 2013-08-16 09:51:16 UTC
Syntax highlighter applies "number" format to parameter flag 
within Format() format-string when it follows a string concatenating "+" sign.

Viz., in this line:

    return base.ToDebugString() + string.Format(" DFItemID: {0}", DFSPItemID);

the "{0}" has "number" format applied, rather than staying in "string" format.
Comment 1 eduard.qualls 2013-08-16 09:59:01 UTC
This also happens in non-concatenated calls to Format() when the "{{" escape is used:

    return string.Format("DFDog: {{ [ {0} ], SrcName({1}) }}",
                         base.ToDebugString(), SrcName);

(1) the substring "{{ [ {0}" within the format param has "number" format, and
(2) the "{1}" also has "number" coloration rather than "string".

The closing ']' is OK, as are the closing ") }}".
Comment 2 Mike Krüger 2013-08-19 01:23:37 UTC
fixed the '{{'/'}}' issue - that the format items are highlighted differently is not a bug - it's a feature :)

the format items are colored using the 'String Format Items' color.
Comment 3 eduard.qualls 2013-08-19 06:13:24 UTC
Thanks, Mike. It might be a useful feature if it could be consistent through all the instances of "Format()" style parameters. But that's hard to guarantee in all cases. For example, it didn't show up, in the "hidden Format()" functionality within the second param of Log.Debug().
Comment 4 Shruti 2014-03-28 03:21:09 UTC
I have verified this feature by implementing small code. Please verify it with following screencast :

Environment Info:
=== Xamarin Studio ===

Version 4.2.4 (build 266)
Installation UUID: 400bab6b-f5cd-4e84-a1d1-39f9d6414cb1
	Microsoft .NET 4.0.30319.18449
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

=== Xamarin.Android ===

Version: 4.13.0 (Trial Edition)
Android SDK: E:\SDK\AndroidSDK
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_31
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)

=== Build Information ===

Release ID: 402040266
Git revision: 57fa6b7639703775ae1d5c46536e42ab424cb177
Build date: 2014-03-20 12:27:02-04
Xamarin addins: eee141c29724a19529e77b8e743086d95b29f5ba

=== Operating System ===

Windows 6.2.9200.0 (64-bit)

As per my observation, syntax highlighting behavior seems fine. Hence, I am marking this fix as verified.