Skip to content

Commit

Permalink
[VSCode] Petites corrections sur l'auto-complétion
Browse files Browse the repository at this point in the history
  • Loading branch information
gideruette committed Sep 20, 2024
1 parent 828d91a commit 5ede153
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions TopModel.LanguageServer/CompletionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ private OmniSharp.Extensions.LanguageServer.Protocol.Models.Range GetCompleteRan
request.Position.Line,
start,
request.Position.Line,
Math.Max(end, start + 1));
end);
}

private (string Key, int Line, int End, bool IsKey) GetCurrentKey(CompletionParams request)
Expand Down Expand Up @@ -620,10 +620,10 @@ private string GetSearchText(CompletionParams request)
var text = _fileCache.GetFile(request.TextDocument.Uri.GetFileSystemPath());
var currentLine = text.ElementAtOrDefault(request.Position.Line)!;
int start = 0, end = request.Position.Character;
var left = currentLine[..end];
if (currentLine.Length > 0 && Separators.Exists(currentLine.Contains))
{
var left = currentLine[..request.Position.Character];
start = left.LastIndexOfAny(Separators.ToArray());
start = Math.Min(left.LastIndexOfAny(Separators.ToArray()) + 1, end);
}

return currentLine[start..end].Trim();
Expand Down

0 comments on commit 5ede153

Please sign in to comment.