diff --git a/UpsilonLanguageServer/Lib/Upsilon.dll b/UpsilonLanguageServer/Lib/Upsilon.dll index c4416fc..7143acf 100644 Binary files a/UpsilonLanguageServer/Lib/Upsilon.dll and b/UpsilonLanguageServer/Lib/Upsilon.dll differ diff --git a/UpsilonLanguageServer/Lib/Upsilon.pdb b/UpsilonLanguageServer/Lib/Upsilon.pdb index fb4279e..18bd127 100644 Binary files a/UpsilonLanguageServer/Lib/Upsilon.pdb and b/UpsilonLanguageServer/Lib/Upsilon.pdb differ diff --git a/UpsilonLanguageServer/UpsilonLanguageServer/DiagnosticsProvider.cs b/UpsilonLanguageServer/UpsilonLanguageServer/DiagnosticsProvider.cs index b404a5e..2369caa 100644 --- a/UpsilonLanguageServer/UpsilonLanguageServer/DiagnosticsProvider.cs +++ b/UpsilonLanguageServer/UpsilonLanguageServer/DiagnosticsProvider.cs @@ -50,9 +50,9 @@ namespace UpsilonLanguageServer using (var script = Executor.ParseInput(content, Options)) { session.SourceText = script.ScriptString; - if (script.Diagnostics.Messages.Count > 0) + if (script.Diagnostics.Errors.Count > 0) { - foreach (var error in script.Diagnostics.Messages) + foreach (var error in script.Diagnostics.Errors) { diag.Add(ConvertToVsCodeDiagnostic(error)); } @@ -61,12 +61,16 @@ namespace UpsilonLanguageServer } var bound = script.Bind(); - foreach (var error in script.Diagnostics.Messages) + foreach (var error in script.Diagnostics.Errors) { diag.Add(ConvertToVsCodeDiagnostic(error)); } + foreach (var warning in script.Diagnostics.Warnings) + { + diag.Add(ConvertToVsCodeDiagnostic(warning)); + } - if (script.Diagnostics.Messages.Count == 0) + if (script.Diagnostics.Errors.Count == 0) { session.Bound = bound; } @@ -80,17 +84,32 @@ namespace UpsilonLanguageServer } } - private static Diagnostic ConvertToVsCodeDiagnostic(DiagnosticsMessage error) + private static Diagnostic ConvertToVsCodeDiagnostic(DiagnosticsMessage message) { - var (startPosition, startPositionOnLine) = error.GetStartLine(); - var (endPosition, endPositionOnLine) = error.GetEndLine(); - var sourceString = error.Diagnostics.ScriptString; + var (startPosition, startPositionOnLine) = message.GetStartLine(); + var (endPosition, endPositionOnLine) = message.GetEndLine(); + var sourceString = message.Diagnostics.ScriptString; if (endPosition >= sourceString.GetLineCount()) endPosition = sourceString.GetLineCount(); var range = new Range(startPosition, startPositionOnLine, endPosition, endPositionOnLine); - return new Diagnostic(DiagnosticSeverity.Error, range, error.AtError(), "ERR001", error.Message); + + DiagnosticSeverity severity; + switch (message.DiagnosticLevel) + { + case DiagnosticLevel.Error: + severity = DiagnosticSeverity.Error; + break; + case DiagnosticLevel.Warning: + severity = DiagnosticSeverity.Warning; + break; + default: + severity = DiagnosticSeverity.Information; + break; + } + + return new Diagnostic(severity, range, message.AtError(), "ERR001", message.Message); } } } diff --git a/UpsilonLanguageServer/UpsilonLanguageServer/Services/TextDocumentServer.cs b/UpsilonLanguageServer/UpsilonLanguageServer/Services/TextDocumentServer.cs index aa53230..76b6e56 100644 --- a/UpsilonLanguageServer/UpsilonLanguageServer/Services/TextDocumentServer.cs +++ b/UpsilonLanguageServer/UpsilonLanguageServer/Services/TextDocumentServer.cs @@ -41,6 +41,11 @@ namespace UpsilonLanguageServer.Services { contents.Append($"\n\n{string.Join(" \n", varSymbol.VariableSymbol.CommentValue)}"); } + + if (varSymbol.VariableSymbol is FunctionVariableSymbol fVar) + { + contents.Append($"\n\nReturns: {fVar.ResultType}"); + } } return new Hover()