Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <jestedfa@microsoft.com>2020-01-08 02:20:03 +0300
committerJeffrey Stedfast <jestedfa@microsoft.com>2020-01-08 16:49:47 +0300
commita6d76406d5ac6b6a345d0974046b4bb1e6357796 (patch)
treee104d9dd7560a9a915a84050dfad3491424ef1f3 /main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol
parentcdea65569265d77995a7e478cd10dd7386b2ca4b (diff)
[VsCodeDebugger] Use PresentationHint to get ObjectValueFlags
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol')
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeEvaluationSource.cs5
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeVariableSource.cs4
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs58
3 files changed, 62 insertions, 5 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeEvaluationSource.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeEvaluationSource.cs
index 54af40f0dc..235b7adaa2 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeEvaluationSource.cs
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeEvaluationSource.cs
@@ -44,8 +44,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
var actualType = GetActualTypeName (response.Type);
- // FIXME: can we use VariablePresentationHint.AttributesValue.ReadOnly/Constant/Static etc for Flags?
- Flags = ObjectValueFlags.ReadOnly;
+ Flags = GetFlags (response.PresentationHint);
type = actualType.Replace (", ", ",");
name = expression;
@@ -59,7 +58,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
Flags |= ObjectValueFlags.ArrayElement;
if (type == null || value == $"'{name}' threw an exception of type '{type}'")
- Flags |= ObjectValueFlags.Error;
+ Flags = ObjectValueFlags.Error;
}
protected override string Display {
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeVariableSource.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeVariableSource.cs
index a488f98f2c..789e4ef0c4 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeVariableSource.cs
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeVariableSource.cs
@@ -20,8 +20,8 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
var actualType = GetActualTypeName (variable.Type);
- // FIXME: can we use VariablePresentationHint.AttributesValue.ReadOnly/Constant/Static etc for Flags?
Flags = parentVariablesReference > 0 ? ObjectValueFlags.None : ObjectValueFlags.ReadOnly;
+ Flags |= GetFlags (variable.PresentationHint);
name = GetFixedVariableName (variable.Name);
type = actualType.Replace (", ", ",");
@@ -35,7 +35,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
Flags |= ObjectValueFlags.ArrayElement;
if (type == null || value == $"'{name}' threw an exception of type '{type}'")
- Flags |= ObjectValueFlags.Error;
+ Flags = ObjectValueFlags.Error;
}
protected override string Display {
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs
index a8a84c86fb..bae1cf7637 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs
@@ -65,6 +65,64 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
get;
}
+ protected ObjectValueFlags GetFlags (VariablePresentationHint hint)
+ {
+ var flags = ObjectValueFlags.None;
+
+ if (hint != null) {
+ if (hint.Attributes.HasValue) {
+ var attributes = hint.Attributes.Value;
+
+ if ((attributes & VariablePresentationHint.AttributesValue.FailedEvaluation) != 0)
+ return ObjectValueFlags.Error;
+ if ((attributes & VariablePresentationHint.AttributesValue.Constant) != 0)
+ flags |= ObjectValueFlags.Literal;
+ if ((attributes & VariablePresentationHint.AttributesValue.ReadOnly) != 0)
+ flags |= ObjectValueFlags.ReadOnly;
+ if ((attributes & VariablePresentationHint.AttributesValue.Static) != 0)
+ flags |= ObjectValueFlags.ReadOnly;
+ if ((attributes & VariablePresentationHint.AttributesValue.CanHaveObjectId) != 0)
+ flags |= ObjectValueFlags.Primitive;
+ if ((attributes & VariablePresentationHint.AttributesValue.HasObjectId) != 0)
+ flags |= ObjectValueFlags.Object;
+ }
+
+ if (hint.Kind.HasValue) {
+ var kind = hint.Kind.Value;
+
+ if ((kind & VariablePresentationHint.KindValue.Property) != 0)
+ flags |= ObjectValueFlags.Property;
+ if ((kind & VariablePresentationHint.KindValue.BaseClass) != 0)
+ flags |= ObjectValueFlags.Type;
+ if ((kind & VariablePresentationHint.KindValue.Class) != 0)
+ flags |= ObjectValueFlags.Type;
+ if ((kind & VariablePresentationHint.KindValue.InnerClass) != 0)
+ flags |= ObjectValueFlags.Type;
+ if ((kind & VariablePresentationHint.KindValue.Interface) != 0)
+ flags |= ObjectValueFlags.Type;
+ if ((kind & VariablePresentationHint.KindValue.MostDerivedClass) != 0)
+ flags |= ObjectValueFlags.Type;
+ if ((kind & VariablePresentationHint.KindValue.Data) != 0)
+ flags |= ObjectValueFlags.Variable;
+ }
+
+ if (hint.Visibility.HasValue) {
+ var visibility = hint.Visibility.Value;
+
+ if ((visibility & VariablePresentationHint.VisibilityValue.Protected) != 0)
+ flags |= ObjectValueFlags.Protected;
+ if ((visibility & VariablePresentationHint.VisibilityValue.Internal) != 0)
+ flags |= ObjectValueFlags.Internal;
+ if ((visibility & VariablePresentationHint.VisibilityValue.Private) != 0)
+ flags |= ObjectValueFlags.Private;
+ if ((visibility & VariablePresentationHint.VisibilityValue.Public) != 0)
+ flags |= ObjectValueFlags.Public;
+ }
+ }
+
+ return flags;
+ }
+
protected static string GetActualTypeName (string type)
{
int startIndex;