From 1471c79199abada880cdd109f3750a1329d0d8b7 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Thu, 18 Jul 2019 22:25:08 -0400 Subject: [PATCH] Converted to use the new abstract base class to simplify some of the plumbing code --- codealike.json | 1 + .../Handlers/OmniSharpCodeLensHandler.cs | 37 ++++-------- .../Handlers/OmniSharpCompletionHandler.cs | 39 ++++++------- .../Handlers/OmniSharpDefinitionHandler.cs | 24 ++------ .../OmniSharpDocumentSymbolHandler.cs | 24 ++------ .../Handlers/OmniSharpHoverHandler.cs | 24 ++------ .../Handlers/OmniSharpReferencesHandler.cs | 24 ++------ .../Handlers/OmniSharpRenameHandler.cs | 25 +++------ .../Handlers/OmniSharpSignatureHelpHandler.cs | 25 +++------ .../OmniSharpTextDocumentSyncHandler.cs | 56 ++++--------------- 10 files changed, 83 insertions(+), 196 deletions(-) create mode 100644 codealike.json diff --git a/codealike.json b/codealike.json new file mode 100644 index 0000000000..bd0917b796 --- /dev/null +++ b/codealike.json @@ -0,0 +1 @@ +{"projectId":"14125030-a9b5-11e9-91f0-17def6569726","projectName":"omnisharp-roslyn"} \ No newline at end of file diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpCodeLensHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpCodeLensHandler.cs index 997b91c069..9b79e8da0b 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpCodeLensHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpCodeLensHandler.cs @@ -15,7 +15,7 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - internal sealed class OmniSharpCodeLensHandler : ICodeLensHandler, ICodeLensResolveHandler + internal sealed class OmniSharpCodeLensHandler : CodeLensHandler { public static IEnumerable Enumerate(RequestHandlers handlers) { @@ -28,22 +28,24 @@ public static IEnumerable Enumerate(RequestHandlers handlers) } } - private CodeLensCapability _capability; private readonly Mef.IRequestHandler _membersAsTreeHandler; private readonly Mef.IRequestHandler _findUsagesHandler; - private readonly DocumentSelector _documentSelector; public OmniSharpCodeLensHandler( Mef.IRequestHandler membersAsTreeHandler, Mef.IRequestHandler findUsagesHandler, DocumentSelector documentSelector) + : base(new CodeLensRegistrationOptions() + { + DocumentSelector = documentSelector, + ResolveProvider = true + }) { _membersAsTreeHandler = membersAsTreeHandler; _findUsagesHandler = findUsagesHandler; - _documentSelector = documentSelector; } - public async Task Handle(CodeLensParams request, CancellationToken token) + public async override Task Handle(CodeLensParams request, CancellationToken token) { var omnisharpRequest = new MembersTreeRequest() { @@ -61,13 +63,13 @@ public async Task Handle(CodeLensParams request, Cancellation return codeLenseContainer; } - public async Task Handle(CodeLens request, CancellationToken token) + public async override Task Handle(CodeLens request, CancellationToken token) { var omnisharpRequest = new FindUsagesRequest { FileName = Helpers.FromUri(request.Data.ToObject()), - Column = (int) request.Range.Start.Character, - Line = (int) request.Range.Start.Line, + Column = (int)request.Range.Start.Character, + Line = (int)request.Range.Start.Line, OnlyThisFile = false, ExcludeDefinition = true }; @@ -85,21 +87,6 @@ public async Task Handle(CodeLens request, CancellationToken token) return request; } - - public CodeLensRegistrationOptions GetRegistrationOptions() - { - return new CodeLensRegistrationOptions() - { - DocumentSelector = _documentSelector, - ResolveProvider = true - }; - } - - public void SetCapability(CodeLensCapability capability) - { - _capability = capability; - } - private static void ToCodeLens(TextDocumentIdentifier textDocument, FileMemberElement node, List codeLensContainer) { var codeLens = new CodeLens @@ -121,12 +108,12 @@ private static void ToCodeLens(TextDocumentIdentifier textDocument, FileMemberEl } } - public bool CanResolve(CodeLens value) + public override bool CanResolve(CodeLens value) { var textDocumentUri = value.Data.ToObject(); return textDocumentUri != null && - _documentSelector.IsMatch(new TextDocumentAttributes(textDocumentUri, string.Empty)); + GetRegistrationOptions().DocumentSelector.IsMatch(new TextDocumentAttributes(textDocumentUri, string.Empty)); } } } diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpCompletionHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpCompletionHandler.cs index f61bc26de2..620093cf37 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpCompletionHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpCompletionHandler.cs @@ -10,7 +10,7 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - class OmniSharpCompletionHandler : ICompletionHandler + class OmniSharpCompletionHandler : CompletionHandler { public static IEnumerable Enumerate(RequestHandlers handlers) { @@ -21,9 +21,7 @@ public static IEnumerable Enumerate(RequestHandlers handlers) yield return new OmniSharpCompletionHandler(handler, selector); } - private CompletionCapability _capability; private readonly Mef.IRequestHandler> _autoCompleteHandler; - private readonly DocumentSelector _documentSelector; private static readonly IDictionary _kind = new Dictionary{ // types @@ -58,7 +56,7 @@ private static CompletionItemKind GetCompletionItemKind(string key) { return CompletionItemKind.Property; } - if(_kind.TryGetValue(key, out var completionItemKind)) + if (_kind.TryGetValue(key, out var completionItemKind)) { return completionItemKind; } @@ -66,12 +64,18 @@ private static CompletionItemKind GetCompletionItemKind(string key) } public OmniSharpCompletionHandler(Mef.IRequestHandler> autoCompleteHandler, DocumentSelector documentSelector) + : base(new CompletionRegistrationOptions() + { + DocumentSelector = documentSelector, + // TODO: Come along and add a service for getting autocompletion details after the fact. + ResolveProvider = false, + TriggerCharacters = new[] { ".", }, + }) { _autoCompleteHandler = autoCompleteHandler; - _documentSelector = documentSelector; } - public async Task Handle(CompletionParams request, CancellationToken token) + public async override Task Handle(CompletionParams request, CancellationToken token) { var omnisharpRequest = new AutoCompleteRequest() { @@ -81,7 +85,7 @@ public async Task Handle(CompletionParams request, CancellationT WantKind = true, WantDocumentationForEveryCompletionResult = true, WantReturnType = true, - WantSnippet =_capability.CompletionItem?.SnippetSupport ?? false + WantSnippet = Capability.CompletionItem?.SnippetSupport ?? false }; var omnisharpResponse = await _autoCompleteHandler.Handle(omnisharpRequest); @@ -89,11 +93,12 @@ public async Task Handle(CompletionParams request, CancellationT var completions = new Dictionary>(); foreach (var response in omnisharpResponse) { - var isSnippet = !string.IsNullOrEmpty(response.Snippet); - var text = isSnippet ? response.Snippet : response.CompletionText; + var isSnippet = !string.IsNullOrEmpty(response.Snippet); + var text = isSnippet ? response.Snippet : response.CompletionText; var textFormat = isSnippet ? InsertTextFormat.Snippet : InsertTextFormat.PlainText; - var completionItem = new CompletionItem { + var completionItem = new CompletionItem + { Label = response.CompletionText, Detail = !string.IsNullOrEmpty(response.ReturnType) ? response.DisplayText : @@ -104,7 +109,7 @@ public async Task Handle(CompletionParams request, CancellationT InsertTextFormat = textFormat, }; - if(!completions.ContainsKey(completionItem.Label)) + if (!completions.ContainsKey(completionItem.Label)) { completions[completionItem.Label] = new List(); } @@ -129,18 +134,14 @@ public async Task Handle(CompletionParams request, CancellationT return new CompletionList(result); } - public CompletionRegistrationOptions GetRegistrationOptions() + public override Task Handle(CompletionItem request, CancellationToken cancellationToken) { - return new CompletionRegistrationOptions() - { - DocumentSelector = _documentSelector, - TriggerCharacters = new[] { "." }, - }; + throw new NotImplementedException(); } - public void SetCapability(CompletionCapability capability) + public override bool CanResolve(CompletionItem value) { - _capability = capability; + return false; } } } diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpDefinitionHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpDefinitionHandler.cs index 94672ad41d..42003e07b4 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpDefinitionHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpDefinitionHandler.cs @@ -11,7 +11,7 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - class OmniSharpDefinitionHandler : IDefinitionHandler + class OmniSharpDefinitionHandler : DefinitionHandler { public static IEnumerable Enumerate(RequestHandlers handlers) { @@ -20,25 +20,18 @@ public static IEnumerable Enumerate(RequestHandlers handlers) yield return new OmniSharpDefinitionHandler(handler, selector); } - private DefinitionCapability _capability; private readonly Mef.IRequestHandler _definitionHandler; - private readonly DocumentSelector _documentSelector; public OmniSharpDefinitionHandler(Mef.IRequestHandler definitionHandler, DocumentSelector documentSelector) + : base(new TextDocumentRegistrationOptions() + { + DocumentSelector = documentSelector + }) { _definitionHandler = definitionHandler; - _documentSelector = documentSelector; } - public TextDocumentRegistrationOptions GetRegistrationOptions() - { - return new TextDocumentRegistrationOptions() - { - DocumentSelector = _documentSelector - }; - } - - public async Task Handle(DefinitionParams request, CancellationToken token) + public async override Task Handle(DefinitionParams request, CancellationToken token) { var omnisharpRequest = new GotoDefinitionRequest() { @@ -60,10 +53,5 @@ public async Task Handle(DefinitionParams request, Canc Range = ToRange((omnisharpResponse.Column, omnisharpResponse.Line)) }); } - - public void SetCapability(DefinitionCapability capability) - { - _capability = capability; - } } } diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpDocumentSymbolHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpDocumentSymbolHandler.cs index 7e5d92f381..73af1e33fb 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpDocumentSymbolHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpDocumentSymbolHandler.cs @@ -12,7 +12,7 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - internal sealed class OmniSharpDocumentSymbolHandler : IDocumentSymbolHandler + internal sealed class OmniSharpDocumentSymbolHandler : DocumentSymbolHandler { public static IEnumerable Enumerate(RequestHandlers handlers) { @@ -22,9 +22,7 @@ public static IEnumerable Enumerate(RequestHandlers handlers) yield return new OmniSharpDocumentSymbolHandler(handler, selector); } - private DocumentSymbolCapability _capability; private readonly Mef.IRequestHandler _codeStructureHandler; - private readonly DocumentSelector _documentSelector; private static readonly IDictionary Kinds = new Dictionary { @@ -47,12 +45,15 @@ public static IEnumerable Enumerate(RequestHandlers handlers) }; public OmniSharpDocumentSymbolHandler(Mef.IRequestHandler codeStructureHandler, DocumentSelector documentSelector) + : base(new TextDocumentRegistrationOptions() + { + DocumentSelector = documentSelector + }) { _codeStructureHandler = codeStructureHandler; - _documentSelector = documentSelector; } - public async Task Handle(DocumentSymbolParams request, CancellationToken token) + public async override Task Handle(DocumentSymbolParams request, CancellationToken token) { var omnisharpRequest = new CodeStructureRequest() { @@ -65,19 +66,6 @@ public async Task Handle(DocumentSym Array.Empty(); } - public TextDocumentRegistrationOptions GetRegistrationOptions() - { - return new TextDocumentRegistrationOptions() - { - DocumentSelector = _documentSelector - }; - } - - public void SetCapability(DocumentSymbolCapability capability) - { - _capability = capability; - } - private static SymbolInformationOrDocumentSymbol ToDocumentSymbolInformationOrDocumentSymbol(CodeElement node) { return new SymbolInformationOrDocumentSymbol(ToDocumentSymbol(node)); diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpHoverHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpHoverHandler.cs index 4708c90d2e..5cc70ba0b2 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpHoverHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpHoverHandler.cs @@ -10,7 +10,7 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - class OmniSharpHoverHandler : IHoverHandler + class OmniSharpHoverHandler : HoverHandler { public static IEnumerable Enumerate(RequestHandlers handlers) { @@ -20,25 +20,18 @@ public static IEnumerable Enumerate(RequestHandlers handlers) yield return new OmniSharpHoverHandler(handler, selector); } - private HoverCapability _capability; private readonly Mef.IRequestHandler _definitionHandler; - private readonly DocumentSelector _documentSelector; public OmniSharpHoverHandler(Mef.IRequestHandler definitionHandler, DocumentSelector documentSelector) + : base(new TextDocumentRegistrationOptions() + { + DocumentSelector = documentSelector + }) { _definitionHandler = definitionHandler; - _documentSelector = documentSelector; } - public TextDocumentRegistrationOptions GetRegistrationOptions() - { - return new TextDocumentRegistrationOptions() - { - DocumentSelector = _documentSelector - }; - } - - public async Task Handle(HoverParams request, CancellationToken token) + public async override Task Handle(HoverParams request, CancellationToken token) { var omnisharpRequest = new TypeLookupRequest() { @@ -57,10 +50,5 @@ public async Task Handle(HoverParams request, CancellationToken token) Contents = new MarkedStringsOrMarkupContent(new MarkedStringContainer(omnisharpResponse.Type, omnisharpResponse.Documentation)) }; } - - public void SetCapability(HoverCapability capability) - { - _capability = capability; - } } } diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpReferencesHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpReferencesHandler.cs index 5ec630ffe0..98ab2c1339 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpReferencesHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpReferencesHandler.cs @@ -12,7 +12,7 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - internal sealed class OmniSharpReferencesHandler : IReferencesHandler + internal sealed class OmniSharpReferencesHandler : ReferencesHandler { public static IEnumerable Enumerate(RequestHandlers handlers) { @@ -22,17 +22,18 @@ public static IEnumerable Enumerate(RequestHandlers handlers) yield return new OmniSharpReferencesHandler(handler, selector); } - private ReferencesCapability _capability; private readonly Mef.IRequestHandler _findUsagesHandler; - private readonly DocumentSelector _documentSelector; public OmniSharpReferencesHandler(Mef.IRequestHandler findUsagesHandler, DocumentSelector documentSelector) + : base(new TextDocumentRegistrationOptions() + { + DocumentSelector = documentSelector + }) { _findUsagesHandler = findUsagesHandler; - _documentSelector = documentSelector; } - public async Task Handle(ReferenceParams request, CancellationToken token) + public async override Task Handle(ReferenceParams request, CancellationToken token) { var omnisharpRequest = new FindUsagesRequest { @@ -51,18 +52,5 @@ public async Task Handle(ReferenceParams request, Cancellatio Range = x.ToRange() }).ToArray(); } - - public TextDocumentRegistrationOptions GetRegistrationOptions() - { - return new TextDocumentRegistrationOptions() - { - DocumentSelector = _documentSelector - }; - } - - public void SetCapability(ReferencesCapability capability) - { - _capability = capability; - } } } diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpRenameHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpRenameHandler.cs index 7211bc19c3..9f33960399 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpRenameHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpRenameHandler.cs @@ -11,16 +11,18 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - internal class OmniSharpRenameHandler : IRenameHandler + internal class OmniSharpRenameHandler : RenameHandler { private readonly Mef.IRequestHandler _renameHandler; - private readonly DocumentSelector _documentSelector; - private RenameCapability _capability; public OmniSharpRenameHandler(Mef.IRequestHandler renameHandler, DocumentSelector documentSelector) + : base(new RenameRegistrationOptions() + { + DocumentSelector = documentSelector, + PrepareProvider = false + }) { _renameHandler = renameHandler; - _documentSelector = documentSelector; } public static IEnumerable Enumerate(RequestHandlers handlers) @@ -31,7 +33,7 @@ public static IEnumerable Enumerate(RequestHandlers handlers) yield return new OmniSharpRenameHandler(handler, selector); } - public async Task Handle(RenameParams request, CancellationToken token) + public async override Task Handle(RenameParams request, CancellationToken token) { var omnisharpRequest = new RenameRequest { @@ -64,18 +66,5 @@ public async Task Handle(RenameParams request, CancellationToken Changes = changes }; } - - public RenameRegistrationOptions GetRegistrationOptions() - { - return new RenameRegistrationOptions - { - DocumentSelector = _documentSelector - }; - } - - public void SetCapability(RenameCapability capability) - { - _capability = capability; - } } } diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpSignatureHelpHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpSignatureHelpHandler.cs index 6a3ff2cdae..76a748c15a 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpSignatureHelpHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpSignatureHelpHandler.cs @@ -11,16 +11,18 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - internal class OmniSharpSignatureHelpHandler : ISignatureHelpHandler + internal class OmniSharpSignatureHelpHandler : SignatureHelpHandler { private readonly Mef.IRequestHandler _signatureHandler; - private readonly DocumentSelector _documentSelector; - private SignatureHelpCapability _capability; public OmniSharpSignatureHelpHandler(Mef.IRequestHandler signatureHandler, DocumentSelector documentSelector) + : base(new SignatureHelpRegistrationOptions() + { + DocumentSelector = documentSelector, + TriggerCharacters = new[] { ".", "?", "[" } + }) { _signatureHandler = signatureHandler; - _documentSelector = documentSelector; } public static IEnumerable Enumerate(RequestHandlers handlers) @@ -31,7 +33,7 @@ public static IEnumerable Enumerate(RequestHandlers handlers) yield return new OmniSharpSignatureHelpHandler(handler, selector); } - public async Task Handle(SignatureHelpParams request, CancellationToken token) + public async override Task Handle(SignatureHelpParams request, CancellationToken token) { var omnisharpRequest = new SignatureHelpRequest { @@ -67,18 +69,5 @@ public async Task Handle(SignatureHelpParams request, Cancellatio Signatures = signatures }; } - - public SignatureHelpRegistrationOptions GetRegistrationOptions() - { - return new SignatureHelpRegistrationOptions - { - DocumentSelector = _documentSelector - }; - } - - public void SetCapability(SignatureHelpCapability capability) - { - _capability = capability; - } } } diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpTextDocumentSyncHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpTextDocumentSyncHandler.cs index 6ef8e951c7..c4f4b39975 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpTextDocumentSyncHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpTextDocumentSyncHandler.cs @@ -18,7 +18,7 @@ namespace OmniSharp.LanguageServerProtocol.Handlers { - class OmniSharpTextDocumentSyncHandler : ITextDocumentSyncHandler + class OmniSharpTextDocumentSyncHandler : TextDocumentSyncHandler { public static IEnumerable Enumerate( RequestHandlers handlers, @@ -38,8 +38,6 @@ public static IEnumerable Enumerate( } // TODO Make this configurable? - private readonly DocumentSelector _documentSelector; - private SynchronizationCapability _capability; private readonly Mef.IRequestHandler _openHandler; private readonly Mef.IRequestHandler _closeHandler; private readonly Mef.IRequestHandler _bufferHandler; @@ -52,25 +50,26 @@ public OmniSharpTextDocumentSyncHandler( DocumentSelector documentSelector, TextDocumentSyncKind documentSyncKind, OmniSharpWorkspace workspace) + : base(documentSyncKind, new TextDocumentSaveRegistrationOptions() + { + DocumentSelector = documentSelector, + IncludeText = true, + }) { _openHandler = openHandler; _closeHandler = closeHandler; _bufferHandler = bufferHandler; _workspace = workspace; - _documentSelector = documentSelector; - Change = documentSyncKind; } - public TextDocumentSyncKind Change { get; } - - public TextDocumentAttributes GetTextDocumentAttributes(Uri uri) + public override TextDocumentAttributes GetTextDocumentAttributes(Uri uri) { var document = _workspace.GetDocument(Helpers.FromUri(uri)); if (document == null) return new TextDocumentAttributes(uri, ""); return new TextDocumentAttributes(uri, ""); } - public async Task Handle(DidChangeTextDocumentParams notification, CancellationToken cancellationToken) + public async override Task Handle(DidChangeTextDocumentParams notification, CancellationToken cancellationToken) { var contentChanges = notification.ContentChanges.ToArray(); if (contentChanges.Length == 1 && contentChanges[0].Range == null) @@ -105,7 +104,7 @@ await _bufferHandler.Handle(new UpdateBufferRequest() return Unit.Value; } - public async Task Handle(DidOpenTextDocumentParams notification, CancellationToken cancellationToken) + public async override Task Handle(DidOpenTextDocumentParams notification, CancellationToken cancellationToken) { if (_openHandler != null) { @@ -119,7 +118,7 @@ await _openHandler.Handle(new FileOpenRequest() return Unit.Value; } - public async Task Handle(DidCloseTextDocumentParams notification, CancellationToken cancellationToken) + public async override Task Handle(DidCloseTextDocumentParams notification, CancellationToken cancellationToken) { if (_closeHandler != null) { @@ -132,9 +131,9 @@ await _closeHandler.Handle(new FileCloseRequest() return Unit.Value; } - public async Task Handle(DidSaveTextDocumentParams notification, CancellationToken cancellationToken) + public async override Task Handle(DidSaveTextDocumentParams notification, CancellationToken cancellationToken) { - if (_capability?.DidSave == true) + if (Capability?.DidSave == true) { await _bufferHandler.Handle(new UpdateBufferRequest() { @@ -144,36 +143,5 @@ await _bufferHandler.Handle(new UpdateBufferRequest() } return Unit.Value; } - - TextDocumentChangeRegistrationOptions IRegistration.GetRegistrationOptions() - { - return new TextDocumentChangeRegistrationOptions() - { - DocumentSelector = _documentSelector, - SyncKind = Change - }; - } - - TextDocumentRegistrationOptions IRegistration.GetRegistrationOptions() - { - return new TextDocumentRegistrationOptions() - { - DocumentSelector = _documentSelector, - }; - } - - TextDocumentSaveRegistrationOptions IRegistration.GetRegistrationOptions() - { - return new TextDocumentSaveRegistrationOptions() - { - DocumentSelector = _documentSelector, - IncludeText = true - }; - } - - public void SetCapability(SynchronizationCapability capability) - { - _capability = capability; - } } }