From d9c061ab084912dafe1da2c309f05df9cdfbb8b1 Mon Sep 17 00:00:00 2001 From: Mohammed Alamri Date: Tue, 11 Oct 2022 17:55:14 +0300 Subject: [PATCH 1/6] a potential fix to #63 --- package.json | 2 +- src/decorator.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1bc0799..db57ce1 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Inline fold", "description": "A custom decorator that \"fold\" matching content in single line", "icon": "res/icon.png", - "version": "0.1.9", + "version": "0.1.10", "publisher": "moalamri", "homepage": "https://github.com/moalamri/vscode-inline-fold", "bugs": "https://github.com/moalamri/vscode-inline-fold/issues", diff --git a/src/decorator.ts b/src/decorator.ts index 88217fd..b392c5b 100644 --- a/src/decorator.ts +++ b/src/decorator.ts @@ -89,6 +89,8 @@ export class Decorator { let match; while (match = regEx.exec(text)) { + if(match && !match[regexGroup]) continue; + const matched = match[regexGroup]; const foldIndex = match[0].lastIndexOf(matched); const startPosition = this.startPositionLine(match.index, foldIndex); From 6c5c52733fbb6d82ab2ba26da6ee981438731206 Mon Sep 17 00:00:00 2001 From: Mohammed Alamri Date: Tue, 11 Oct 2022 19:59:18 +0300 Subject: [PATCH 2/6] Document the fix --- src/decorator.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/decorator.ts b/src/decorator.ts index b392c5b..819173e 100644 --- a/src/decorator.ts +++ b/src/decorator.ts @@ -89,6 +89,7 @@ export class Decorator { let match; while (match = regEx.exec(text)) { + // if the matched content is undefined, skip it and continue to the next match if(match && !match[regexGroup]) continue; const matched = match[regexGroup]; From 97818d9a807215102a2df2f00ef2365a3cbe7209 Mon Sep 17 00:00:00 2001 From: Mohammed Alamri Date: Tue, 11 Oct 2022 19:59:24 +0300 Subject: [PATCH 3/6] Change log --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c16321a..0e56d8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@
+> ### v0.1.10: +- fix: [#63](https://github.com/moalamri/vscode-inline-fold/issues/63) + > ### v0.1.9: - fix: extension crashing when the regex is misconfigured. - now all the extensions commands starts with `Inline Fold:` From aac276778f785dc9d85874c066d76e738f8b039a Mon Sep 17 00:00:00 2001 From: Mohammed Alamri Date: Tue, 11 Oct 2022 20:03:08 +0300 Subject: [PATCH 4/6] Update package.json scripts --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index db57ce1..d853699 100644 --- a/package.json +++ b/package.json @@ -174,9 +174,8 @@ } }, "scripts": { - "vscode:prepublish": "pnpm run compile", - "vscode:package": "vsce package", - "vscode:publish": "vsce publish", + "vscode:prepublish": "pnpm run compile && vsce package", + "publish": "vsce publish", "compile": "tsc -p ./", "watch": "tsc -watch -p ./" }, From 0a7502a8fc7952544929a09b1fe654311a4dd2cb Mon Sep 17 00:00:00 2001 From: Mohammed Alamri Date: Tue, 11 Oct 2022 20:05:03 +0300 Subject: [PATCH 5/6] Update ts to 4.8.4 --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d853699..54ea5bc 100644 --- a/package.json +++ b/package.json @@ -182,7 +182,7 @@ "devDependencies": { "@types/vscode": "1.71.0", "@types/node": "^17.0.33", - "typescript": "4.8.3" + "typescript": "4.8.4" }, "__metadata": { "id": "4dc4b505-dda3-4ac6-b839-397f8cf0adcc", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e3ec5c7..f47114f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,12 +3,12 @@ lockfileVersion: 5.4 specifiers: '@types/node': ^17.0.33 '@types/vscode': 1.71.0 - typescript: 4.8.3 + typescript: 4.8.4 devDependencies: '@types/node': 17.0.34 '@types/vscode': 1.71.0 - typescript: 4.8.3 + typescript: 4.8.4 packages: @@ -20,8 +20,8 @@ packages: resolution: {integrity: sha512-nB50bBC9H/x2CpwW9FzRRRDrTZ7G0/POttJojvN/LiVfzTGfLyQIje1L1QRMdFXK9G41k5UJN/1B9S4of7CSzA==} dev: true - /typescript/4.8.3: - resolution: {integrity: sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==} + /typescript/4.8.4: + resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} engines: {node: '>=4.2.0'} hasBin: true dev: true From 78bcffa510a65cd4aadc2f1231519a803caa08b0 Mon Sep 17 00:00:00 2001 From: Mohammed Alamri Date: Tue, 11 Oct 2022 20:16:24 +0300 Subject: [PATCH 6/6] Add deactivate method to dispose context --- package.json | 3 ++- src/extension.ts | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 54ea5bc..2dec896 100644 --- a/package.json +++ b/package.json @@ -174,7 +174,8 @@ } }, "scripts": { - "vscode:prepublish": "pnpm run compile && vsce package", + "vscode:prepublish": "pnpm run compile", + "package": "vsce package", "publish": "vsce publish", "compile": "tsc -p ./", "watch": "tsc -watch -p ./" diff --git a/src/extension.ts b/src/extension.ts index 3af12d8..4f6493e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -63,3 +63,8 @@ export function activate(context: ExtensionContext) { context.subscriptions.push(changeVisibleRange); context.subscriptions.push(changeConfiguration); } + +// this method is called when your extension is deactivated +export function deactivate(context: ExtensionContext) { + context.subscriptions.forEach((d) => d.dispose()); +}