Skip to content

Commit 3cae4fc

Browse files
react to new registration type for semantic tokens (#401)
* react to new registration type for semantic tokens * Updated other changes made to spec * Added strongly typed call hierarchy items * Updated tests to use retry
1 parent 69ff46b commit 3cae4fc

34 files changed

+1267
-110
lines changed

language-server-protocol.sha.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-- This is the last commit we caught up with https://github.com/Microsoft/language-server-protocol/commits/gh-pages
2-
lastSha: 1cf527d8410a493789de4992f78ee9874a4fd215
2+
lastSha: a94f201e01fcdc0a308741bf3d46eef1a47fb6b5
33

4-
https://github.com/Microsoft/language-server-protocol/compare/<lastSha>..gh-pages
4+
https://github.com/Microsoft/language-server-protocol/compare/a94f201e01fcdc0a308741bf3d46eef1a47fb6b5..gh-pages
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Reflection;
5+
using MediatR;
6+
7+
namespace OmniSharp.Extensions.JsonRpc
8+
{
9+
public class RegistrationNameAttribute : Attribute
10+
{
11+
public string Method { get; }
12+
13+
public RegistrationNameAttribute(string method) => Method = method;
14+
15+
public static RegistrationNameAttribute? From(Type? type) => AllFrom(type).FirstOrDefault();
16+
17+
public static IEnumerable<RegistrationNameAttribute> AllFrom(Type? type) =>
18+
CollectMethodAttributes(type)
19+
.Concat(
20+
type
21+
?.GetInterfaces()
22+
.SelectMany(CollectMethodAttributes)
23+
?? Enumerable.Empty<RegistrationNameAttribute>()
24+
);
25+
26+
private static IEnumerable<RegistrationNameAttribute> CollectMethodAttributes(Type? type)
27+
{
28+
if (type == null) return Enumerable.Empty<RegistrationNameAttribute>();
29+
if (type.IsGenericType && typeof(IRequestHandler<,>) == type.GetGenericTypeDefinition())
30+
{
31+
return type.GetTypeInfo().GetCustomAttributes<RegistrationNameAttribute>(true).Concat(AllFrom(type.GetGenericArguments()[0]));
32+
}
33+
34+
return type.GetTypeInfo().GetCustomAttributes<RegistrationNameAttribute>(true);
35+
}
36+
}
37+
}

src/Protocol/Client/Capabilities/DocumentSymbolCapability.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,14 @@ public class DocumentSymbolCapability : DynamicCapability, ConnectedCapability<I
2929
[Obsolete(Constants.Proposal)]
3030
[Optional]
3131
public TagSupportCapabilityOptions? TagSupport { get; set; }
32+
33+
/// <summary>
34+
/// The client supports an additional label presented in the UI when
35+
/// registering a document symbol provider.
36+
///
37+
/// @since 3.16.0
38+
/// </summary>
39+
[Optional]
40+
public bool LabelSupport { get; set; }
3241
}
3342
}

src/Protocol/Client/Capabilities/PublishDiagnosticsCapability.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,23 @@ public class PublishDiagnosticsCapability : ICapability
3131
/// </summary>
3232
[Optional]
3333
public bool VersionSupport { get; set; }
34+
35+
/// <summary>
36+
/// Client supports a codeDescription property
37+
///
38+
/// @since 3.16.0 - proposed state
39+
/// </summary>
40+
[Optional]
41+
public bool CodeDescriptionSupport { get; set; }
42+
43+
/// <summary>
44+
/// Whether code action supports the `data` property which is
45+
/// preserved between a `textDocument/publishDiagnostics` and
46+
/// `textDocument/codeAction` request.
47+
///
48+
/// @since 3.16.0 - proposed state
49+
/// </summary>
50+
[Optional]
51+
public bool DataSupport { get; set; }
3452
}
3553
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
3+
4+
namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
5+
{
6+
/// <summary>
7+
/// Capabilities specific to the semantic token requests scoped to the
8+
/// workspace.
9+
///
10+
/// @since 3.16.0 - proposed state.
11+
/// </summary>
12+
[Obsolete(Constants.Proposal)]
13+
[CapabilityKey(nameof(ClientCapabilities.TextDocument), nameof(WorkspaceClientCapabilities.SemanticTokens))]
14+
public class SemanticTokensWorkspaceCapability : ICapability
15+
{
16+
/// <summary>
17+
/// Whether the client implementation supports a refresh request send from
18+
/// the server to the client. This is useful if a server detects a project
19+
/// wide configuration change which requires a re-calculation of all semantic
20+
/// tokens provided by the server issuing the request.
21+
/// </summary>
22+
[Optional]
23+
public bool RefreshSupport { get; set; }
24+
}
25+
}

src/Protocol/Client/Capabilities/WorkspaceClientCapabilities.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ public class WorkspaceClientCapabilities : CapabilitiesBase
3030
/// </summary>
3131
public Supports<ExecuteCommandCapability?> ExecuteCommand { get; set; }
3232

33+
/// <summary>
34+
/// Capabilities specific to the semantic token requests scoped to the
35+
/// workspace.
36+
///
37+
/// @since 3.16.0 - proposed state.
38+
/// </summary>
39+
public Supports<SemanticTokensWorkspaceCapability> SemanticTokens { get; set; }
40+
3341
/// <summary>
3442
/// The client has support for workspace folders.
3543
///

0 commit comments

Comments
 (0)