public VSCodeScope(VSCodeStackFrame info, StackFrame frame, Scope.PresentationHintValue name, int varCnt, int varOffset, FileLinePositionSpan span) { this.info = info; scope = new Scope(); scope.Name = name.ToString(); scope.PresentationHint = name; scope.Source = frame.Source; if (span.IsValid) { scope.Line = span.StartLinePosition.Line + 1; scope.Column = span.StartLinePosition.Character + 1; scope.EndLine = span.EndLinePosition.Line + 1; scope.EndColumn = span.EndLinePosition.Character + 1; } else { scope.Line = frame.Line; scope.Column = frame.Column; scope.EndLine = frame.EndLine; scope.EndColumn = frame.EndColumn; } scope.NamedVariables = varCnt; scope.VariablesReference = GetHashCode(); for (int i = 0; i < varCnt; i++) { var v = info.Info.LocalVariables[varOffset + i]; var variable = new VSCodeVariable(info, v); variables.Add(variable); if (v.Expandable) { variableMapping[variable.GetHashCode()] = variable; } } }
public VSCodeVariable(VSCodeStackFrame frame, VariableInfo info) { this.info = info; this.frame = frame; variable = new Variable() { Name = info.Name, Value = info.Value, Type = info.TypeName }; VariablePresentationHint hint = new VariablePresentationHint(); if (info.IsPrivate) { hint.Visibility = VariablePresentationHint.VisibilityValue.Private; } else if (info.IsProtected) { hint.Visibility = VariablePresentationHint.VisibilityValue.Protected; } else { hint.Visibility = VariablePresentationHint.VisibilityValue.Public; } hint.Attributes = VariablePresentationHint.AttributesValue.ReadOnly; if (info.Type == VariableTypes.Boolean) { hint.Attributes |= info.Offset == 1 ? VariablePresentationHint.AttributesValue.IsBoolean | VariablePresentationHint.AttributesValue.IsTrue : VariablePresentationHint.AttributesValue.IsBoolean; } if (info.Type >= VariableTypes.Error) { hint.Attributes |= VariablePresentationHint.AttributesValue.FailedEvaluation; } if (info.Type == VariableTypes.String) { hint.Attributes |= VariablePresentationHint.AttributesValue.RawString; } if (info.Expandable) { variable.VariablesReference = GetHashCode(); } variable.EvaluateName = info.Name; variable.PresentationHint = hint; }