Skip to content

Commit 9fa1fea

Browse files
committed
Merge pull request #82 from rkeithhill/rkeithhill/debugger-display
Added more DebuggerDisplayAttributes to make debugging of the editor …
2 parents d8b9c7c + 19b2169 commit 9fa1fea

File tree

7 files changed

+22
-15
lines changed

7 files changed

+22
-15
lines changed

src/PowerShellEditorServices.Protocol/LanguageServer/Completion.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6+
using System.Diagnostics;
67
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
7-
using System;
8-
using System.Collections.Generic;
9-
using System.Linq;
10-
using System.Text;
11-
using System.Threading.Tasks;
128

139
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
1410
{
@@ -48,13 +44,15 @@ public enum CompletionItemKind
4844
Reference = 18
4945
}
5046

47+
[DebuggerDisplay("NewText = {NewText}, Range = {Range.Start.Line}:{Range.Start.Character} - {Range.End.Line}:{Range.End.Character}")]
5148
public class TextEdit
5249
{
5350
public Range Range { get; set; }
5451

5552
public string NewText { get; set; }
5653
}
5754

55+
[DebuggerDisplay("Kind = {Kind.ToString()}, Label = {Label}, Detail = {Detail}")]
5856
public class CompletionItem
5957
{
6058
public string Label { get; set; }

src/PowerShellEditorServices.Protocol/LanguageServer/TextDocument.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6+
using System.Diagnostics;
67
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
78

89
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
910
{
1011
/// <summary>
1112
/// Defines a base parameter class for identifying a text document.
1213
/// </summary>
14+
[DebuggerDisplay("TextDocumentIdentifier = {Uri}")]
1315
public class TextDocumentIdentifier
1416
{
1517
/// <summary>
@@ -22,6 +24,7 @@ public class TextDocumentIdentifier
2224
/// <summary>
2325
/// Defines a position in a text document.
2426
/// </summary>
27+
[DebuggerDisplay("TextDocumentPosition = {Position.Line}:{Position.Character}")]
2528
public class TextDocumentPosition : TextDocumentIdentifier
2629
{
2730
/// <summary>
@@ -85,6 +88,7 @@ public class TextDocumentChangeEvent
8588
public string Text { get; set; }
8689
}
8790

91+
[DebuggerDisplay("Position = {Line}:{Character}")]
8892
public class Position
8993
{
9094
/// <summary>
@@ -98,6 +102,7 @@ public class Position
98102
public int Character { get; set; }
99103
}
100104

105+
[DebuggerDisplay("Start = {Start.Line}:{Start.Character}, End = {End.Line}:{End.Character}")]
101106
public struct Range
102107
{
103108
/// <summary>
@@ -111,6 +116,7 @@ public struct Range
111116
public Position End { get; set; }
112117
}
113118

119+
[DebuggerDisplay("Range = {Range.Start.Line}:{Range.Start.Character} - {Range.End.Line}:{Range.End.Character}, Uri = {Uri}")]
114120
public class Location
115121
{
116122
/// <summary>

src/PowerShellEditorServices.Protocol/MessageProtocol/Message.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6+
using System.Diagnostics;
67
using Newtonsoft.Json.Linq;
78

89
namespace Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol
@@ -21,6 +22,7 @@ public enum MessageType
2122
/// <summary>
2223
/// Provides common details for protocol messages of any format.
2324
/// </summary>
25+
[DebuggerDisplay("MessageType = {MessageType.ToString()}, Method = {Method}, Id = {Id}")]
2426
public class Message
2527
{
2628
/// <summary>

src/PowerShellEditorServices.Protocol/MessageProtocol/RequestType.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6-
using System;
7-
using System.Collections.Generic;
8-
using System.Linq;
9-
using System.Text;
10-
using System.Threading.Tasks;
6+
using System.Diagnostics;
117

128
namespace Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol
139
{
10+
[DebuggerDisplay("RequestType MethodName = {MethodName}")]
1411
public class RequestType<TParams, TResult>
1512
{
1613
public string MethodName { get; private set; }

src/PowerShellEditorServices/Language/CompletionResults.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6-
using Microsoft.PowerShell.EditorServices.Utility;
76
using System.Collections.Generic;
7+
using System.Diagnostics;
88
using System.Linq;
99
using System.Management.Automation;
1010
using System.Text.RegularExpressions;
11+
using Microsoft.PowerShell.EditorServices.Utility;
1112

1213
namespace Microsoft.PowerShell.EditorServices
1314
{
@@ -135,6 +136,7 @@ public enum CompletionType
135136
/// <summary>
136137
/// Provides the details about a single completion result.
137138
/// </summary>
139+
[DebuggerDisplay("CompletionType = {CompletionType.ToString()}, CompletionText = {CompletionText}")]
138140
public sealed class CompletionDetails
139141
{
140142
#region Properties

src/PowerShellEditorServices/Language/SymbolDetails.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6-
using System.Linq;
6+
using System.Diagnostics;
7+
using System.Management.Automation;
8+
using System.Management.Automation.Runspaces;
79

810
namespace Microsoft.PowerShell.EditorServices
911
{
10-
using System.Management.Automation;
11-
using System.Management.Automation.Runspaces;
12-
1312
/// <summary>
1413
/// Provides detailed information for a given symbol.
1514
/// </summary>
15+
[DebuggerDisplay("SymbolReference = {SymbolReference.SymbolType}/{SymbolReference.SymbolName}, DisplayString = {DisplayString}")]
1616
public class SymbolDetails
1717
{
1818
#region Properties

src/PowerShellEditorServices/Language/SymbolReference.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6+
using System.Diagnostics;
67
using System.Management.Automation.Language;
78

89
namespace Microsoft.PowerShell.EditorServices
910
{
1011
/// <summary>
1112
/// A class that holds the type, name, script extent, and source line of a symbol
1213
/// </summary>
14+
[DebuggerDisplay("SymbolType = {SymbolType}, SymbolName = {SymbolName}")]
1315
public class SymbolReference
1416
{
1517
#region Properties

0 commit comments

Comments
 (0)