From 6bae8603264f2d9c790d5f302849c094592ab7dc Mon Sep 17 00:00:00 2001 From: Szepesi Tibor Date: Thu, 20 Jun 2024 13:38:12 +0200 Subject: [PATCH] lsp: Fix semantic token positions --- blueprintcompiler/lsp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blueprintcompiler/lsp.py b/blueprintcompiler/lsp.py index 25705d1..25b289f 100644 --- a/blueprintcompiler/lsp.py +++ b/blueprintcompiler/lsp.py @@ -102,10 +102,10 @@ class OpenFile: ] # convert line, column numbers to deltas - for i, token_list in enumerate(token_lists[1:]): - token_list[0] -= token_lists[i][0] - if token_list[0] == 0: - token_list[1] -= token_lists[i][1] + for a, b in zip(token_lists[-2::-1], token_lists[:0:-1]): + b[0] -= a[0] + if b[0] == 0: + b[1] -= a[1] # flatten the list return [x for y in token_lists for x in y]