Skip to content

Commit c152b02

Browse files
LSP Models 2.2
1 parent b4fcc89 commit c152b02

File tree

84 files changed

+219
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+219
-238
lines changed

src/Protocol/Models/MessageActionItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class MessageActionItem
88
/// <summary>
99
/// A short title like 'Retry', 'Open Log' etc.
1010
/// </summary>
11-
public string Title { get; set; }
11+
public string Title { get; set; } = null!;
1212

1313
private string DebuggerDisplay => Title;
1414

src/Protocol/Models/ParameterInformation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public class ParameterInformation
1414
/// The label of this parameter. Will be shown in
1515
/// the UI.
1616
/// </summary>
17-
public ParameterInformationLabel Label { get; set; }
17+
public ParameterInformationLabel Label { get; set; } = null!;
1818

1919
/// <summary>
2020
/// The human-readable doc-comment of this parameter. Will be shown
2121
/// in the UI but can be omitted.
2222
/// </summary>
2323
[Optional]
24-
public StringOrMarkupContent Documentation { get; set; }
24+
public StringOrMarkupContent? Documentation { get; set; }
2525

2626
private string DebuggerDisplay => $"{Label}{( Documentation != null ? $" {Documentation}" : string.Empty )}";
2727

src/Protocol/Models/ParameterInformationLabel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public class ParameterInformationLabel
1414

1515
public (int start, int end) Range { get; }
1616
public bool IsRange => Label == null;
17-
public string Label { get; }
17+
public string? Label { get; }
1818
public bool IsLabel => Label != null;
1919

2020
public static implicit operator ParameterInformationLabel(string label) => new ParameterInformationLabel(label);
2121

2222
public static implicit operator ParameterInformationLabel((int start, int end) range) => new ParameterInformationLabel(range);
2323

24-
private string DebuggerDisplay => IsRange ? $"(start: {Range.start}, end: {Range.end})" : IsLabel ? Label : string.Empty;
24+
private string DebuggerDisplay => IsRange ? $"(start: {Range.start}, end: {Range.end})" : IsLabel ? Label! : string.Empty;
2525

2626
/// <inheritdoc />
2727
public override string ToString() => DebuggerDisplay;

src/Protocol/Models/PlaceholderRange.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Models
22
{
33
public class PlaceholderRange
44
{
5-
public Range Range { get; set; }
6-
public string Placeholder { get; set; }
5+
public Range Range { get; set; } = null!;
6+
public string Placeholder { get; set; } = null!;
77
}
88
}

src/Protocol/Models/Position.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public Position(int line, int character)
2727
/// </summary>
2828
public int Character { get; set; }
2929

30-
public override bool Equals(object obj) => Equals(obj as Position);
30+
public override bool Equals(object? obj) => Equals(obj as Position);
3131

32-
public bool Equals(Position other) =>
33-
other != null &&
32+
public bool Equals(Position? other) =>
33+
other is not null &&
3434
Line == other.Line &&
3535
Character == other.Character;
3636

src/Protocol/Models/PrepareRenameParams.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace OmniSharp.Extensions.LanguageServer.Protocol.Models
55
{
66
[Method(TextDocumentNames.PrepareRename, Direction.ClientToServer)]
7-
public class PrepareRenameParams : TextDocumentPositionParams, IRequest<RangeOrPlaceholderRange>
7+
public class PrepareRenameParams : TextDocumentPositionParams, IRequest<RangeOrPlaceholderRange?>
88
{
99
}
1010
}

src/Protocol/Models/ProgressParams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public static ProgressParams Create<T>(ProgressToken token, T value, JsonSeriali
1717
/// <summary>
1818
/// The progress token provided by the client or server.
1919
/// </summary>
20-
public ProgressToken Token { get; set; }
20+
public ProgressToken Token { get; set; } = null!;
2121

2222
/// <summary>
2323
/// The progress data.
2424
/// </summary>
25-
public JToken Value { get; set; }
25+
public JToken Value { get; set; } = null!;
2626
}
2727
}

