Bug 10923 - LocalResolveResult.Variable.Region is wrong
Summary: LocalResolveResult.Variable.Region is wrong
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 4.0
Hardware: PC Mac OS
: Low normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-03-05 16:38 UTC by Jeffrey Stedfast
Modified: 2013-03-06 01:09 UTC (History)
1 user (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Jeffrey Stedfast 2013-03-05 16:38:32 UTC
In DebugValueTooltipProvider.cs, the logic to get the variable name is off by 1 character because the result.Variable.Region is wrong.

you can see the hack I have in the code:

expression = ed.GetTextBetween (startOffset, endOffset);
if (char.IsWhiteSpace (expression[0])) {
	// FIXME: Mike: if I have "var @class = ...", why does GetTextBetween() return " @clas" ???
	expression = ed.GetTextBetween (startOffset + 1, endOffset + 1);
}


If you have some code like:

var @class = new object ();

and then you hover over the @class variable, the Variable.Region seems to be the region for " @clas" instead of "@class"


While on the topic, should LocalResolveResult.Variable.Name == "@class"? Currently, it's just "class" but it would be helpful if it included the @ (not sure if that would break anything or not, though, so it's fine if I have to resort to the GetTextBetween() way of getting the full variable name).
Comment 1 Mike Krüger 2013-03-06 00:48:55 UTC
it's atm one of the unresolved issues we've in the parser - so long don't use '@' ...

I still wait for a good solution to the identifier problem - we've fixed it for strings - but not for identifiers.

btw. It's not only the @ - you can write @cl\u0061ss it's the same identifier - don't use that and never try to rename it.
Comment 2 Mike Krüger 2013-03-06 01:09:30 UTC
I already have a hack for verbatim identifiers - wasn't just working correctly.

At least this part is fixed - and more common than escape sequences. Escape sequences however are another story ... they're even valid in keywords :/