diff --git a/Client/upsilon-language-extension-1.0.0.vsix b/Client/upsilon-language-extension-1.0.0.vsix index 004ad95..e1419ea 100644 Binary files a/Client/upsilon-language-extension-1.0.0.vsix and b/Client/upsilon-language-extension-1.0.0.vsix differ diff --git a/UpsilonLanguageServer/Lib/Upsilon.dll b/UpsilonLanguageServer/Lib/Upsilon.dll index df39ece..98e6d32 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 042a6f4..cafaf10 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 0fef31a..ab62b0e 100644 --- a/UpsilonLanguageServer/UpsilonLanguageServer/DiagnosticsProvider.cs +++ b/UpsilonLanguageServer/UpsilonLanguageServer/DiagnosticsProvider.cs @@ -77,14 +77,9 @@ namespace UpsilonLanguageServer private static Diagnostic ConvertToVsCodeDiagnostic(DiagnosticsMessage message) { - 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); + var range = new Range(message.Span.StartLine, message.Span.StartPosition, message.Span.EndLine, + message.Span.EndPosition); DiagnosticSeverity severity; switch (message.DiagnosticLevel) diff --git a/UpsilonLanguageServer/UpsilonLanguageServer/Services/TextDocumentServer.cs b/UpsilonLanguageServer/UpsilonLanguageServer/Services/TextDocumentServer.cs index ee71b73..e29a2f0 100644 --- a/UpsilonLanguageServer/UpsilonLanguageServer/Services/TextDocumentServer.cs +++ b/UpsilonLanguageServer/UpsilonLanguageServer/Services/TextDocumentServer.cs @@ -27,8 +27,7 @@ namespace UpsilonLanguageServer.Services { if (doc.Bound != null && doc.SourceText != null) { - var linePos = doc.SourceText.GetLineStartPos(position.Line); - var findNode = doc.Bound.GetBottomNodeAtPosition(linePos + position.Character); + var findNode = doc.Bound.GetBottomNodeAtPosition(position.Line, position.Character); if (findNode != null) { var contents = new StringBuilder($"Kind: {findNode.Kind}"); @@ -79,8 +78,7 @@ namespace UpsilonLanguageServer.Services await doc.WaitForDocumentBound(); if (doc.Bound != null && doc.SourceText != null) { - var linePos = doc.SourceText.GetLineStartPos(position.Line); - var findNode = doc.Bound.GetBottomNodeAtPosition(linePos + position.Character); + var findNode = doc.Bound.GetBottomNodeAtPosition(position.Line, position.Character); if (findNode != null) { if (findNode.Kind == BoundKind.BoundFunctionCallExpression) @@ -172,9 +170,7 @@ namespace UpsilonLanguageServer.Services if (doc.Bound == null) return new CompletionList(new CompletionItem[0], false); - var linePos = doc.SourceText.GetLineStartPos(position.Line); - var characterPosition = linePos + position.Character; - using (var nodeIterator = doc.Bound.GetNodeAtPosition(characterPosition).GetEnumerator()) + using (var nodeIterator = doc.Bound.GetNodeAtPosition(position.Line, position.Character).GetEnumerator()) { if (nodeIterator.MoveNext()) { @@ -197,7 +193,7 @@ namespace UpsilonLanguageServer.Services } } - var scope = doc.Bound.GetScopeAt(characterPosition); + var scope = doc.Bound.GetScopeAt(position.Line, position.Character); var variables = scope.GetBoundScopeVisibleVariables(); if (scope != null) {