src/Protocol/Models/ProgressToken.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Models
1111
public class ProgressToken : IEquatable<ProgressToken>, IEquatable<long>, IEquatable<string>
1212
{
1313
private long? _long;
14-
private string _string;
14+
private string? _string;
1515

1616
public ProgressToken(long value)
1717
{
@@ -38,7 +38,7 @@ public long Long
3838

3939
public bool IsString => _string != null;
4040

41-
public string String
41+
public string? String
4242
{
4343
get => _string;
4444
set {
@@ -63,7 +63,7 @@ public override int GetHashCode()
6363
hashCode = hashCode * -1521134295 + IsLong.GetHashCode();
6464
hashCode = hashCode * -1521134295 + Long.GetHashCode();
6565
hashCode = hashCode * -1521134295 + IsString.GetHashCode();
66-
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(String);
66+
if (String != null) hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(String);
6767
return hashCode;
6868
}
6969

@@ -77,7 +77,7 @@ public bool Equals(ProgressToken other) =>
7777

7878
public bool Equals(string other) => IsString && String == other;
7979

80-
private string DebuggerDisplay => IsString ? String : IsLong ? Long.ToString() : "";
80+
private string DebuggerDisplay => IsString ? String! : IsLong ? Long.ToString() : "";
8181

8282
/// <inheritdoc />
8383
public override string ToString() => DebuggerDisplay;

src/Protocol/Models/Proposals/CallHierarchyIncomingCall.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public class CallHierarchyIncomingCall
1313
/// <summary>
1414
/// The item that makes the call.
1515
/// </summary>
16-
public CallHierarchyItem From { get; set; }
16+
public CallHierarchyItem From { get; set; } = null!;
1717

1818
/// <summary>
1919
/// The range at which at which the calls appears. This is relative to the caller
2020
/// denoted by [`this.from`](#CallHierarchyIncomingCall.from).
2121
/// </summary>
22-
public Container<Range> FromRanges { get; set; }
22+
public Container<Range> FromRanges { get; set; } = null!;
2323
}
2424
}

src/Protocol/Models/Proposals/CallHierarchyIncomingCallsParams.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals
1010
/// </summary>
1111
[Obsolete(Constants.Proposal)]
1212
[Method(TextDocumentNames.CallHierarchyIncoming, Direction.ClientToServer)]
13-
public class CallHierarchyIncomingCallsParams : IWorkDoneProgressParams, IPartialItemsRequest<Container<CallHierarchyIncomingCall>, CallHierarchyIncomingCall>
13+
public class CallHierarchyIncomingCallsParams : IWorkDoneProgressParams, IPartialItemsRequest<Container<CallHierarchyIncomingCall>?, CallHierarchyIncomingCall>
1414
{
15-
public CallHierarchyItem Item { get; set; }
16-
public ProgressToken WorkDoneToken { get; set; }
17-
public ProgressToken PartialResultToken { get; set; }
15+
public CallHierarchyItem Item { get; set; } = null!;
16+
public ProgressToken? WorkDoneToken { get; set; }
17+
public ProgressToken? PartialResultToken { get; set; }
1818
}
1919
}

src/Protocol/Models/Proposals/CallHierarchyItem.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CallHierarchyItem
1515
/// <summary>
1616
/// The name of this item.
1717
/// </summary>
18-
public string Name { get; set; }
18+
public string Name { get; set; } = null!;
1919

2020
/// <summary>
2121
/// The kind of this item.
@@ -26,28 +26,28 @@ public class CallHierarchyItem
2626
/// Tags for this item.
2727
/// </summary>
2828
[Optional]
29-
public Container<SymbolTag> Tags { get; set; }
29+
public Container<SymbolTag>? Tags { get; set; }
3030

3131
/// <summary>
3232
/// More detail for this item, e.g. the signature of a function.
3333
/// </summary>
3434
[Optional]
35-
public string Detail { get; set; }
35+
public string? Detail { get; set; }
3636

3737
/// <summary>
3838
/// The resource identifier of this item.
3939
/// </summary>
40-
public DocumentUri Uri { get; set; }
40+
public DocumentUri Uri { get; set; } = null!;
4141

4242
/// <summary>
4343
/// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
4444
/// </summary>
45-
public Range Range { get; set; }
45+
public Range Range { get; set; } = null!;
4646

