// TODO: handle the situation when raw and expand formatter are both present public virtual IVariableInformation Create( RemoteValue remoteValue, string displayName = null, FormatSpecifier formatSpecifier = null, CustomVisualizer customVisualizer = CustomVisualizer.None) { IVariableInformation varInfo = _varInfoFactory.Create(remoteValue, displayName, formatSpecifier, customVisualizer); // Don't use Natvis for raw format specifier (!), e.g. "myvar,!". if (FormatSpecifierUtil.HasRawFormatSpecifier(varInfo.FormatSpecifier)) { return(new CachingVariableInformation(varInfo)); } var natvisVarInfo = new NatvisVariableInformation(_natvisExpander, varInfo); if (ExpandFormatSpecifierUtil.TryParseExpandFormatSpecifier( natvisVarInfo.FormatSpecifier, out int expandedIndex)) { return(new CachingVariableInformation( _expandVariableFactory.Create(natvisVarInfo, expandedIndex))); } return(new CachingVariableInformation(natvisVarInfo)); }
public void ExpandFormatSpecifierUtilTest() { int result = 0; Assert.That(ExpandFormatSpecifierUtil. TryParseExpandFormatSpecifier(null, out result), Is.False); Assert.That(ExpandFormatSpecifierUtil. TryParseExpandFormatSpecifier("expand(X)", out result), Is.False); Assert.That(ExpandFormatSpecifierUtil. TryParseExpandFormatSpecifier("expand(1", out result), Is.False); Assert.That(result, Is.EqualTo(-1)); Assert.That(ExpandFormatSpecifierUtil. TryParseExpandFormatSpecifier("xpand(1)", out result), Is.False); Assert.That(result, Is.EqualTo(-1)); Assert.That(ExpandFormatSpecifierUtil. TryParseExpandFormatSpecifier("expand(1)", out result), Is.True); Assert.That(result, Is.EqualTo(1)); Assert.That(ExpandFormatSpecifierUtil. TryParseExpandFormatSpecifier(" !expand(2)", out result), Is.True); Assert.That(result, Is.EqualTo(2)); Assert.That(ExpandFormatSpecifierUtil. TryParseExpandFormatSpecifier("expand(-1)", out result), Is.False); }
public virtual IVariableInformation Create( RemoteValue remoteValue, string displayName = null, FormatSpecifier formatSpecifier = null, CustomVisualizer customVisualizer = CustomVisualizer.None) { IVariableInformation varInfo = _varInfoFactory.Create(remoteValue, displayName, formatSpecifier, customVisualizer); if (customVisualizer != CustomVisualizer.None) { varInfo = new NatvisVariableInformation(_natvisExpander, varInfo); } if (ExpandFormatSpecifierUtil.TryParseExpandFormatSpecifier(varInfo.FormatSpecifier, out int expandedIndex)) { varInfo = _expandVariableFactory.Create(varInfo, expandedIndex); } return(new CachingVariableInformation(varInfo)); }