diff --git a/Compiler/Compiler.csproj b/Compiler/Compiler.csproj index 508fb498..7acf6091 100644 --- a/Compiler/Compiler.csproj +++ b/Compiler/Compiler.csproj @@ -29,9 +29,9 @@ - - - + + + diff --git a/Compiler/LangServer/Handlers/CompletionHandler.cs b/Compiler/LangServer/Handlers/CompletionHandler.cs index b11368e0..9c52d7fa 100644 --- a/Compiler/LangServer/Handlers/CompletionHandler.cs +++ b/Compiler/LangServer/Handlers/CompletionHandler.cs @@ -13,7 +13,7 @@ namespace Compiler.LangServer public sealed class CompletionHandler : ICompletionHandler { private readonly BufferManager _bufferManager; - private readonly DocumentSelector _documentSelector; + private readonly TextDocumentSelector _documentSelector; private readonly HashSet _keywords; private readonly HashSet _decorators; private readonly HashSet _constants; @@ -21,8 +21,8 @@ public sealed class CompletionHandler : ICompletionHandler public CompletionHandler(BufferManager bufferManager, CompilerHost compilerHost) { _bufferManager = bufferManager; - _documentSelector = new DocumentSelector( - new DocumentFilter() + _documentSelector = new TextDocumentSelector( + new TextDocumentFilter() { Pattern = "**/*.bop" } diff --git a/Compiler/LangServer/Handlers/HoverHandler.cs b/Compiler/LangServer/Handlers/HoverHandler.cs index 3e926027..4731c4ba 100644 --- a/Compiler/LangServer/Handlers/HoverHandler.cs +++ b/Compiler/LangServer/Handlers/HoverHandler.cs @@ -33,7 +33,7 @@ public HoverHandler(BufferManager bufferManager, public HoverRegistrationOptions GetRegistrationOptions(HoverCapability capability, ClientCapabilities clientCapabilities) { - return new HoverRegistrationOptions() { DocumentSelector = DocumentSelector.ForLanguage("bebop") }; + return new HoverRegistrationOptions() { DocumentSelector = TextDocumentSelector.ForLanguage("bebop") }; } public Task Handle(HoverParams request, CancellationToken cancellationToken) diff --git a/Compiler/LangServer/Handlers/SemanticTokenHandler.cs b/Compiler/LangServer/Handlers/SemanticTokenHandler.cs index ceb4e24a..84812ace 100644 --- a/Compiler/LangServer/Handlers/SemanticTokenHandler.cs +++ b/Compiler/LangServer/Handlers/SemanticTokenHandler.cs @@ -79,7 +79,7 @@ protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(S { return new SemanticTokensRegistrationOptions { - DocumentSelector = DocumentSelector.ForLanguage("bebop"), + DocumentSelector = TextDocumentSelector.ForLanguage("bebop"), Legend = _legend, Full = new SemanticTokensCapabilityRequestFull { diff --git a/Compiler/LangServer/Handlers/TextDocumentSyncHandler.cs b/Compiler/LangServer/Handlers/TextDocumentSyncHandler.cs index 604d848f..bd8e1a6d 100644 --- a/Compiler/LangServer/Handlers/TextDocumentSyncHandler.cs +++ b/Compiler/LangServer/Handlers/TextDocumentSyncHandler.cs @@ -25,7 +25,7 @@ public sealed class TextDocumentSyncHandler : TextDocumentSyncHandlerBase private readonly BufferManager _bufferManager; private readonly BebopDiagnosticPublisher _publisher; private readonly BebopLangServerLogger _logger; - private readonly DocumentSelector _documentSelector; + private readonly TextDocumentSelector _documentSelector; public TextDocumentSyncKind Change { get; } = TextDocumentSyncKind.Full; @@ -41,7 +41,7 @@ public TextDocumentSyncHandler( _bufferManager = bufferManager ?? throw new ArgumentNullException(nameof(bufferManager)); _publisher = publisher ?? throw new ArgumentNullException(nameof(publisher)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); - _documentSelector = new DocumentSelector(new DocumentFilter() + _documentSelector = new TextDocumentSelector(new TextDocumentFilter() { Pattern = "**/*.bop", }); @@ -52,7 +52,7 @@ public override TextDocumentAttributes GetTextDocumentAttributes(DocumentUri uri return new TextDocumentAttributes(uri, "bop"); } - protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions(SynchronizationCapability capability, ClientCapabilities clientCapabilities) + protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions(TextSynchronizationCapability capability, ClientCapabilities clientCapabilities) { return new TextDocumentSyncRegistrationOptions() { diff --git a/Core/Core.csproj b/Core/Core.csproj index bc88bc3e..6e8530f5 100644 --- a/Core/Core.csproj +++ b/Core/Core.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/Core/Meta/JsonContext.cs b/Core/Meta/JsonContext.cs index 95895b89..62536d31 100644 --- a/Core/Meta/JsonContext.cs +++ b/Core/Meta/JsonContext.cs @@ -28,8 +28,8 @@ namespace Core.Meta; [JsonSerializable(typeof(CompilerOutput))] [JsonSerializable(typeof(GeneratedFile))] [JsonSerializable(typeof(AuxiliaryFile))] -[JsonSerializable(typeof(SpanException))] [JsonSerializable(typeof(Exception))] +[JsonSerializable(typeof(SpanException))] [JsonSerializable(typeof(DiagnosticLogger.Diagnostic))] [JsonSerializable(typeof(Span))] [JsonSerializable(typeof(GeneratorContext))] @@ -80,7 +80,14 @@ public override void Write(Utf8JsonWriter writer, Exception value, JsonSerialize if (value.InnerException is not null) { writer.WritePropertyName("innerException"); - JsonSerializer.Serialize(writer, value.InnerException, options); + if (value.InnerException is SpanException spanException) + { + JsonSerializer.Serialize(writer, spanException, JsonContext.Default.SpanException); + } + else + { + JsonSerializer.Serialize(writer, value.InnerException, JsonContext.Default.Exception); + } } writer.WriteEndObject(); }