Skip to content

Commit 784c420

Browse files
author
Kapil Borle
committed
Add a property to get lines in TextEdit class
1 parent aa324dc commit 784c420

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Engine/TextEdit.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions;
25

36
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer
47
{
@@ -35,6 +38,7 @@ public class TextEdit : Range
3538
/// </summary>
3639
public string Text { get; }
3740

41+
public string[] Lines { get; }
3842
/// <summary>
3943
/// Constructs a TextEdit object.
4044
/// </summary>
@@ -56,6 +60,22 @@ public TextEdit(
5660
// be some information to encode the indentation level. Let the client decide the
5761
// new line characters to insert between each line and the indentation type (space or tab)
5862
Text = newText;
63+
Lines = Text.GetLines().ToArray();
5964
}
65+
66+
public TextEdit(
67+
int startLineNumber,
68+
int startColumnNumber,
69+
int endLineNumber,
70+
int endColumnNumber,
71+
IEnumerable<String> lines)
72+
: base(startLineNumber, startColumnNumber, endLineNumber, endColumnNumber)
73+
{
74+
// TODO check arguments
75+
Lines = lines.ToArray();
76+
Text = String.Join(Environment.NewLine, Lines);
77+
}
78+
79+
6080
}
6181
}

0 commit comments

Comments
 (0)