From 5ede15348cf31b9fa0936f6c3ddf69b53857a42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gild=C3=A9ric=20DERUETTE?= Date: Fri, 20 Sep 2024 11:14:36 +0200 Subject: [PATCH] =?UTF-8?q?[VSCode]=20Petites=20corrections=20sur=20l'auto?= =?UTF-8?q?-compl=C3=A9tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TopModel.LanguageServer/CompletionHandler.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TopModel.LanguageServer/CompletionHandler.cs b/TopModel.LanguageServer/CompletionHandler.cs index d9e4f146..9c7a6e10 100644 --- a/TopModel.LanguageServer/CompletionHandler.cs +++ b/TopModel.LanguageServer/CompletionHandler.cs @@ -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) @@ -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();