-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathLanguageClientOptions.cs
142 lines (106 loc) · 8.44 KB
/
LanguageClientOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Client;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Shared;
namespace OmniSharp.Extensions.LanguageServer.Client
{
public class LanguageClientOptions : LanguageProtocolRpcOptionsBase<LanguageClientOptions>, ILanguageClientRegistry
{
public LanguageClientOptions()
{
WithAssemblies(typeof(LanguageClientOptions).Assembly, typeof(LspRequestRouter).Assembly);
}
public ClientCapabilities ClientCapabilities { get; set; } = new ClientCapabilities {
Experimental = new Dictionary<string, JToken>(),
Window = new WindowClientCapabilities(),
Workspace = new WorkspaceClientCapabilities(),
TextDocument = new TextDocumentClientCapabilities()
};
public ClientInfo? ClientInfo { get; set; }
public DocumentUri? RootUri { get; set; }
public bool WorkspaceFolders { get; set; } = true;
public bool DynamicRegistration { get; set; } = true;
public bool ProgressTokens { get; set; } = true;
public string RootPath
{
get => RootUri?.GetFileSystemPath() ?? string.Empty;
set => RootUri = DocumentUri.FromFileSystemPath(value);
}
public InitializeTrace Trace { get; set; }
public object? InitializationOptions { get; set; }
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandler(string method, IJsonRpcHandler handler, JsonRpcHandlerOptions? options) =>
AddHandler(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandler(string method, JsonRpcHandlerFactory handlerFunc, JsonRpcHandlerOptions? options) =>
AddHandler(method, handlerFunc, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandlers(params IJsonRpcHandler[] handlers) => AddHandlers(handlers);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandler(JsonRpcHandlerFactory handlerFunc, JsonRpcHandlerOptions? options) =>
AddHandler(handlerFunc, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandler(IJsonRpcHandler handler, JsonRpcHandlerOptions? options) =>
AddHandler(handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandler<TTHandler>(JsonRpcHandlerOptions? options) => AddHandler<TTHandler>(options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandler<TTHandler>(string method, JsonRpcHandlerOptions? options) =>
AddHandler<TTHandler>(method, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandler(Type type, JsonRpcHandlerOptions? options) => AddHandler(type, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandler(string method, Type type, JsonRpcHandlerOptions? options) =>
AddHandler(method, type, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.AddHandlerLink(string fromMethod, string toMethod) =>
AddHandlerLink(fromMethod, toMethod);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnJsonRequest(string method, Func<JToken, Task<JToken>> handler, JsonRpcHandlerOptions? options) =>
OnJsonRequest(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnJsonRequest(
string method, Func<JToken, CancellationToken, Task<JToken>> handler, JsonRpcHandlerOptions? options
) => OnJsonRequest(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnRequest<TParams, TResponse>(
string method, Func<TParams, Task<TResponse>> handler, JsonRpcHandlerOptions? options
) => OnRequest(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnRequest<TParams, TResponse>(
string method, Func<TParams, CancellationToken, Task<TResponse>> handler, JsonRpcHandlerOptions? options
) => OnRequest(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.
OnRequest<TResponse>(string method, Func<Task<TResponse>> handler, JsonRpcHandlerOptions? options) => OnRequest(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnRequest<TResponse>(
string method, Func<CancellationToken, Task<TResponse>> handler, JsonRpcHandlerOptions? options
) => OnRequest(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnRequest<TParams>(string method, Func<TParams, Task> handler, JsonRpcHandlerOptions? options) =>
OnRequest(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnRequest<TParams>(
string method, Func<TParams, CancellationToken, Task> handler, JsonRpcHandlerOptions? options
) => OnRequest(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnRequest<TParams>(
string method, Func<CancellationToken, Task> handler, JsonRpcHandlerOptions? options
) => OnRequest<TParams>(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnNotification<TParams>(
string method, Action<TParams, CancellationToken> handler, JsonRpcHandlerOptions? options
) => OnNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnJsonNotification(string method, Action<JToken> handler, JsonRpcHandlerOptions? options) =>
OnJsonNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnJsonNotification(
string method, Func<JToken, CancellationToken, Task> handler, JsonRpcHandlerOptions? options
) => OnJsonNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnJsonNotification(string method, Func<JToken, Task> handler, JsonRpcHandlerOptions? options) =>
OnJsonNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnJsonNotification(
string method, Action<JToken, CancellationToken> handler, JsonRpcHandlerOptions? options
) => OnJsonNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnNotification<TParams>(string method, Action<TParams> handler, JsonRpcHandlerOptions? options) =>
OnNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnNotification<TParams>(
string method, Func<TParams, CancellationToken, Task> handler, JsonRpcHandlerOptions? options
) => OnNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.
OnNotification<TParams>(string method, Func<TParams, Task> handler, JsonRpcHandlerOptions? options) => OnNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnNotification(string method, Action handler, JsonRpcHandlerOptions? options) =>
OnNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.
OnNotification(string method, Func<CancellationToken, Task> handler, JsonRpcHandlerOptions? options) => OnNotification(method, handler, options);
ILanguageClientRegistry IJsonRpcHandlerRegistry<ILanguageClientRegistry>.OnNotification(string method, Func<Task> handler, JsonRpcHandlerOptions? options) =>
OnNotification(method, handler, options);
}
}