4747
/// <summary>
4848
/// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
4949
/// Must be contained by the [`range`](#CallHierarchyItem.range).
5050
/// </summary>
51-
public Range SelectionRange { get; set; }
51+
public Range SelectionRange { get; set; } = null!;
5252
}
5353
}

src/Protocol/Models/Proposals/CallHierarchyOutgoingCall.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public class CallHierarchyOutgoingCall
1313
/// <summary>
1414
/// The item that is called.
1515
/// </summary>
16-
public CallHierarchyItem To { get; set; }
16+
public CallHierarchyItem To { get; set; } = null!;
1717

1818
/// <summary>
1919
/// The range at which this item is called. This is the range relative to the caller, e.g the item
2020
/// passed to [`provideCallHierarchyOutgoingCalls`](#CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls)
2121
/// and not [`this.to`](#CallHierarchyOutgoingCall.to).
2222
/// </summary>
23-
public Container<Range> FromRanges { get; set; }
23+
public Container<Range> FromRanges { get; set; } = null!;
2424
}
2525
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using OmniSharp.Extensions.JsonRpc;
33

44
namespace OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals
@@ -10,10 +10,10 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals
1010
/// </summary>
1111
[Obsolete(Constants.Proposal)]
1212
[Method(TextDocumentNames.CallHierarchyOutgoing, Direction.ClientToServer)]
13-
public class CallHierarchyOutgoingCallsParams : IWorkDoneProgressParams, IPartialItemsRequest<Container<CallHierarchyOutgoingCall>, CallHierarchyOutgoingCall>
13+
public class CallHierarchyOutgoingCallsParams : IWorkDoneProgressParams, IPartialItemsRequest<Container<CallHierarchyOutgoingCall>?, CallHierarchyOutgoingCall>
1414
{
15-
public CallHierarchyItem Item { get; set; }
16-
public ProgressToken WorkDoneToken { get; set; }
17-
public ProgressToken PartialResultToken { get; set; }
15+
public CallHierarchyItem Item { get; set; } = null!;
16+
public ProgressToken? WorkDoneToken { get; set; }
17+
public ProgressToken? PartialResultToken { get; set; }
1818
}
1919
}

src/Protocol/Models/Proposals/CallHierarchyPrepareParams.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals
1111
/// </summary>
1212
[Obsolete(Constants.Proposal)]
1313
[Method(TextDocumentNames.PrepareCallHierarchy, Direction.ClientToServer)]
14-
public class CallHierarchyPrepareParams : WorkDoneTextDocumentPositionParams, IRequest<Container<CallHierarchyItem>>
14+
public class CallHierarchyPrepareParams : WorkDoneTextDocumentPositionParams, IRequest<Container<CallHierarchyItem>?>
1515
{
1616
}
1717
}

src/Protocol/Models/Proposals/CallHierarchyRegistrationOptions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using OmniSharp.Extensions.JsonRpc;
5-
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
62
using OmniSharp.Extensions.LanguageServer.Protocol.Server.Capabilities;
73

84
namespace OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals

src/Protocol/Models/Proposals/SemanticTokenFormat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals
4747

4848
public override bool Equals(object obj) => obj is SemanticTokenFormat other && Equals(other);
4949

50-
public override int GetHashCode() => _value != null ? _value.GetHashCode() : 0;
50+
public override int GetHashCode() => _value.GetHashCode();
5151

5252
public static bool operator ==(SemanticTokenFormat left, SemanticTokenFormat right) => left.Equals(right);
5353

src/Protocol/Models/Proposals/SemanticTokenModifiers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals
5757

5858
public override bool Equals(object obj) => obj is SemanticTokenModifier other && Equals(other);
5959

60-
public override int GetHashCode() => _value != null ? _value.GetHashCode() : 0;
60+
public override int GetHashCode() => _value.GetHashCode();
6161

6262
public static bool operator ==(SemanticTokenModifier left, SemanticTokenModifier right) => left.Equals(right);
6363

src/Protocol/Models/Proposals/SemanticTokenTypes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals
7070

7171
public override bool Equals(object obj) => obj is SemanticTokenType other && Equals(other);
7272

73-
public override int GetHashCode() => _value != null ? _value.GetHashCode() : 0;
73+
public override int GetHashCode() => _value.GetHashCode();
7474

