From a40877c1db33f515a4791bca363d57aa69a11426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vetle=20Andersen=20Kopperg=C3=A5rd?= <89847536+vetlek@users.noreply.github.com> Date: Wed, 22 Nov 2023 09:08:20 +0100 Subject: [PATCH] fix: completion of properties in calcs (#396) Fix completion of properties in calcs --- server/src/septic/algParser.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/server/src/septic/algParser.ts b/server/src/septic/algParser.ts index 6560f7cd..4d318c47 100644 --- a/server/src/septic/algParser.ts +++ b/server/src/septic/algParser.ts @@ -168,14 +168,19 @@ export class AlgParser extends Parser { this.advance(); end = this.previous().end; content += "."; - this.advance(); - let nextToken = this.variable(); - if (nextToken.start === end) { - content += nextToken.content; - end = nextToken.end; + let nextToken = this.peek(); + if (nextToken?.start === end) { + if ( + nextToken?.type === AlgTokenType.identifier || + nextToken?.type === AlgTokenType.jinja + ) { + this.advance(); + let nextVariable = this.variable(); + content += nextVariable.content; + end = nextVariable.end; + } } } - return { start: token.start, end: end,