public static ILanguageServerRegistry OnDocumentLink(this ILanguageServerRegistry registry, Action <DocumentLinkParams, IObserver <IEnumerable <DocumentLink> > > handler, Func <DocumentLink, bool> canResolve, Func <DocumentLink, Task <DocumentLink> > resolveHandler, DocumentLinkRegistrationOptions registrationOptions) { registrationOptions ??= new DocumentLinkRegistrationOptions(); registrationOptions.ResolveProvider = canResolve != null && resolveHandler != null; canResolve ??= item => registrationOptions.ResolveProvider; resolveHandler ??= (link) => Task.FromException <DocumentLink>(new NotImplementedException()); return(registry.AddHandler(TextDocumentNames.DocumentLink, _ => new LanguageProtocolDelegatingHandlers.PartialResults <DocumentLinkParams, DocumentLinkContainer, DocumentLink, DocumentLinkRegistrationOptions>( handler, registrationOptions, _.GetRequiredService <IProgressManager>(), x => new DocumentLinkContainer(x))) .AddHandler(TextDocumentNames.DocumentLinkResolve, new LanguageProtocolDelegatingHandlers.CanBeResolved <DocumentLink, DocumentLinkRegistrationOptions>( resolveHandler, canResolve, registrationOptions)) ); }
public DelegatingHandler( Func <DocumentLinkParams, CancellationToken, Task <DocumentLinkContainer> > handler, Func <DocumentLink, CancellationToken, Task <DocumentLink> > resolveHandler, Func <DocumentLink, bool> canResolve, Action <DocumentLinkCapability> setCapability, DocumentLinkRegistrationOptions registrationOptions) : base(registrationOptions) { _handler = handler; _resolveHandler = resolveHandler; _canResolve = canResolve; _setCapability = setCapability; }
public static IDisposable OnDocumentLink( this ILanguageServerRegistry registry, Func <DocumentLinkParams, CancellationToken, Task <DocumentLinkContainer> > handler, Func <DocumentLink, CancellationToken, Task <DocumentLink> > resolveHandler = null, Func <DocumentLink, bool> canResolve = null, DocumentLinkRegistrationOptions registrationOptions = null, Action <DocumentLinkCapability> setCapability = null) { registrationOptions = registrationOptions ?? new DocumentLinkRegistrationOptions(); registrationOptions.ResolveProvider = canResolve != null && resolveHandler != null; return(registry.AddHandlers(new DelegatingHandler(handler, resolveHandler, canResolve, setCapability, registrationOptions))); }
public void SimpleTest(string expected) { var model = new DocumentLinkRegistrationOptions() { DocumentSelector = new DocumentSelector(new DocumentFilter() { Language = "csharp" }), ResolveProvider = true }; var result = Fixture.SerializeObject(model); result.Should().Be(expected); var deresult = new Serializer(ClientVersion.Lsp3).DeserializeObject <DocumentLinkRegistrationOptions>(expected); deresult.Should().BeEquivalentTo(model); }
public static ILanguageServerRegistry OnDocumentLink(this ILanguageServerRegistry registry, Func <DocumentLinkParams, CancellationToken, Task <DocumentLinkContainer> > handler, Func <DocumentLink, bool> canResolve, Func <DocumentLink, CancellationToken, Task <DocumentLink> > resolveHandler, DocumentLinkRegistrationOptions registrationOptions) { registrationOptions ??= new DocumentLinkRegistrationOptions(); registrationOptions.ResolveProvider = canResolve != null && resolveHandler != null; canResolve ??= item => registrationOptions.ResolveProvider; resolveHandler ??= (link, token) => Task.FromException <DocumentLink>(new NotImplementedException()); return(registry.AddHandler(TextDocumentNames.DocumentLink, new LanguageProtocolDelegatingHandlers.RequestRegistration <DocumentLinkParams, DocumentLinkContainer, DocumentLinkRegistrationOptions>( handler, registrationOptions)).AddHandler(TextDocumentNames.DocumentLinkResolve, new LanguageProtocolDelegatingHandlers.CanBeResolved <DocumentLink, DocumentLinkRegistrationOptions>( resolveHandler, canResolve, registrationOptions)) ); }
public DocumentLinkHandler(DocumentLinkRegistrationOptions registrationOptions) { _options = registrationOptions; }
public DocumentLinkHandler(DocumentLinkRegistrationOptions registrationOptions, ProgressManager progressManager) { _options = registrationOptions; ProgressManager = progressManager; }
public DocumentLinkHandlerBase(DocumentLinkRegistrationOptions registrationOptions, ISerializer serializer) : base(registrationOptions) => _serializer = serializer;
public DocumentLinkHandler(DocumentLinkRegistrationOptions registrationOptions) { _options = registrationOptions; _options.ResolveProvider = true; }