7575
public static bool operator ==(SemanticTokenType left, SemanticTokenType right) => left.Equals(right);
7676

src/Protocol/Models/Proposals/SemanticTokens.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class SemanticTokens
1717
/// send a delta.
1818
/// </summary>
1919
[Optional]
20-
public string ResultId { get; set; }
20+
public string? ResultId { get; set; }
2121

2222
/// <summary>
2323
/// The actual tokens. For a detailed description about how the data is

src/Protocol/Models/Proposals/SemanticTokensDelta.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public class SemanticTokensDelta
1616
/// send a delta.
1717
/// </summary>
1818
[Optional]
19-
public string ResultId { get; set; }
19+
public string? ResultId { get; set; }
2020

2121
/// <summary>
2222
/// For a detailed description how these edits are structured pls see
2323
/// https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L131
2424
/// </summary>
25-
public Container<SemanticTokensEdit> Edits { get; set; }
25+
public Container<SemanticTokensEdit> Edits { get; set; } = null!;
2626
}
2727
}

src/Protocol/Models/Proposals/SemanticTokensDeltaParams.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public class SemanticTokensDeltaParams : IWorkDoneProgressParams, ITextDocumentI
1414
/// <summary>
1515
/// The text document.
1616
/// </summary>
17-
public TextDocumentIdentifier TextDocument { get; set; }
17+
public TextDocumentIdentifier TextDocument { get; set; } = null!;
1818

1919
/// <summary>
2020
/// The previous result id.
2121
/// </summary>
22-
public string PreviousResultId { get; set; }
22+
public string PreviousResultId { get; set; } = null!;
2323

24-
public ProgressToken WorkDoneToken { get; set; }
25-
public ProgressToken PartialResultToken { get; set; }
24+
public ProgressToken? WorkDoneToken { get; set; }
25+
public ProgressToken? PartialResultToken { get; set; }
2626
}
2727
}

src/Protocol/Models/Proposals/SemanticTokensDeltaPartialResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public class SemanticTokensDeltaPartialResult
1313
/// structured pls see
1414
/// https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L71
1515
/// </summary>
16-
public Container<SemanticTokensEdit> Edits { get; set; }
16+
public Container<SemanticTokensEdit> Edits { get; set; } = null!;
1717
}
1818
}

src/Protocol/Models/Proposals/SemanticTokensEdit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public class SemanticTokensEdit
2626
/// https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L71
2727
/// </summary>
2828
[Optional]
29-
public ImmutableArray<int> Data { get; set; } = ImmutableArray<int>.Empty;
29+
public ImmutableArray<int>? Data { get; set; } = ImmutableArray<int>.Empty;
3030
}
3131
}

src/Protocol/Models/Proposals/SemanticTokensFullOrDelta.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ public SemanticTokensFullOrDelta(SemanticTokens full)
2121
}
2222

2323
public bool IsFull => Full != null;
24-
public SemanticTokens Full { get; }
24+
public SemanticTokens? Full { get; }
2525

2626
public bool IsDelta => Delta != null;
27-
public SemanticTokensDelta Delta { get; }
27+
public SemanticTokensDelta? Delta { get; }
2828

2929
public static implicit operator SemanticTokensFullOrDelta(SemanticTokensDelta semanticTokensDelta) => new SemanticTokensFullOrDelta(semanticTokensDelta);
3030

src/Protocol/Models/Proposals/SemanticTokensFullOrDeltaPartialResult.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ SemanticTokensDeltaPartialResult delta
2525
}
2626

2727
public bool IsDelta => Delta != null;
28-
public SemanticTokensDeltaPartialResult Delta { get; }
28+
public SemanticTokensDeltaPartialResult? Delta { get; }
2929

3030
public bool IsFull => Full != null;
31-
public SemanticTokensPartialResult Full { get; }
31+
public SemanticTokensPartialResult? Full { get; }
3232

3333
public static implicit operator SemanticTokensFullOrDeltaPartialResult(SemanticTokensPartialResult semanticTokensPartialResult) =>
3434
new SemanticTokensFullOrDeltaPartialResult(semanticTokensPartialResult);

0 commit comments

Comments
 (0)