Skip to content

Commit 7149642

Browse files
committed
Add TextDocument.GetRange(Range).
Relax some ICollection<> parameters to IEnumerable<>.
1 parent 0aab4b0 commit 7149642

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

LanguageServer.VsCode/Contracts/Command.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public ExecuteCommandRegistrationOptions() : this(null)
4646
{
4747
}
4848

49-
public ExecuteCommandRegistrationOptions(ICollection<string> commands)
49+
public ExecuteCommandRegistrationOptions(IEnumerable<string> commands)
5050
{
5151
Commands = commands;
5252
}

LanguageServer.VsCode/Contracts/InitializationResponse.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public ExecuteCommandOptions()
259259

260260
}
261261

262-
public ExecuteCommandOptions(IList<string> commands)
262+
public ExecuteCommandOptions(IEnumerable<string> commands)
263263
{
264264
Commands = commands;
265265
}
@@ -268,7 +268,7 @@ public ExecuteCommandOptions(IList<string> commands)
268268
/// Document links have a resolve provider as well.
269269
/// </summary>
270270
[JsonProperty]
271-
public IList<string> Commands { get; set; }
271+
public IEnumerable<string> Commands { get; set; }
272272
}
273273

274274
/// <summary>

LanguageServer.VsCode/Server/TextDocument.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ protected virtual void OnLoad(TextDocumentItem doc)
7575
/// </summary>
7676
public abstract TextDocument ApplyChanges(IList<TextDocumentContentChangeEvent> changes);
7777

78+
/// <summary>
79+
/// Gets a part of the content by the specified line/column-based range.
80+
/// </summary>
81+
public virtual string GetRange(Range range)
82+
{
83+
var start = OffsetAt(range.Start);
84+
return GetRange(start, OffsetAt(range.End) - start);
85+
}
86+
7887
/// <summary>
7988
/// Gets a part of the content by the specified offset range.
8089
/// </summary>

0 commit comments

Comments
 (0)