From 902a5de8c247bcdde6a1fca1d156be514fa91b4d Mon Sep 17 00:00:00 2001 From: Fred Wu Date: Wed, 5 Aug 2026 22:40:10 +1000 Subject: [PATCH 1/2] Fixed completeness detection for balanced square brackets --- CHANGELOG.md | 6 ++++++ src/Language/parser.ts | 17 +++-------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc82cba..1bf30b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to R Console will be documented in this file. +## [Unreleased] + +### Fixed + +- Fixed some valid R commands with balanced square brackets being incorrectly treated as incomplete. + ## [0.4.3] - 2026-07-16 ### Recent changes diff --git a/src/Language/parser.ts b/src/Language/parser.ts index 256ff4d..a5b9dd9 100644 --- a/src/Language/parser.ts +++ b/src/Language/parser.ts @@ -604,7 +604,6 @@ interface ParserState { parenDepth: number; braceDepth: number; bracketDepth: number; - dblBracketDepth: number; } export async function isExpressionCompleteAsync(code: string): Promise { @@ -648,7 +647,6 @@ function classifyExpressionHeuristic(code: string): LocalParseClassification { parenDepth: 0, braceDepth: 0, bracketDepth: 0, - dblBracketDepth: 0, }; let sawUnknownToken = false; @@ -685,18 +683,10 @@ function classifyExpressionHeuristic(code: string): LocalParseClassification { state.braceDepth -= 1; break; case TokenType.LeftBracket: - if (token.value === "[[") { - state.dblBracketDepth += 1; - } else { - state.bracketDepth += 1; - } + state.bracketDepth += token.value.length; break; case TokenType.RightBracket: - if (token.value === "]]") { - state.dblBracketDepth -= 1; - } else { - state.bracketDepth -= 1; - } + state.bracketDepth -= token.value.length; break; case TokenType.Unknown: sawUnknownToken = true; @@ -709,8 +699,7 @@ function classifyExpressionHeuristic(code: string): LocalParseClassification { if ( state.parenDepth > 0 || state.braceDepth > 0 || - state.bracketDepth > 0 || - state.dblBracketDepth > 0 + state.bracketDepth > 0 ) { return "incomplete"; } From d140dfea3982d79dedf383db5cee77f795f8872a Mon Sep 17 00:00:00 2001 From: Fred Wu Date: Wed, 5 Aug 2026 23:05:30 +1000 Subject: [PATCH 2/2] Bump version to 0.4.4 --- CHANGELOG.md | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bf30b2..8915926 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,11 @@ All notable changes to R Console will be documented in this file. -## [Unreleased] +## [0.4.4] - 2026-08-05 ### Fixed -- Fixed some valid R commands with balanced square brackets being incorrectly treated as incomplete. +- Fixed some valid R commands with balanced square brackets being incorrectly treated as incomplete during execution. ## [0.4.3] - 2026-07-16 diff --git a/package-lock.json b/package-lock.json index 02c6b4f..782a501 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vsc-r-console", - "version": "0.4.3", + "version": "0.4.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vsc-r-console", - "version": "0.4.3", + "version": "0.4.4", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@xterm/headless": "^6.0.0", diff --git a/package.json b/package.json index 0f6c454..393d4ae 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vsc-r-console", "displayName": "R Console for VS Code", "description": "A lightweight R console for VS Code", - "version": "0.4.3", + "version": "0.4.4", "publisher": "RConsole", "license": "SEE LICENSE IN LICENSE", "icon": "images/Rlogo.png",