Skip to content

Commit 249bdfe

Browse files
authored
Merge pull request #1077 from manandre/fix-notebook-selector
Fix NotebookSelector type
2 parents 86dc4ac + bfe4199 commit 249bdfe

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/Protocol/Features/Document/NotebookDocumentSyncFeature.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.ObjectModel;
33
using System.Diagnostics;
44
using System.Linq;
@@ -734,7 +734,7 @@ public interface INotebookDocumentRegistrationOptions : IRegistrationOptions
734734
/// <summary>
735735
/// The notebooks to be synced
736736
/// </summary>
737-
NotebookSelector NotebookSelector { get; set; }
737+
Container<NotebookSelector> NotebookSelector { get; set; }
738738
}
739739

740740
/// <summary>
@@ -761,7 +761,7 @@ public partial class NotebookDocumentSyncOptions : INotebookDocumentRegistration
761761
/// value is provided it matches against the
762762
/// notebook type. '*' matches every notebook.
763763
/// </summary>
764-
public NotebookSelector NotebookSelector { get; set; }
764+
public Container<NotebookSelector> NotebookSelector { get; set; }
765765

766766
/// <summary>
767767
/// Whether save notification should be forwarded to

src/Server/Matchers/NotebookDocumentMatcher.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ private IEnumerable<ILspHandlerDescriptor> GetHandler(IEnumerable<ILspHandlerDes
101101
var registrationOptions = descriptor.RegistrationOptions as INotebookDocumentRegistrationOptions;
102102

103103
_logger.LogTrace("Registration options {OptionsName}", registrationOptions?.GetType().FullName);
104-
_logger.LogTrace("Document Selector {NotebookDocumentSelector}", registrationOptions?.NotebookSelector?.ToString() ?? string.Empty);
105-
if (registrationOptions?.NotebookSelector is null || registrationOptions.NotebookSelector.IsMatch(attributes))
104+
var selector = registrationOptions?.NotebookSelector?.FirstOrDefault(s => s.IsMatch(attributes));
105+
_logger.LogTrace("Document Selector {NotebookDocumentSelector}", selector?.ToString());
106+
if (registrationOptions?.NotebookSelector is null || selector is not null)
106107
{
107108
_logger.LogTrace(
108109
"Handler Selected: {Handler} {Id} via {NotebookDocumentSelector} (targeting {HandlerInterface})",
109110
descriptor.ImplementationType.FullName,
110111
descriptor.Handler is ICanBeIdentifiedHandler h ? h.Id.ToString() : string.Empty,
111-
registrationOptions?.NotebookSelector?.ToString(),
112+
selector?.ToString(),
112113
descriptor.HandlerType.FullName
113114
);
114115
yield return descriptor;

0 commit comments

Comments
 (0)