From a452ca52a0458cc76fe09e3d2f52a8cf4d8d83dd Mon Sep 17 00:00:00 2001 From: Mike Wright Date: Thu, 11 Jun 2020 11:28:07 -0700 Subject: [PATCH] v2.0.8 release (#108) * RegEx fix for labels with leading spaces. * 98-Issue linting with multiple levels of quoting * RegEx improvement for quoted strings * Replace parenthesis and quoted strings with empty ones. - Removed repetitive Trim()s - Removed unnecessary RegEx tests - Simplified line split on semicolon due to above changes. - Results: Faster execution. Better coverage for split on semicolon * - Cleanup lines[] array at start so repeated test/replace not needed - Removed unnecessary trim()s - Removed boolean equality tests. if(x.test == true) vs if(x.test) - Fixed GOTO/GOSUB when followed by more than one space GOTO 100 * RegEx fix-ups to support recent changes * Corrected comment * Linter RegEx cleanup * FOR/NEXT tracking improvements and updated error messages - Nested For/Next statements now validated - NEXT with no variable is now allowed - One line per error: Removed extraneous, repeated diagnostic messages - Reworded / Clarified some error messages for consistency * Minor code clean-up * Replace char-at-a-time split on ; with split(";") * Maintain original character spacing for Intellisense error markers - RegEx improvements and consistency between client and server - Improved getWord() function * Corrected indentation for ELSE END with trailing comment (issue #45) * Corrects Label error with GOTO/GOSUB. Issue #99 - Also now allows dotted numeric labels such as GOTO 100.5 * Revert "Corrects Label error with GOTO/GOSUB. Issue #99" This reverts commit 68b0166087d2bea43b178fe51fb098c17d77a539. * Inspect TM Scopes->Inspect Editor Token and Scopes * Fix error processing customWordPath when last line is blank. May relate to #24. * Changed GOTO/GOSUB scope jumping message from Error to Warning * Numerous updates related to For/Next and Label tracking - Issue #45: Alignment of If/Else - Issue #96: Allow periods in labels - Issue #99: Corrected Label error with GOTO/GOSUB. - Issue #104: Corrected For/Next with leading label - Issue #105: Changed GOTO scope jumping message from Error to Warning - RegEx: Label comments to include "REM, *, and !" - NEXT can be used without FOR variable. * Shipping 2.0.7 * Re-introduce accidentally deleted /doc files * Fixes issue 107: FOR/NEXT error when no whitespace after FOR variable. * Shipping 2.0.8 Co-authored-by: Kevin Powick Co-authored-by: Ian McGowan Co-authored-by: Peter Schellenbach --- CHANGELOG.md | 6 +++++- client/package.json | 2 +- package.json | 2 +- server/package.json | 2 +- server/src/server.ts | 6 +++--- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09542ed..4d16692 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,4 +51,8 @@ - Fixed bug with space-prefixed labels (#96) - Improved linting (#98) - Improved label detection with GOTO/GOSUB (#99) -- Fixed bug with FOR/NEXT linting with labels (#104) \ No newline at end of file +- Fixed bug with FOR/NEXT linting with labels (#104) + +## 2.0.8 + +- Fixed a bug with FOR/NEXT recognition and spacing (#107) diff --git a/client/package.json b/client/package.json index 78ca538..26084dc 100644 --- a/client/package.json +++ b/client/package.json @@ -2,7 +2,7 @@ "name": "mvbasic", "displayName": "MV Basic", "description": "MV Basic", - "version": "2.0.7", + "version": "2.0.8", "publisher": "mvextensions", "license": "MIT", "icon": "../images/mvbasic-logo.png", diff --git a/package.json b/package.json index f60556f..a1213bb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "mvbasic", "displayName": "MV Basic", "description": "MV Basic", - "version": "2.0.7", + "version": "2.0.8", "publisher": "mvextensions", "license": "MIT", "icon": "images/mvbasic-logo.png", diff --git a/server/package.json b/server/package.json index 2a0ed09..8ac65cd 100644 --- a/server/package.json +++ b/server/package.json @@ -2,7 +2,7 @@ "name": "mvbasic", "displayName": "MV Basic", "description": "MV Basic", - "version": "2.0.7", + "version": "2.0.8", "publisher": "mvextensions", "license": "MIT", "icon": "../images/mvbasic-logo.png", diff --git a/server/src/server.ts b/server/src/server.ts index 9a81101..2e3b19b 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -240,7 +240,7 @@ function validateTextDocument(textDocument: TextDocument): void { let rBlockAlways = new RegExp("(^| )(for |loop( |$))", "i"); let rBlockContinue = new RegExp(" (then|else|case|on error|locked)$", "i"); let rBlockEnd = new RegExp("(^| )(end|end case|next|next\\s+.+|repeat)$", "i"); - let rStartFor = new RegExp("(^| )for\\s+.+", "i"); + let rStartFor = new RegExp("(^| )for\\s+[\\w.]+\\s*=", "i"); let rEndFor = new RegExp("(^| )next($|\\s+.+$)", "i"); let rStartLoop = new RegExp("(^| )loop\\s*?", "i"); let rEndLoop = new RegExp("(^| )repeat\\s*$", "i"); @@ -327,7 +327,8 @@ function validateTextDocument(textDocument: TextDocument): void { // and build errors list (forNextErr[]). let arrFor = rStartFor.exec(line.lineOfCode) if (arrFor !== null) { - let forvar = getWord(arrFor[0], 2); + let sFor = arrFor[0].split("="); + let forvar = getWord(sFor[0], 2); forNext.push({ forVar: forvar, forLine: i }); } let arrNext = rEndFor.exec(line.lineOfCode) @@ -901,7 +902,6 @@ connection.onDefinition(params => { }); return newProgram; } - //let rLabel = new RegExp("(^[0-9]+\\s)|(^[0-9]+:\\s)|(^[\\w\\.]+:)", "i"); let rLabel = new RegExp( "(^[0-9]+\\b)|(^[0-9]+)|(^[0-9]+:\\s)|(^[\\w\\.]+:(?!\\=))", "i"